libsysprof-capture: add availability macros

This commit is contained in:
Christian Hergert
2019-05-08 10:12:36 -07:00
parent 6ba408f073
commit d9d572b557
6 changed files with 74 additions and 17 deletions

View File

@ -21,22 +21,32 @@
#pragma once
#include "sp-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_copy (const SpCaptureCondition *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_condition_unref (SpCaptureCondition *self);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_ref (SpCaptureCondition *self);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_new_and (SpCaptureCondition *left,
SpCaptureCondition *right);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_new_where_type_in (guint n_types,
const SpCaptureFrameType *types);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_new_where_time_between (gint64 begin_time,
gint64 end_time);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_new_where_pid_in (guint n_pids,
const gint32 *pids);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCondition *sp_capture_condition_new_where_counter_in (guint n_counters,
const guint *counters);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_condition_match (const SpCaptureCondition *self,
const SpCaptureFrame *frame);

View File

@ -21,6 +21,7 @@
#pragma once
#include "sp-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
@ -40,15 +41,23 @@ typedef struct _SpCaptureCursor SpCaptureCursor;
typedef gboolean (*SpCaptureCursorCallback) (const SpCaptureFrame *frame,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCursor *sp_capture_cursor_new (SpCaptureReader *reader);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_cursor_unref (SpCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureCursor *sp_capture_cursor_ref (SpCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_capture_cursor_get_reader (SpCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_cursor_foreach (SpCaptureCursor *self,
SpCaptureCursorCallback callback,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_cursor_reset (SpCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_cursor_reverse (SpCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_cursor_add_condition (SpCaptureCursor *self,
SpCaptureCondition *condition);

View File

@ -21,52 +21,71 @@
#pragma once
#include "sp-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
typedef struct _SpCaptureReader SpCaptureReader;
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_capture_reader_new (const gchar *filename,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_capture_reader_new_from_fd (int fd,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_capture_reader_copy (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_capture_reader_ref (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_reader_unref (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const gchar *sp_capture_reader_get_filename (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const gchar *sp_capture_reader_get_time (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
gint64 sp_capture_reader_get_start_time (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
gint64 sp_capture_reader_get_end_time (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_reader_skip (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_reader_peek_type (SpCaptureReader *self,
SpCaptureFrameType *type);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_reader_peek_frame (SpCaptureReader *self,
SpCaptureFrame *frame);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureMap *sp_capture_reader_read_map (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureMark *sp_capture_reader_read_mark (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureExit *sp_capture_reader_read_exit (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureFork *sp_capture_reader_read_fork (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureTimestamp *sp_capture_reader_read_timestamp (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureProcess *sp_capture_reader_read_process (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureSample *sp_capture_reader_read_sample (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
GHashTable *sp_capture_reader_read_jitmap (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureFrameCounterDefine *sp_capture_reader_read_counter_define (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
const SpCaptureFrameCounterSet *sp_capture_reader_read_counter_set (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_reader_reset (SpCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_reader_splice (SpCaptureReader *self,
SpCaptureWriter *dest,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_reader_save_as (SpCaptureReader *self,
const gchar *filename,
GError **error);
#ifdef SP_ENABLE_GOBJECT
# define SP_TYPE_CAPTURE_READER (sp_capture_reader_get_type())
GType sp_capture_reader_get_type (void);
#endif
#if GLIB_CHECK_VERSION(2, 44, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureReader, sp_capture_reader_unref)
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureReader, sp_capture_reader_unref)
G_END_DECLS

View File

@ -53,4 +53,5 @@ ssize_t _sp_sendfile (int out_fd,
int in_fd,
off_t *offset,
size_t count);
#endif

View File

@ -21,6 +21,7 @@
#pragma once
#include "sp-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
@ -39,15 +40,22 @@ typedef struct
gsize padding[48];
} SpCaptureStat;
SYSPROF_AVAILABLE_IN_ALL
SpCaptureWriter *sp_capture_writer_new_from_env (gsize buffer_size);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureWriter *sp_capture_writer_new (const gchar *filename,
gsize buffer_size);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureWriter *sp_capture_writer_new_from_fd (int fd,
gsize buffer_size);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureWriter *sp_capture_writer_ref (SpCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_writer_unref (SpCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL
void sp_capture_writer_stat (SpCaptureWriter *self,
SpCaptureStat *stat);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_map (SpCaptureWriter *self,
gint64 time,
gint cpu,
@ -57,6 +65,7 @@ gboolean sp_capture_writer_add_map (SpCaptureWriter *
guint64 offset,
guint64 inode,
const gchar *filename);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_mark (SpCaptureWriter *self,
gint64 time,
gint cpu,
@ -65,13 +74,16 @@ gboolean sp_capture_writer_add_mark (SpCaptureWriter *
const gchar *group,
const gchar *name,
const gchar *message);
SYSPROF_AVAILABLE_IN_ALL
guint64 sp_capture_writer_add_jitmap (SpCaptureWriter *self,
const gchar *name);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_process (SpCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
const gchar *cmdline);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_sample (SpCaptureWriter *self,
gint64 time,
gint cpu,
@ -79,25 +91,30 @@ gboolean sp_capture_writer_add_sample (SpCaptureWriter *
gint32 tid,
const SpCaptureAddress *addrs,
guint n_addrs);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_fork (SpCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
gint32 child_pid);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_exit (SpCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_add_timestamp (SpCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_define_counters (SpCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
const SpCaptureCounter *counters,
guint n_counters);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_set_counters (SpCaptureWriter *self,
gint64 time,
gint cpu,
@ -105,31 +122,31 @@ gboolean sp_capture_writer_set_counters (SpCaptureWriter *
const guint *counters_ids,
const SpCaptureCounterValue *values,
guint n_counters);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_flush (SpCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_save_as (SpCaptureWriter *self,
const gchar *filename,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
guint sp_capture_writer_request_counter (SpCaptureWriter *self,
guint n_counters);
SYSPROF_AVAILABLE_IN_ALL
SpCaptureReader *sp_capture_writer_create_reader (SpCaptureWriter *self,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
gboolean sp_capture_writer_splice (SpCaptureWriter *self,
SpCaptureWriter *dest,
GError **error);
G_GNUC_INTERNAL
gboolean _sp_capture_writer_splice_from_fd (SpCaptureWriter *self,
int fd,
GError **error) G_GNUC_INTERNAL;
G_GNUC_INTERNAL
gboolean _sp_capture_writer_set_time_range (SpCaptureWriter *self,
gint64 start_time,
gint64 end_time) G_GNUC_INTERNAL;
#ifdef SP_ENABLE_GOBJECT
# define SP_TYPE_CAPTURE_WRITER (sp_capture_writer_get_type())
GType sp_capture_writer_get_type (void);
#endif
#if GLIB_CHECK_VERSION(2, 44, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureWriter, sp_capture_writer_unref)
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureWriter, sp_capture_writer_unref)
G_END_DECLS

View File

@ -20,10 +20,11 @@
#pragma once
#include <glib.h>
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
SYSPROF_AVAILABLE_IN_ALL
int sp_memfd_create (const gchar *desc);
G_END_DECLS