mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof: whitespace cleanup
This commit is contained in:
@ -104,18 +104,13 @@ struct _SysprofCaptureWriter
|
|||||||
SysprofCaptureStat stat;
|
SysprofCaptureStat stat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SYSPROF_ENABLE_GOBJECT
|
|
||||||
G_DEFINE_BOXED_TYPE (SysprofCaptureWriter, sysprof_capture_writer,
|
|
||||||
sysprof_capture_writer_ref, sysprof_capture_writer_unref)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
sysprof_capture_writer_frame_init (SysprofCaptureFrame *frame_,
|
sysprof_capture_writer_frame_init (SysprofCaptureFrame *frame_,
|
||||||
gint len,
|
gint len,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
gint64 time_,
|
gint64 time_,
|
||||||
SysprofCaptureFrameType type)
|
SysprofCaptureFrameType type)
|
||||||
{
|
{
|
||||||
g_assert (frame_ != NULL);
|
g_assert (frame_ != NULL);
|
||||||
|
|
||||||
@ -203,7 +198,7 @@ sysprof_capture_writer_realign (gsize *pos)
|
|||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self,
|
sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self,
|
||||||
gsize len)
|
gsize len)
|
||||||
{
|
{
|
||||||
/* Check for max frame size */
|
/* Check for max frame size */
|
||||||
if (len > G_MAXUSHORT)
|
if (len > G_MAXUSHORT)
|
||||||
@ -220,7 +215,7 @@ sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
static inline gpointer
|
static inline gpointer
|
||||||
sysprof_capture_writer_allocate (SysprofCaptureWriter *self,
|
sysprof_capture_writer_allocate (SysprofCaptureWriter *self,
|
||||||
gsize *len)
|
gsize *len)
|
||||||
{
|
{
|
||||||
gpointer p;
|
gpointer p;
|
||||||
|
|
||||||
@ -261,11 +256,11 @@ sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self)
|
|||||||
sysprof_capture_writer_realign (&len);
|
sysprof_capture_writer_realign (&len);
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&jitmap.frame,
|
sysprof_capture_writer_frame_init (&jitmap.frame,
|
||||||
len,
|
len,
|
||||||
-1,
|
-1,
|
||||||
_sysprof_getpid (),
|
_sysprof_getpid (),
|
||||||
SYSPROF_CAPTURE_CURRENT_TIME,
|
SYSPROF_CAPTURE_CURRENT_TIME,
|
||||||
SYSPROF_CAPTURE_FRAME_JITMAP);
|
SYSPROF_CAPTURE_FRAME_JITMAP);
|
||||||
jitmap.n_jitmaps = self->addr_hash_size;
|
jitmap.n_jitmaps = self->addr_hash_size;
|
||||||
|
|
||||||
if (sizeof jitmap != _sysprof_write (self->fd, &jitmap, sizeof jitmap))
|
if (sizeof jitmap != _sysprof_write (self->fd, &jitmap, sizeof jitmap))
|
||||||
@ -286,8 +281,8 @@ sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
|
sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
SysprofCaptureAddress *addr)
|
SysprofCaptureAddress *addr)
|
||||||
{
|
{
|
||||||
guint hash;
|
guint hash;
|
||||||
guint i;
|
guint i;
|
||||||
@ -331,7 +326,7 @@ sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
static SysprofCaptureAddress
|
static SysprofCaptureAddress
|
||||||
sysprof_capture_writer_insert_jitmap (SysprofCaptureWriter *self,
|
sysprof_capture_writer_insert_jitmap (SysprofCaptureWriter *self,
|
||||||
const gchar *str)
|
const gchar *str)
|
||||||
{
|
{
|
||||||
SysprofCaptureAddress addr;
|
SysprofCaptureAddress addr;
|
||||||
gchar *dst;
|
gchar *dst;
|
||||||
@ -414,7 +409,7 @@ sysprof_capture_writer_insert_jitmap (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
SysprofCaptureWriter *
|
SysprofCaptureWriter *
|
||||||
sysprof_capture_writer_new_from_fd (int fd,
|
sysprof_capture_writer_new_from_fd (int fd,
|
||||||
gsize buffer_size)
|
gsize buffer_size)
|
||||||
{
|
{
|
||||||
g_autofree gchar *nowstr = NULL;
|
g_autofree gchar *nowstr = NULL;
|
||||||
SysprofCaptureWriter *self;
|
SysprofCaptureWriter *self;
|
||||||
@ -483,7 +478,7 @@ sysprof_capture_writer_new_from_fd (int fd,
|
|||||||
|
|
||||||
SysprofCaptureWriter *
|
SysprofCaptureWriter *
|
||||||
sysprof_capture_writer_new (const gchar *filename,
|
sysprof_capture_writer_new (const gchar *filename,
|
||||||
gsize buffer_size)
|
gsize buffer_size)
|
||||||
{
|
{
|
||||||
SysprofCaptureWriter *self;
|
SysprofCaptureWriter *self;
|
||||||
int fd;
|
int fd;
|
||||||
@ -505,14 +500,14 @@ sysprof_capture_writer_new (const gchar *filename,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
guint64 start,
|
guint64 start,
|
||||||
guint64 end,
|
guint64 end,
|
||||||
guint64 offset,
|
guint64 offset,
|
||||||
guint64 inode,
|
guint64 inode,
|
||||||
const gchar *filename)
|
const gchar *filename)
|
||||||
{
|
{
|
||||||
SysprofCaptureMap *ev;
|
SysprofCaptureMap *ev;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -530,11 +525,11 @@ sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_MAP);
|
SYSPROF_CAPTURE_FRAME_MAP);
|
||||||
ev->start = start;
|
ev->start = start;
|
||||||
ev->end = end;
|
ev->end = end;
|
||||||
ev->offset = offset;
|
ev->offset = offset;
|
||||||
@ -550,13 +545,13 @@ sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
guint64 duration,
|
guint64 duration,
|
||||||
const gchar *group,
|
const gchar *group,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const gchar *message)
|
const gchar *message)
|
||||||
{
|
{
|
||||||
SysprofCaptureMark *ev;
|
SysprofCaptureMark *ev;
|
||||||
gsize message_len;
|
gsize message_len;
|
||||||
@ -576,11 +571,11 @@ sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_MARK);
|
SYSPROF_CAPTURE_FRAME_MARK);
|
||||||
|
|
||||||
ev->duration = duration;
|
ev->duration = duration;
|
||||||
g_strlcpy (ev->group, group, sizeof ev->group);
|
g_strlcpy (ev->group, group, sizeof ev->group);
|
||||||
@ -594,7 +589,7 @@ sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
SysprofCaptureAddress
|
SysprofCaptureAddress
|
||||||
sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
SysprofCaptureAddress addr = INVALID_ADDRESS;
|
SysprofCaptureAddress addr = INVALID_ADDRESS;
|
||||||
|
|
||||||
@ -612,10 +607,10 @@ sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
const gchar *cmdline)
|
const gchar *cmdline)
|
||||||
{
|
{
|
||||||
SysprofCaptureProcess *ev;
|
SysprofCaptureProcess *ev;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -633,11 +628,11 @@ sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_PROCESS);
|
SYSPROF_CAPTURE_FRAME_PROCESS);
|
||||||
|
|
||||||
g_strlcpy (ev->cmdline, cmdline, len - sizeof *ev);
|
g_strlcpy (ev->cmdline, cmdline, len - sizeof *ev);
|
||||||
ev->cmdline[len - sizeof *ev - 1] = '\0';
|
ev->cmdline[len - sizeof *ev - 1] = '\0';
|
||||||
@ -649,12 +644,12 @@ sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
gint32 tid,
|
gint32 tid,
|
||||||
const SysprofCaptureAddress *addrs,
|
const SysprofCaptureAddress *addrs,
|
||||||
guint n_addrs)
|
guint n_addrs)
|
||||||
{
|
{
|
||||||
SysprofCaptureSample *ev;
|
SysprofCaptureSample *ev;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -668,11 +663,11 @@ sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_SAMPLE);
|
SYSPROF_CAPTURE_FRAME_SAMPLE);
|
||||||
ev->n_addrs = n_addrs;
|
ev->n_addrs = n_addrs;
|
||||||
ev->tid = tid;
|
ev->tid = tid;
|
||||||
|
|
||||||
@ -685,10 +680,10 @@ sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
gint32 child_pid)
|
gint32 child_pid)
|
||||||
{
|
{
|
||||||
SysprofCaptureFork *ev;
|
SysprofCaptureFork *ev;
|
||||||
gsize len = sizeof *ev;
|
gsize len = sizeof *ev;
|
||||||
@ -700,11 +695,11 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_FORK);
|
SYSPROF_CAPTURE_FRAME_FORK);
|
||||||
ev->child_pid = child_pid;
|
ev->child_pid = child_pid;
|
||||||
|
|
||||||
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]++;
|
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]++;
|
||||||
@ -714,9 +709,9 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid)
|
gint32 pid)
|
||||||
{
|
{
|
||||||
SysprofCaptureExit *ev;
|
SysprofCaptureExit *ev;
|
||||||
gsize len = sizeof *ev;
|
gsize len = sizeof *ev;
|
||||||
@ -728,11 +723,11 @@ sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_EXIT);
|
SYSPROF_CAPTURE_FRAME_EXIT);
|
||||||
|
|
||||||
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]++;
|
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]++;
|
||||||
|
|
||||||
@ -741,9 +736,9 @@ sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
|
sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid)
|
gint32 pid)
|
||||||
{
|
{
|
||||||
SysprofCaptureTimestamp *ev;
|
SysprofCaptureTimestamp *ev;
|
||||||
gsize len = sizeof *ev;
|
gsize len = sizeof *ev;
|
||||||
@ -755,13 +750,13 @@ sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&ev->frame,
|
sysprof_capture_writer_frame_init (&ev->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_TIMESTAMP);
|
SYSPROF_CAPTURE_FRAME_TIMESTAMP);
|
||||||
|
|
||||||
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_TIMESTAMP]++;
|
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_TIMESTAMP]++;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -778,9 +773,9 @@ sysprof_capture_writer_flush_end_time (SysprofCaptureWriter *self)
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
ret = _sysprof_pwrite (self->fd,
|
ret = _sysprof_pwrite (self->fd,
|
||||||
&end_time,
|
&end_time,
|
||||||
sizeof (end_time),
|
sizeof (end_time),
|
||||||
G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time));
|
G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time));
|
||||||
|
|
||||||
if (ret < 0 && errno == EAGAIN)
|
if (ret < 0 && errno == EAGAIN)
|
||||||
goto again;
|
goto again;
|
||||||
@ -812,9 +807,9 @@ sysprof_capture_writer_flush (SysprofCaptureWriter *self)
|
|||||||
* Returns: %TRUE if successful, otherwise %FALSE and @error is set.
|
* Returns: %TRUE if successful, otherwise %FALSE and @error is set.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
|
sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gsize to_write;
|
gsize to_write;
|
||||||
off_t in_off;
|
off_t in_off;
|
||||||
@ -891,8 +886,8 @@ handle_errno:
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
_sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
|
_sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
|
||||||
int fd,
|
int fd,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
off_t in_off;
|
off_t in_off;
|
||||||
@ -959,8 +954,8 @@ handle_errno:
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_splice (SysprofCaptureWriter *self,
|
sysprof_capture_writer_splice (SysprofCaptureWriter *self,
|
||||||
SysprofCaptureWriter *dest,
|
SysprofCaptureWriter *dest,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
off_t pos;
|
off_t pos;
|
||||||
@ -1015,7 +1010,7 @@ handle_errno:
|
|||||||
*/
|
*/
|
||||||
SysprofCaptureReader *
|
SysprofCaptureReader *
|
||||||
sysprof_capture_writer_create_reader (SysprofCaptureWriter *self,
|
sysprof_capture_writer_create_reader (SysprofCaptureWriter *self,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
int copy;
|
int copy;
|
||||||
|
|
||||||
@ -1051,7 +1046,7 @@ sysprof_capture_writer_create_reader (SysprofCaptureWriter *self,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sysprof_capture_writer_stat (SysprofCaptureWriter *self,
|
sysprof_capture_writer_stat (SysprofCaptureWriter *self,
|
||||||
SysprofCaptureStat *stat)
|
SysprofCaptureStat *stat)
|
||||||
{
|
{
|
||||||
g_return_if_fail (self != NULL);
|
g_return_if_fail (self != NULL);
|
||||||
g_return_if_fail (stat != NULL);
|
g_return_if_fail (stat != NULL);
|
||||||
@ -1061,11 +1056,11 @@ sysprof_capture_writer_stat (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
|
sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
const SysprofCaptureCounter *counters,
|
const SysprofCaptureCounter *counters,
|
||||||
guint n_counters)
|
guint n_counters)
|
||||||
{
|
{
|
||||||
SysprofCaptureFrameCounterDefine *def;
|
SysprofCaptureFrameCounterDefine *def;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -1084,11 +1079,11 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&def->frame,
|
sysprof_capture_writer_frame_init (&def->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_CTRDEF);
|
SYSPROF_CAPTURE_FRAME_CTRDEF);
|
||||||
def->padding1 = 0;
|
def->padding1 = 0;
|
||||||
def->padding2 = 0;
|
def->padding2 = 0;
|
||||||
def->n_counters = n_counters;
|
def->n_counters = n_counters;
|
||||||
@ -1111,12 +1106,12 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
|
sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
|
||||||
gint64 time,
|
gint64 time,
|
||||||
gint cpu,
|
gint cpu,
|
||||||
gint32 pid,
|
gint32 pid,
|
||||||
const guint *counters_ids,
|
const guint *counters_ids,
|
||||||
const SysprofCaptureCounterValue *values,
|
const SysprofCaptureCounterValue *values,
|
||||||
guint n_counters)
|
guint n_counters)
|
||||||
{
|
{
|
||||||
SysprofCaptureFrameCounterSet *set;
|
SysprofCaptureFrameCounterSet *set;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -1146,11 +1141,11 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
|
|||||||
memset (set, 0, len);
|
memset (set, 0, len);
|
||||||
|
|
||||||
sysprof_capture_writer_frame_init (&set->frame,
|
sysprof_capture_writer_frame_init (&set->frame,
|
||||||
len,
|
len,
|
||||||
cpu,
|
cpu,
|
||||||
pid,
|
pid,
|
||||||
time,
|
time,
|
||||||
SYSPROF_CAPTURE_FRAME_CTRSET);
|
SYSPROF_CAPTURE_FRAME_CTRSET);
|
||||||
set->padding1 = 0;
|
set->padding1 = 0;
|
||||||
set->padding2 = 0;
|
set->padding2 = 0;
|
||||||
set->n_values = n_groups;
|
set->n_values = n_groups;
|
||||||
@ -1189,7 +1184,7 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
|
|||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
sysprof_capture_writer_request_counter (SysprofCaptureWriter *self,
|
sysprof_capture_writer_request_counter (SysprofCaptureWriter *self,
|
||||||
guint n_counters)
|
guint n_counters)
|
||||||
{
|
{
|
||||||
gint ret;
|
gint ret;
|
||||||
|
|
||||||
@ -1206,8 +1201,8 @@ sysprof_capture_writer_request_counter (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self,
|
_sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self,
|
||||||
gint64 start_time,
|
gint64 start_time,
|
||||||
gint64 end_time)
|
gint64 end_time)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
@ -1215,18 +1210,18 @@ _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self,
|
|||||||
|
|
||||||
do_start:
|
do_start:
|
||||||
ret = _sysprof_pwrite (self->fd,
|
ret = _sysprof_pwrite (self->fd,
|
||||||
&start_time,
|
&start_time,
|
||||||
sizeof (start_time),
|
sizeof (start_time),
|
||||||
G_STRUCT_OFFSET (SysprofCaptureFileHeader, time));
|
G_STRUCT_OFFSET (SysprofCaptureFileHeader, time));
|
||||||
|
|
||||||
if (ret < 0 && errno == EAGAIN)
|
if (ret < 0 && errno == EAGAIN)
|
||||||
goto do_start;
|
goto do_start;
|
||||||
|
|
||||||
do_end:
|
do_end:
|
||||||
ret = _sysprof_pwrite (self->fd,
|
ret = _sysprof_pwrite (self->fd,
|
||||||
&end_time,
|
&end_time,
|
||||||
sizeof (end_time),
|
sizeof (end_time),
|
||||||
G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time));
|
G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time));
|
||||||
|
|
||||||
if (ret < 0 && errno == EAGAIN)
|
if (ret < 0 && errno == EAGAIN)
|
||||||
goto do_end;
|
goto do_end;
|
||||||
|
|||||||
Reference in New Issue
Block a user