mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
capture: add simple mark support
The goal here is to have an API that allows us to record things like frame timing data. We might iterate on this API a bit, but this gets us started. A SpCaptureMark with a zero duration should be treated like an epoch mark once a visualizer is created. SpCaptureMark with a non-zero duration should be treated like a begin/end of operation. This may be useful in generating something like a flame graph.
This commit is contained in:
@ -536,6 +536,45 @@ sp_capture_writer_add_map (SpCaptureWriter *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
sp_capture_writer_add_mark (SpCaptureWriter *self,
|
||||
gint64 time,
|
||||
gint cpu,
|
||||
GPid pid,
|
||||
guint64 duration,
|
||||
const gchar *name,
|
||||
const gchar *message)
|
||||
{
|
||||
SpCaptureMark *ev;
|
||||
gsize message_len;
|
||||
gsize len;
|
||||
|
||||
g_assert (self != NULL);
|
||||
g_assert (name != NULL);
|
||||
|
||||
if (message == NULL)
|
||||
message = "";
|
||||
message_len = strlen (message) + 1;
|
||||
|
||||
len = sizeof *ev + message_len;
|
||||
ev = (SpCaptureMark *)sp_capture_writer_allocate (self, &len);
|
||||
if (!ev)
|
||||
return FALSE;
|
||||
|
||||
sp_capture_writer_frame_init (&ev->frame,
|
||||
len,
|
||||
cpu,
|
||||
pid,
|
||||
time,
|
||||
SP_CAPTURE_FRAME_MARK);
|
||||
|
||||
ev->duration = duration;
|
||||
memcpy (ev->name, name, sizeof ev->name);
|
||||
memcpy (ev->message, message, message_len);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SpCaptureAddress
|
||||
sp_capture_writer_add_jitmap (SpCaptureWriter *self,
|
||||
const gchar *name)
|
||||
|
||||
Reference in New Issue
Block a user