mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
capture: add task-id (thread-id) to samples
This could let us do some amount of filtering by threads going forward if we have that data available to us.
This commit is contained in:
@ -141,7 +141,7 @@ typedef struct
|
||||
SpCaptureFrame frame;
|
||||
guint32 n_addrs : 16;
|
||||
guint32 padding1 : 16;
|
||||
guint32 padding2;
|
||||
gint32 tid;
|
||||
SpCaptureAddress addrs[0];
|
||||
} SpCaptureSample
|
||||
SP_ALIGNED_END(1);
|
||||
|
||||
@ -648,6 +648,7 @@ sp_capture_writer_add_sample (SpCaptureWriter *self,
|
||||
gint64 time,
|
||||
gint cpu,
|
||||
gint32 pid,
|
||||
gint32 tid,
|
||||
const SpCaptureAddress *addrs,
|
||||
guint n_addrs)
|
||||
{
|
||||
@ -669,6 +670,7 @@ sp_capture_writer_add_sample (SpCaptureWriter *self,
|
||||
time,
|
||||
SP_CAPTURE_FRAME_SAMPLE);
|
||||
ev->n_addrs = n_addrs;
|
||||
ev->tid = tid;
|
||||
|
||||
memcpy (ev->addrs, addrs, (n_addrs * sizeof (SpCaptureAddress)));
|
||||
|
||||
|
||||
@ -76,6 +76,7 @@ gboolean sp_capture_writer_add_sample (SpCaptureWriter *
|
||||
gint64 time,
|
||||
gint cpu,
|
||||
gint32 pid,
|
||||
gint32 tid,
|
||||
const SpCaptureAddress *addrs,
|
||||
guint n_addrs);
|
||||
gboolean sp_capture_writer_add_fork (SpCaptureWriter *self,
|
||||
|
||||
@ -284,6 +284,7 @@ sp_perf_source_handle_callchain (SpPerfSource *self,
|
||||
sample->time,
|
||||
cpu,
|
||||
sample->pid,
|
||||
sample->tid,
|
||||
ips,
|
||||
n_ips);
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ test_reader_basic (void)
|
||||
for (j = 0; j < i; j++)
|
||||
addrs[j] = i;
|
||||
|
||||
if (!sp_capture_writer_add_sample (writer, t, -1, -1, addrs, i))
|
||||
if (!sp_capture_writer_add_sample (writer, t, -1, -1, -2, addrs, i))
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
@ -349,6 +349,7 @@ test_reader_basic (void)
|
||||
g_assert_cmpint (sample->frame.time, ==, t);
|
||||
g_assert_cmpint (sample->frame.cpu, ==, -1);
|
||||
g_assert_cmpint (sample->frame.pid, ==, -1);
|
||||
g_assert_cmpint (sample->tid, ==, -2);
|
||||
g_assert_cmpint (sample->n_addrs, ==, i);
|
||||
|
||||
for (j = 0; j < i; j++)
|
||||
|
||||
@ -317,6 +317,7 @@ main (gint argc,
|
||||
frame->frame.time,
|
||||
frame->frame.cpu,
|
||||
frame->frame.pid,
|
||||
frame->tid,
|
||||
addrs,
|
||||
frame->n_addrs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user