mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: cleanup whitespace in headers
This commit is contained in:
@ -32,13 +32,13 @@ typedef struct bin_symbol_t bin_symbol_t;
|
||||
|
||||
/* Binary File */
|
||||
|
||||
bin_file_t * bin_file_new (const char *filename);
|
||||
bin_file_t *bin_file_new (const char *filename);
|
||||
void bin_file_free (bin_file_t *bin_file);
|
||||
const bin_symbol_t *bin_file_lookup_symbol (bin_file_t *bin_file,
|
||||
gulong address);
|
||||
gboolean bin_file_check_inode (bin_file_t *bin_file,
|
||||
ino_t inode);
|
||||
const char * bin_symbol_get_name (bin_file_t *bin_file,
|
||||
const char *bin_symbol_get_name (bin_file_t *bin_file,
|
||||
const bin_symbol_t *symbol);
|
||||
gulong bin_symbol_get_address (bin_file_t *bin_file,
|
||||
const bin_symbol_t *symbol);
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gchar *sysprof_cplus_demangle (const gchar *name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -15,18 +15,19 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct ElfSym ElfSym;
|
||||
typedef struct ElfParser ElfParser;
|
||||
|
||||
ElfParser * elf_parser_new_from_data (const guchar *data,
|
||||
gsize length);
|
||||
ElfParser * elf_parser_new (const char *filename,
|
||||
GError **err);
|
||||
ElfParser *elf_parser_new_from_data (const guchar *data,
|
||||
gsize length);
|
||||
ElfParser *elf_parser_new (const char *filename,
|
||||
GError **err);
|
||||
void elf_parser_free (ElfParser *parser);
|
||||
const char * elf_parser_get_debug_link (ElfParser *parser,
|
||||
guint32 *crc32);
|
||||
const char *elf_parser_get_debug_link (ElfParser *parser,
|
||||
guint32 *crc32);
|
||||
const gchar *elf_parser_get_build_id (ElfParser *parser);
|
||||
const guchar *elf_parser_get_eh_frame (ElfParser *parser);
|
||||
const guchar *elf_parser_get_debug_frame (ElfParser *parser);
|
||||
@ -44,13 +45,14 @@ gulong elf_parser_get_text_offset (ElfParser *parser);
|
||||
* of the file would have been mapped, so a - (m - o) is the position
|
||||
* in the file of a.
|
||||
*/
|
||||
const ElfSym *elf_parser_lookup_symbol (ElfParser *parser,
|
||||
gulong address);
|
||||
guint32 elf_parser_get_crc32 (ElfParser *parser);
|
||||
const char * elf_parser_get_sym_name (ElfParser *parser,
|
||||
const ElfSym *sym);
|
||||
gulong elf_parser_get_sym_address (ElfParser *parser,
|
||||
const ElfSym *sym);
|
||||
gboolean elf_parser_owns_symbol (ElfParser *parser,
|
||||
const ElfSym *sym);
|
||||
char * elf_demangle (const char *name);
|
||||
const ElfSym *elf_parser_lookup_symbol (ElfParser *parser,
|
||||
gulong address);
|
||||
guint32 elf_parser_get_crc32 (ElfParser *parser);
|
||||
const char *elf_parser_get_sym_name (ElfParser *parser,
|
||||
const ElfSym *sym);
|
||||
gulong elf_parser_get_sym_address (ElfParser *parser,
|
||||
const ElfSym *sym);
|
||||
gboolean elf_parser_owns_symbol (ElfParser *parser,
|
||||
const ElfSym *sym);
|
||||
char *elf_demangle (const char *name);
|
||||
|
||||
|
||||
@ -48,7 +48,6 @@ libsysprof_private_sources = [
|
||||
'binfile.c',
|
||||
'demangle.cpp',
|
||||
'elfparser.c',
|
||||
'sysprof-source-util.c',
|
||||
'sysprof-line-reader.c',
|
||||
]
|
||||
|
||||
|
||||
@ -41,9 +41,9 @@ SysprofProfile *sysprof_callgraph_profile_new (void);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofProfile *sysprof_callgraph_profile_new_with_selection (SysprofSelection *selection);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gpointer sysprof_callgraph_profile_get_stash (SysprofCallgraphProfile *self);
|
||||
gpointer sysprof_callgraph_profile_get_stash (SysprofCallgraphProfile *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GQuark sysprof_callgraph_profile_get_tag (SysprofCallgraphProfile *self,
|
||||
const gchar *symbol);
|
||||
GQuark sysprof_callgraph_profile_get_tag (SysprofCallgraphProfile *self,
|
||||
const gchar *symbol);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -24,9 +24,8 @@
|
||||
# error "Only <sysprof.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
#include "sysprof-symbol-resolver.h"
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@ -30,8 +30,10 @@ G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_GJS_SOURCE (sysprof_gjs_source_get_type())
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (SysprofGjsSource, sysprof_gjs_source, SYSPROF, GJS_SOURCE, GObject)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSource *sysprof_gjs_source_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -24,8 +24,6 @@
|
||||
# error "Only <sysprof.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
#include "sysprof-source.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -32,6 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SysprofJitmapSymbolResolver, sysprof_jitmap_symbol_resolver, SYSPROF, JITMAP_SYMBOL_RESOLVER, GObject)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSymbolResolver *sysprof_jitmap_symbol_resolver_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -31,14 +31,14 @@ G_BEGIN_DECLS
|
||||
typedef struct _SysprofKallsyms SysprofKallsyms;
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofKallsyms *sysprof_kallsyms_new (const gchar *path);
|
||||
SysprofKallsyms *sysprof_kallsyms_new (const gchar *path);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_kallsyms_next (SysprofKallsyms *self,
|
||||
const gchar **name,
|
||||
guint64 *address,
|
||||
guint8 *type);
|
||||
gboolean sysprof_kallsyms_next (SysprofKallsyms *self,
|
||||
const gchar **name,
|
||||
guint64 *address,
|
||||
guint8 *type);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_kallsyms_free (SysprofKallsyms *self);
|
||||
void sysprof_kallsyms_free (SysprofKallsyms *self);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofKallsyms, sysprof_kallsyms_free)
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SysprofKernelSymbolResolver, sysprof_kernel_symbol_resolver, SYSPROF, KERNEL_SYMBOL_RESOLVER, GObject)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSymbolResolver *sysprof_kernel_symbol_resolver_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -34,6 +34,7 @@ typedef struct
|
||||
const gchar *name;
|
||||
} SysprofKernelSymbol;
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const SysprofKernelSymbol *sysprof_kernel_symbol_from_address (SysprofCaptureAddress address);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -27,13 +27,13 @@ G_BEGIN_DECLS
|
||||
typedef struct _SysprofLineReader SysprofLineReader;
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
SysprofLineReader *sysprof_line_reader_new (const gchar *contents,
|
||||
gssize length);
|
||||
SysprofLineReader *sysprof_line_reader_new (const gchar *contents,
|
||||
gssize length);
|
||||
G_GNUC_INTERNAL
|
||||
void sysprof_line_reader_free (SysprofLineReader *self);
|
||||
void sysprof_line_reader_free (SysprofLineReader *self);
|
||||
G_GNUC_INTERNAL
|
||||
const gchar *sysprof_line_reader_next (SysprofLineReader *self,
|
||||
gsize *length);
|
||||
const gchar *sysprof_line_reader_next (SysprofLineReader *self,
|
||||
gsize *length);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofLineReader, sysprof_line_reader_free)
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#endif
|
||||
|
||||
#include "sysprof-profiler.h"
|
||||
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -24,8 +24,6 @@
|
||||
# error "Only <sysprof.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "sysprof-capture-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -41,12 +39,15 @@ typedef struct
|
||||
const gchar *filename;
|
||||
} SysprofMap;
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofMapLookaside *sysprof_map_lookaside_new (void);
|
||||
void sysprof_map_lookaside_insert (SysprofMapLookaside *self,
|
||||
const SysprofMap *map);
|
||||
void sysprof_map_lookaside_insert (SysprofMapLookaside *self,
|
||||
const SysprofMap *map);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const SysprofMap *sysprof_map_lookaside_lookup (SysprofMapLookaside *self,
|
||||
SysprofCaptureAddress address);
|
||||
void sysprof_map_lookaside_free (SysprofMapLookaside *self);
|
||||
SysprofCaptureAddress address);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_map_lookaside_free (SysprofMapLookaside *self);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofMapLookaside, sysprof_map_lookaside_free)
|
||||
|
||||
|
||||
@ -24,9 +24,8 @@
|
||||
# error "Only <sysprof.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
#include "sysprof-source.h"
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@ -125,33 +125,32 @@ typedef void (*SysprofPerfCounterCallback) (SysprofPerfCounterEvent *event,
|
||||
guint cpu,
|
||||
gpointer user_data);
|
||||
|
||||
void sysprof_perf_counter_authorize_async (GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean sysprof_perf_counter_authorize_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
GType sysprof_perf_counter_get_type (void);
|
||||
SysprofPerfCounter *sysprof_perf_counter_new (GMainContext *context);
|
||||
void sysprof_perf_counter_set_callback (SysprofPerfCounter *self,
|
||||
SysprofPerfCounterCallback callback,
|
||||
gpointer callback_data,
|
||||
GDestroyNotify callback_data_destroy);
|
||||
void sysprof_perf_counter_add_pid (SysprofPerfCounter *self,
|
||||
GPid pid);
|
||||
gint sysprof_perf_counter_open (SysprofPerfCounter *self,
|
||||
struct perf_event_attr *attr,
|
||||
GPid pid,
|
||||
gint cpu,
|
||||
gint group_fd,
|
||||
gulong flags);
|
||||
void sysprof_perf_counter_take_fd (SysprofPerfCounter *self,
|
||||
int fd);
|
||||
void sysprof_perf_counter_enable (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_disable (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_close (SysprofPerfCounter *self,
|
||||
gint fd);
|
||||
SysprofPerfCounter *sysprof_perf_counter_ref (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_unref (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_authorize_async (GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean sysprof_perf_counter_authorize_finish (GAsyncResult *result,
|
||||
GError **error);
|
||||
GType sysprof_perf_counter_get_type (void);
|
||||
SysprofPerfCounter *sysprof_perf_counter_new (GMainContext *context);
|
||||
void sysprof_perf_counter_set_callback (SysprofPerfCounter *self,
|
||||
SysprofPerfCounterCallback callback,
|
||||
gpointer callback_data,
|
||||
GDestroyNotify callback_data_destroy);
|
||||
void sysprof_perf_counter_add_pid (SysprofPerfCounter *self,
|
||||
GPid pid);
|
||||
gint sysprof_perf_counter_open (SysprofPerfCounter *self,
|
||||
struct perf_event_attr *attr,
|
||||
GPid pid,
|
||||
gint cpu,
|
||||
gint group_fd,
|
||||
gulong flags);
|
||||
void sysprof_perf_counter_take_fd (SysprofPerfCounter *self,
|
||||
int fd);
|
||||
void sysprof_perf_counter_enable (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_disable (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_close (SysprofPerfCounter *self,
|
||||
gint fd);
|
||||
SysprofPerfCounter *sysprof_perf_counter_ref (SysprofPerfCounter *self);
|
||||
void sysprof_perf_counter_unref (SysprofPerfCounter *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -24,9 +24,8 @@
|
||||
# error "Only <sysprof.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
#include "sysprof-source.h"
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -38,7 +37,7 @@ G_DECLARE_FINAL_TYPE (SysprofPerfSource, sysprof_perf_source, SYSPROF, PERF_SOUR
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSource *sysprof_perf_source_new (void);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_perf_source_set_target_pid (SysprofPerfSource *self,
|
||||
GPid pid);
|
||||
void sysprof_perf_source_set_target_pid (SysprofPerfSource *self,
|
||||
GPid pid);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -38,7 +38,7 @@ G_DECLARE_FINAL_TYPE (SysprofProcSource, sysprof_proc_source, SYSPROF, PROC_SOUR
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSource *sysprof_proc_source_new (void);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gchar *sysprof_proc_source_get_command_line (GPid pid,
|
||||
gboolean *is_kernel);
|
||||
gchar *sysprof_proc_source_get_command_line (GPid pid,
|
||||
gboolean *is_kernel);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -36,19 +36,19 @@ SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (SysprofProcessModelItem, sysprof_process_model_item, SYSPROF, PROCESS_MODEL_ITEM, GObject)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofProcessModelItem *sysprof_process_model_item_new (GPid pid);
|
||||
SysprofProcessModelItem *sysprof_process_model_item_new (GPid pid);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
guint sysprof_process_model_item_hash (SysprofProcessModelItem *self);
|
||||
guint sysprof_process_model_item_hash (SysprofProcessModelItem *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_process_model_item_equal (SysprofProcessModelItem *self,
|
||||
SysprofProcessModelItem *other);
|
||||
gboolean sysprof_process_model_item_equal (SysprofProcessModelItem *self,
|
||||
SysprofProcessModelItem *other);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GPid sysprof_process_model_item_get_pid (SysprofProcessModelItem *self);
|
||||
GPid sysprof_process_model_item_get_pid (SysprofProcessModelItem *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const gchar *sysprof_process_model_item_get_command_line (SysprofProcessModelItem *self);
|
||||
const gchar *sysprof_process_model_item_get_command_line (SysprofProcessModelItem *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_process_model_item_is_kernel (SysprofProcessModelItem *self);
|
||||
gboolean sysprof_process_model_item_is_kernel (SysprofProcessModelItem *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const gchar * const *sysprof_process_model_item_get_argv (SysprofProcessModelItem *self);
|
||||
const gchar * const *sysprof_process_model_item_get_argv (SysprofProcessModelItem *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -38,8 +38,8 @@ G_DECLARE_FINAL_TYPE (SysprofProcessModel, sysprof_process_model, SYSPROF, PROCE
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofProcessModel *sysprof_process_model_new (void);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_process_model_reload (SysprofProcessModel *self);
|
||||
void sysprof_process_model_reload (SysprofProcessModel *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_process_model_queue_reload (SysprofProcessModel *self);
|
||||
void sysprof_process_model_queue_reload (SysprofProcessModel *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -26,9 +26,8 @@
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
#include "sysprof-capture-reader.h"
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -53,16 +52,16 @@ struct _SysprofProfileInterface
|
||||
};
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profile_set_reader (SysprofProfile *self,
|
||||
SysprofCaptureReader *reader);
|
||||
void sysprof_profile_set_reader (SysprofProfile *self,
|
||||
SysprofCaptureReader *reader);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profile_generate (SysprofProfile *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
void sysprof_profile_generate (SysprofProfile *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_profile_generate_finish (SysprofProfile *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
gboolean sysprof_profile_generate_finish (SysprofProfile *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -132,57 +132,57 @@ struct _SysprofProfilerInterface
|
||||
};
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_emit_failed (SysprofProfiler *self,
|
||||
const GError *error);
|
||||
void sysprof_profiler_emit_failed (SysprofProfiler *self,
|
||||
const GError *error);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_emit_stopped (SysprofProfiler *self);
|
||||
void sysprof_profiler_emit_stopped (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gdouble sysprof_profiler_get_elapsed (SysprofProfiler *self);
|
||||
gdouble sysprof_profiler_get_elapsed (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_profiler_get_is_mutable (SysprofProfiler *self);
|
||||
gboolean sysprof_profiler_get_is_mutable (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_profiler_get_spawn_inherit_environ (SysprofProfiler *self);
|
||||
gboolean sysprof_profiler_get_spawn_inherit_environ (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_set_spawn_inherit_environ (SysprofProfiler *self,
|
||||
gboolean spawn_inherit_environ);
|
||||
void sysprof_profiler_set_spawn_inherit_environ (SysprofProfiler *self,
|
||||
gboolean spawn_inherit_environ);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_profiler_get_whole_system (SysprofProfiler *self);
|
||||
gboolean sysprof_profiler_get_whole_system (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_set_whole_system (SysprofProfiler *self,
|
||||
gboolean whole_system);
|
||||
void sysprof_profiler_set_whole_system (SysprofProfiler *self,
|
||||
gboolean whole_system);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_profiler_get_spawn (SysprofProfiler *self);
|
||||
gboolean sysprof_profiler_get_spawn (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_set_spawn (SysprofProfiler *self,
|
||||
gboolean spawn);
|
||||
void sysprof_profiler_set_spawn (SysprofProfiler *self,
|
||||
gboolean spawn);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_set_spawn_argv (SysprofProfiler *self,
|
||||
const gchar * const *spawn_argv);
|
||||
void sysprof_profiler_set_spawn_argv (SysprofProfiler *self,
|
||||
const gchar * const *spawn_argv);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_set_spawn_env (SysprofProfiler *self,
|
||||
const gchar * const *spawn_env);
|
||||
void sysprof_profiler_set_spawn_env (SysprofProfiler *self,
|
||||
const gchar * const *spawn_env);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_add_source (SysprofProfiler *self,
|
||||
SysprofSource *source);
|
||||
void sysprof_profiler_add_source (SysprofProfiler *self,
|
||||
SysprofSource *source);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_set_writer (SysprofProfiler *self,
|
||||
SysprofCaptureWriter *writer);
|
||||
void sysprof_profiler_set_writer (SysprofProfiler *self,
|
||||
SysprofCaptureWriter *writer);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofCaptureWriter *sysprof_profiler_get_writer (SysprofProfiler *self);
|
||||
SysprofCaptureWriter *sysprof_profiler_get_writer (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_profiler_get_is_running (SysprofProfiler *self);
|
||||
gboolean sysprof_profiler_get_is_running (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_start (SysprofProfiler *self);
|
||||
void sysprof_profiler_start (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_stop (SysprofProfiler *self);
|
||||
void sysprof_profiler_stop (SysprofProfiler *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_add_pid (SysprofProfiler *self,
|
||||
GPid pid);
|
||||
void sysprof_profiler_add_pid (SysprofProfiler *self,
|
||||
GPid pid);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_profiler_remove_pid (SysprofProfiler *self,
|
||||
GPid pid);
|
||||
void sysprof_profiler_remove_pid (SysprofProfiler *self,
|
||||
GPid pid);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const GPid *sysprof_profiler_get_pids (SysprofProfiler *self,
|
||||
guint *n_pids);
|
||||
const GPid *sysprof_profiler_get_pids (SysprofProfiler *self,
|
||||
guint *n_pids);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -41,24 +41,24 @@ typedef void (*SysprofSelectionForeachFunc) (SysprofSelection *self,
|
||||
gpointer user_data);
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_selection_get_has_selection (SysprofSelection *self);
|
||||
gboolean sysprof_selection_get_has_selection (SysprofSelection *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_selection_contains (SysprofSelection *self,
|
||||
gint64 time_at);
|
||||
gboolean sysprof_selection_contains (SysprofSelection *self,
|
||||
gint64 time_at);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_selection_select_range (SysprofSelection *self,
|
||||
gint64 begin_time,
|
||||
gint64 end_time);
|
||||
void sysprof_selection_select_range (SysprofSelection *self,
|
||||
gint64 begin_time,
|
||||
gint64 end_time);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_selection_unselect_range (SysprofSelection *self,
|
||||
gint64 begin,
|
||||
gint64 end);
|
||||
void sysprof_selection_unselect_range (SysprofSelection *self,
|
||||
gint64 begin,
|
||||
gint64 end);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_selection_unselect_all (SysprofSelection *self);
|
||||
void sysprof_selection_unselect_all (SysprofSelection *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_selection_foreach (SysprofSelection *self,
|
||||
SysprofSelectionForeachFunc foreach_func,
|
||||
gpointer user_data);
|
||||
void sysprof_selection_foreach (SysprofSelection *self,
|
||||
SysprofSelectionForeachFunc foreach_func,
|
||||
gpointer user_data);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSelection *sysprof_selection_copy (const SysprofSelection *self);
|
||||
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
/* sysprof-source-util-private.h
|
||||
*
|
||||
* Copyright 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 3 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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean sysprof_host_file_get_contents (const gchar *host_path,
|
||||
gchar **contents,
|
||||
gsize *len,
|
||||
GError **error);
|
||||
gchar **sysprof_host_list_directories (const gchar *directory,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
@ -1,205 +0,0 @@
|
||||
/* sysprof-source-util.c
|
||||
*
|
||||
* Copyright 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 3 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 "config.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sysprof-source-util-private.h"
|
||||
|
||||
gboolean
|
||||
sysprof_host_file_get_contents (const gchar *host_path,
|
||||
gchar **contents,
|
||||
gsize *len,
|
||||
GError **error)
|
||||
{
|
||||
g_autofree gchar *alt_path = NULL;
|
||||
|
||||
g_return_val_if_fail (host_path != NULL, FALSE);
|
||||
|
||||
if (!g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS))
|
||||
return g_file_get_contents (host_path, contents, len, error);
|
||||
|
||||
if (contents != NULL)
|
||||
*contents = NULL;
|
||||
|
||||
if (len != NULL)
|
||||
*len = 0;
|
||||
|
||||
alt_path = g_build_filename ("/var/run/host", host_path, NULL);
|
||||
|
||||
if (g_file_test (alt_path, G_FILE_TEST_EXISTS))
|
||||
return g_file_get_contents (alt_path, contents, len, error);
|
||||
|
||||
/*
|
||||
* Fallback to try to get it with "cat" on the host since we
|
||||
* may not have access (like for /proc) from /var/run/host.
|
||||
*/
|
||||
|
||||
{
|
||||
g_autoptr(GSubprocessLauncher) launcher = NULL;
|
||||
g_autoptr(GSubprocess) subprocess = NULL;
|
||||
g_autoptr(GBytes) stdout_buf = NULL;
|
||||
|
||||
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
|
||||
G_SUBPROCESS_FLAGS_STDERR_SILENCE);
|
||||
|
||||
subprocess = g_subprocess_launcher_spawn (launcher, error,
|
||||
"flatpak-spawn",
|
||||
"--clear-env",
|
||||
"--host",
|
||||
"cat",
|
||||
host_path,
|
||||
NULL);
|
||||
|
||||
if (subprocess == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!g_subprocess_communicate (subprocess, NULL, NULL, &stdout_buf, NULL, error))
|
||||
return FALSE;
|
||||
|
||||
if (len != NULL)
|
||||
*len = g_bytes_get_size (stdout_buf);
|
||||
|
||||
if (contents != NULL)
|
||||
{
|
||||
const guint8 *data;
|
||||
gsize n;
|
||||
|
||||
/* g_file_get_contents() gurantees a trailing null byte */
|
||||
data = g_bytes_get_data (stdout_buf, &n);
|
||||
*contents = g_malloc (n + 1);
|
||||
memcpy (*contents, data, n);
|
||||
(*contents)[n] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gchar **
|
||||
sysprof_host_list_directories (const gchar *directory,
|
||||
GError **error)
|
||||
{
|
||||
g_autofree gchar *alt_path = NULL;
|
||||
|
||||
g_return_val_if_fail (directory != NULL, NULL);
|
||||
|
||||
if (g_file_test ("/.flatpak-info", G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
g_autoptr(GSubprocessLauncher) launcher = NULL;
|
||||
g_autoptr(GSubprocess) subprocess = NULL;
|
||||
g_autofree gchar *stdout_buf = NULL;
|
||||
g_auto(GStrv) lines = NULL;
|
||||
gsize len;
|
||||
guint j = 0;
|
||||
|
||||
alt_path = g_build_filename ("/var/run/host", directory, NULL);
|
||||
|
||||
if (g_file_test (alt_path, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
directory = alt_path;
|
||||
goto try_native;
|
||||
}
|
||||
|
||||
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
|
||||
G_SUBPROCESS_FLAGS_STDERR_SILENCE);
|
||||
subprocess = g_subprocess_launcher_spawn (launcher, error,
|
||||
"flatpak-spawn",
|
||||
"--clear-env",
|
||||
"--host",
|
||||
"ls",
|
||||
"-1",
|
||||
"-U",
|
||||
"--file-type",
|
||||
directory,
|
||||
NULL);
|
||||
if (subprocess == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!g_subprocess_communicate_utf8 (subprocess, NULL, NULL, &stdout_buf, NULL, error))
|
||||
return NULL;
|
||||
|
||||
lines = g_strsplit (stdout_buf, "\n", 0);
|
||||
len = g_strv_length (lines);
|
||||
|
||||
for (gsize i = 0; i < len; i++)
|
||||
{
|
||||
gsize llen = strlen (lines[i]);
|
||||
|
||||
if (llen == 0 || lines[i][llen-1] != '/')
|
||||
{
|
||||
/* Remove this entry, we'll compress the list later */
|
||||
g_free (lines[i]);
|
||||
lines[i] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* trim trailing / */
|
||||
lines[i][llen-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compress the list by removing NULL links */
|
||||
for (gsize i = 0; i < len; i++)
|
||||
{
|
||||
if (lines[i] == NULL)
|
||||
{
|
||||
if (j <= i)
|
||||
j = i + 1;
|
||||
|
||||
for (; j < len; j++)
|
||||
{
|
||||
if (lines[j] != NULL)
|
||||
{
|
||||
lines[i] = g_steal_pointer (&lines[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return g_steal_pointer (&lines);
|
||||
}
|
||||
|
||||
try_native:
|
||||
|
||||
{
|
||||
g_autoptr(GDir) dir = g_dir_open (directory, 0, error);
|
||||
g_autoptr(GPtrArray) dirs = g_ptr_array_new_with_free_func (g_free);
|
||||
const gchar *name;
|
||||
|
||||
if (dir == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((name = g_dir_read_name (dir)))
|
||||
{
|
||||
g_autofree gchar *path = g_build_filename (directory, name, NULL);
|
||||
|
||||
if (g_file_test (path, G_FILE_TEST_IS_DIR))
|
||||
g_ptr_array_add (dirs, g_steal_pointer (&path));
|
||||
}
|
||||
|
||||
g_ptr_array_add (dirs, NULL);
|
||||
|
||||
return (gchar **)g_ptr_array_free (g_steal_pointer (&dirs), FALSE);
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_SOURCE (sysprof_source_get_type())
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (SysprofSource, sysprof_source, SYSPROF, SOURCE, GObject)
|
||||
|
||||
struct _SysprofSourceInterface
|
||||
@ -120,17 +121,26 @@ struct _SysprofSourceInterface
|
||||
void (*stop) (SysprofSource *self);
|
||||
};
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_add_pid (SysprofSource *self,
|
||||
GPid pid);
|
||||
GPid pid);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_emit_ready (SysprofSource *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_emit_finished (SysprofSource *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_emit_failed (SysprofSource *self,
|
||||
const GError *error);
|
||||
const GError *error);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_source_get_is_ready (SysprofSource *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_prepare (SysprofSource *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_set_writer (SysprofSource *self,
|
||||
SysprofCaptureWriter *writer);
|
||||
SysprofCaptureWriter *writer);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_start (SysprofSource *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_source_stop (SysprofSource *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -36,6 +36,6 @@ SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_symbol_dirs_remove (const gchar *dir);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gchar **sysprof_symbol_dirs_get_paths (const gchar *dir,
|
||||
const gchar *name);
|
||||
const gchar *name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -28,11 +28,13 @@
|
||||
|
||||
#include "sysprof-address.h"
|
||||
#include "sysprof-capture-reader.h"
|
||||
#include "sysprof-version-macros.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_SYMBOL_RESOLVER (sysprof_symbol_resolver_get_type())
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (SysprofSymbolResolver, sysprof_symbol_resolver, SYSPROF, SYMBOL_RESOLVER, GObject)
|
||||
|
||||
struct _SysprofSymbolResolverInterface
|
||||
@ -54,18 +56,21 @@ struct _SysprofSymbolResolverInterface
|
||||
GQuark *tag);
|
||||
};
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_symbol_resolver_load (SysprofSymbolResolver *self,
|
||||
SysprofCaptureReader *reader);
|
||||
SysprofCaptureReader *reader);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gchar *sysprof_symbol_resolver_resolve (SysprofSymbolResolver *self,
|
||||
guint64 time,
|
||||
GPid pid,
|
||||
SysprofCaptureAddress address,
|
||||
GQuark *tag);
|
||||
guint64 time,
|
||||
GPid pid,
|
||||
SysprofCaptureAddress address,
|
||||
GQuark *tag);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gchar *sysprof_symbol_resolver_resolve_with_context (SysprofSymbolResolver *self,
|
||||
guint64 time,
|
||||
GPid pid,
|
||||
SysprofAddressContext context,
|
||||
SysprofCaptureAddress address,
|
||||
GQuark *tag);
|
||||
guint64 time,
|
||||
GPid pid,
|
||||
SysprofAddressContext context,
|
||||
SysprofCaptureAddress address,
|
||||
GQuark *tag);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user