mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
shared: remove use of libshared
This moves everything into other places and simple includes the files in the cases that it is necessary. In the future, we can rewrite sysprofd to use GDBus and add GetProcFile() to allow for client-side processing of kallsyms.
This commit is contained in:
@ -1,19 +1,25 @@
|
|||||||
libsysprof_capture_headers = [
|
libsysprof_capture_headers = [
|
||||||
|
'sp-address.h',
|
||||||
|
'sp-clock.h',
|
||||||
'sp-capture-condition.h',
|
'sp-capture-condition.h',
|
||||||
'sp-capture-cursor.h',
|
'sp-capture-cursor.h',
|
||||||
'sp-capture-reader.h',
|
'sp-capture-reader.h',
|
||||||
'sp-capture-types.h',
|
'sp-capture-types.h',
|
||||||
'sp-capture-writer.h',
|
'sp-capture-writer.h',
|
||||||
|
'sp-platform.h',
|
||||||
'sysprof-capture.h',
|
'sysprof-capture.h',
|
||||||
'sysprof-version-macros.h',
|
'sysprof-version-macros.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
libsysprof_capture_sources = [
|
libsysprof_capture_sources = [
|
||||||
|
'sp-address.c',
|
||||||
'sp-capture-condition.c',
|
'sp-capture-condition.c',
|
||||||
'sp-capture-cursor.c',
|
'sp-capture-cursor.c',
|
||||||
'sp-capture-reader.c',
|
'sp-capture-reader.c',
|
||||||
'sp-capture-writer.c',
|
|
||||||
'sp-capture-util.c',
|
'sp-capture-util.c',
|
||||||
|
'sp-capture-writer.c',
|
||||||
|
'sp-clock.c',
|
||||||
|
'sp-platform.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
@ -25,7 +31,6 @@ configure_file(
|
|||||||
|
|
||||||
libsysprof_capture_deps = [
|
libsysprof_capture_deps = [
|
||||||
dependency('glib-2.0', version: glib_req_version),
|
dependency('glib-2.0', version: glib_req_version),
|
||||||
libshared_dep,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
install_headers(libsysprof_capture_headers, subdir: sysprof_header_subdir)
|
install_headers(libsysprof_capture_headers, subdir: sysprof_header_subdir)
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glib.h>
|
#include "sysprof-version-macros.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -39,8 +39,10 @@ typedef enum
|
|||||||
SP_ADDRESS_CONTEXT_GUEST_USER,
|
SP_ADDRESS_CONTEXT_GUEST_USER,
|
||||||
} SpAddressContext;
|
} SpAddressContext;
|
||||||
|
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
gboolean sp_address_is_context_switch (SpAddress address,
|
gboolean sp_address_is_context_switch (SpAddress address,
|
||||||
SpAddressContext *context);
|
SpAddressContext *context);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
const gchar *sp_address_context_to_string (SpAddressContext context);
|
const gchar *sp_address_context_to_string (SpAddressContext context);
|
||||||
|
|
||||||
static inline gint
|
static inline gint
|
||||||
@ -23,13 +23,16 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "sysprof-version-macros.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef gint SpClock;
|
typedef gint SpClock;
|
||||||
typedef gint64 SpTimeStamp;
|
typedef gint64 SpTimeStamp;
|
||||||
typedef gint32 SpTimeSpan;
|
typedef gint32 SpTimeSpan;
|
||||||
|
|
||||||
extern SpClock sp_clock;
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
SpClock sp_clock;
|
||||||
|
|
||||||
static inline SpTimeStamp
|
static inline SpTimeStamp
|
||||||
sp_clock_get_current_time (void)
|
sp_clock_get_current_time (void)
|
||||||
@ -50,6 +53,7 @@ sp_clock_get_relative_time (SpTimeStamp epoch)
|
|||||||
return sp_clock_get_current_time () - epoch;
|
return sp_clock_get_current_time () - epoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sp_clock_init (void);
|
void sp_clock_init (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
@ -32,7 +32,6 @@ G_BEGIN_DECLS
|
|||||||
# include "sp-capture-reader.h"
|
# include "sp-capture-reader.h"
|
||||||
# include "sp-capture-writer.h"
|
# include "sp-capture-writer.h"
|
||||||
# include "sp-clock.h"
|
# include "sp-clock.h"
|
||||||
# include "sp-error.h"
|
|
||||||
# include "sysprof-version.h"
|
# include "sysprof-version.h"
|
||||||
# include "sysprof-version-macros.h"
|
# include "sysprof-version-macros.h"
|
||||||
|
|
||||||
|
|||||||
@ -20,10 +20,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if !defined (SYSPROF_CAPTURE_INSIDE) && !defined (SYSPROF_CAPTURE_COMPILATION)
|
|
||||||
# error "Only <sysprof-capture.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "sysprof-version.h"
|
#include "sysprof-version.h"
|
||||||
|
|||||||
@ -20,10 +20,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if !defined(SYSPROF_CAPTURE_INSIDE) && !defined(SYSPROF_CAPTURE_COMPILATION)
|
|
||||||
# error "Only <sysprof-capture.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:sysprof-version
|
* SECTION:sysprof-version
|
||||||
* @short_description: sysprof version checking
|
* @short_description: sysprof version checking
|
||||||
|
|||||||
@ -6,6 +6,7 @@ libsysprof_public_sources = [
|
|||||||
'sp-elf-symbol-resolver.c',
|
'sp-elf-symbol-resolver.c',
|
||||||
'sp-hostinfo-source.c',
|
'sp-hostinfo-source.c',
|
||||||
'sp-jitmap-symbol-resolver.c',
|
'sp-jitmap-symbol-resolver.c',
|
||||||
|
'sp-kallsyms.c',
|
||||||
'sp-kernel-symbol.c',
|
'sp-kernel-symbol.c',
|
||||||
'sp-kernel-symbol-resolver.c',
|
'sp-kernel-symbol-resolver.c',
|
||||||
'sp-local-profiler.c',
|
'sp-local-profiler.c',
|
||||||
@ -27,6 +28,7 @@ libsysprof_public_headers = [
|
|||||||
'sp-elf-symbol-resolver.h',
|
'sp-elf-symbol-resolver.h',
|
||||||
'sp-hostinfo-source.h',
|
'sp-hostinfo-source.h',
|
||||||
'sp-jitmap-symbol-resolver.h',
|
'sp-jitmap-symbol-resolver.h',
|
||||||
|
'sp-kallsyms.h',
|
||||||
'sp-kernel-symbol.h',
|
'sp-kernel-symbol.h',
|
||||||
'sp-kernel-symbol-resolver.h',
|
'sp-kernel-symbol-resolver.h',
|
||||||
'sp-local-profiler.h',
|
'sp-local-profiler.h',
|
||||||
@ -48,6 +50,7 @@ libsysprof_private_sources = [
|
|||||||
'elfparser.c',
|
'elfparser.c',
|
||||||
'stackstash.c',
|
'stackstash.c',
|
||||||
'sp-source-util.c',
|
'sp-source-util.c',
|
||||||
|
'sp-line-reader.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
libsysprof_deps = [
|
libsysprof_deps = [
|
||||||
|
|||||||
@ -20,19 +20,20 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glib.h>
|
#include "sysprof-version-macros.h"
|
||||||
|
|
||||||
#include "sp-kallsyms.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _SpKallsyms SpKallsyms;
|
typedef struct _SpKallsyms SpKallsyms;
|
||||||
|
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
SpKallsyms *sp_kallsyms_new (const gchar *path);
|
SpKallsyms *sp_kallsyms_new (const gchar *path);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
gboolean sp_kallsyms_next (SpKallsyms *self,
|
gboolean sp_kallsyms_next (SpKallsyms *self,
|
||||||
const gchar **name,
|
const gchar **name,
|
||||||
guint64 *address,
|
guint64 *address,
|
||||||
guint8 *type);
|
guint8 *type);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sp_kallsyms_free (SpKallsyms *self);
|
void sp_kallsyms_free (SpKallsyms *self);
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpKallsyms, sp_kallsyms_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpKallsyms, sp_kallsyms_free)
|
||||||
@ -27,7 +27,6 @@
|
|||||||
#include <sysprof-capture.h>
|
#include <sysprof-capture.h>
|
||||||
|
|
||||||
#include "sp-kallsyms.h"
|
#include "sp-kallsyms.h"
|
||||||
#include "sp-line-reader.h"
|
|
||||||
#include "sp-kernel-symbol.h"
|
#include "sp-kernel-symbol.h"
|
||||||
|
|
||||||
static GArray *kernel_symbols;
|
static GArray *kernel_symbols;
|
||||||
|
|||||||
@ -26,9 +26,12 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _SpLineReader SpLineReader;
|
typedef struct _SpLineReader SpLineReader;
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
SpLineReader *sp_line_reader_new (const gchar *contents,
|
SpLineReader *sp_line_reader_new (const gchar *contents,
|
||||||
gssize length);
|
gssize length);
|
||||||
|
G_GNUC_INTERNAL
|
||||||
void sp_line_reader_free (SpLineReader *self);
|
void sp_line_reader_free (SpLineReader *self);
|
||||||
|
G_GNUC_INTERNAL
|
||||||
const gchar *sp_line_reader_next (SpLineReader *self,
|
const gchar *sp_line_reader_next (SpLineReader *self,
|
||||||
gsize *length);
|
gsize *length);
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ G_BEGIN_DECLS
|
|||||||
# include "sp-callgraph-profile.h"
|
# include "sp-callgraph-profile.h"
|
||||||
# include "sp-capture-gobject.h"
|
# include "sp-capture-gobject.h"
|
||||||
# include "sp-local-profiler.h"
|
# include "sp-local-profiler.h"
|
||||||
|
# include "sp-kallsyms.h"
|
||||||
# include "sp-profile.h"
|
# include "sp-profile.h"
|
||||||
# include "sp-profiler.h"
|
# include "sp-profiler.h"
|
||||||
# include "sp-map-lookaside.h"
|
# include "sp-map-lookaside.h"
|
||||||
|
|||||||
@ -7,7 +7,6 @@ sysprof_version_conf.set('MINOR_VERSION', sysprof_version[1])
|
|||||||
sysprof_version_conf.set('MICRO_VERSION', sysprof_version[2])
|
sysprof_version_conf.set('MICRO_VERSION', sysprof_version[2])
|
||||||
sysprof_version_conf.set('VERSION', meson.project_version())
|
sysprof_version_conf.set('VERSION', meson.project_version())
|
||||||
|
|
||||||
subdir('shared')
|
|
||||||
subdir('libsysprof-capture')
|
subdir('libsysprof-capture')
|
||||||
subdir('sysprofd')
|
subdir('sysprofd')
|
||||||
subdir('libsysprof')
|
subdir('libsysprof')
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
shared_sources = [
|
|
||||||
'sp-address.c',
|
|
||||||
'sp-clock.c',
|
|
||||||
'sp-error.c',
|
|
||||||
'sp-line-reader.c',
|
|
||||||
'sp-platform.c',
|
|
||||||
'sp-kallsyms.c',
|
|
||||||
]
|
|
||||||
|
|
||||||
shared_public_headers = [
|
|
||||||
'sp-address.h',
|
|
||||||
'sp-clock.h',
|
|
||||||
'sp-error.h',
|
|
||||||
'sp-platform.h',
|
|
||||||
'sp-kallsyms.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
install_headers(shared_public_headers, subdir: sysprof_header_subdir)
|
|
||||||
|
|
||||||
libshared_deps = [
|
|
||||||
dependency('glib-2.0'),
|
|
||||||
]
|
|
||||||
|
|
||||||
libshared = static_library('shared', shared_sources,
|
|
||||||
dependencies: libshared_deps,
|
|
||||||
)
|
|
||||||
|
|
||||||
libshared_dep = declare_dependency(
|
|
||||||
link_whole: libshared,
|
|
||||||
include_directories: include_directories('.'),
|
|
||||||
)
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
/* sp-error.c
|
|
||||||
*
|
|
||||||
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sp-error.h"
|
|
||||||
|
|
||||||
GQuark
|
|
||||||
sp_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!quark))
|
|
||||||
quark = g_quark_from_static_string ("sp-error-quark");
|
|
||||||
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
/* sp-error.h
|
|
||||||
*
|
|
||||||
* Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
|
|
||||||
*
|
|
||||||
* This file is free software; you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2 of the License, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This file is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define SP_ERROR (sp_error_quark())
|
|
||||||
|
|
||||||
GQuark sp_error_quark (void);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
@ -14,7 +14,6 @@ sysprof_resources = gnome.compile_resources('sysprof-resources', 'sysprof.gresou
|
|||||||
|
|
||||||
sysprof_deps = [
|
sysprof_deps = [
|
||||||
cc.find_library('m', required: false),
|
cc.find_library('m', required: false),
|
||||||
libshared_dep,
|
|
||||||
libsysprof_capture_dep,
|
libsysprof_capture_dep,
|
||||||
libsysprof_dep,
|
libsysprof_dep,
|
||||||
libsysprof_ui_dep,
|
libsysprof_ui_dep,
|
||||||
|
|||||||
@ -4,6 +4,7 @@ sysprofd_sources = [
|
|||||||
'sysprofd.c',
|
'sysprofd.c',
|
||||||
'sd-bus-helper.c',
|
'sd-bus-helper.c',
|
||||||
'sd-bus-helper.h',
|
'sd-bus-helper.h',
|
||||||
|
'../libsysprof/sp-kallsyms.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
|
pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
|
||||||
@ -11,14 +12,14 @@ pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
|
|||||||
sysprofd_deps = [
|
sysprofd_deps = [
|
||||||
dependency('libsystemd', version: '>=222'),
|
dependency('libsystemd', version: '>=222'),
|
||||||
dependency('glib-2.0', version: glib_req_version),
|
dependency('glib-2.0', version: glib_req_version),
|
||||||
libshared_dep,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sysprofd = executable('sysprofd', sysprofd_sources,
|
sysprofd = executable('sysprofd', sysprofd_sources,
|
||||||
dependencies: sysprofd_deps,
|
dependencies: sysprofd_deps,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: pkglibexecdir,
|
install_dir: pkglibexecdir,
|
||||||
pie: true,
|
pie: true,
|
||||||
|
include_directories: [include_directories('.'), '../libsysprof'],
|
||||||
)
|
)
|
||||||
|
|
||||||
sysprofdconf = configuration_data()
|
sysprofdconf = configuration_data()
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#include "../shared/sp-address.h"
|
|
||||||
#include "../shared/sp-kallsyms.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sysprof.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main (gint argc,
|
main (gint argc,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
tools_deps = [
|
tools_deps = [
|
||||||
libshared_dep,
|
|
||||||
libsysprof_capture_dep,
|
libsysprof_capture_dep,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user