mark: add group to mark event

This allows grouping marks together so that the UI can present marks within
the same group in the same visualizer row.

The goal here is that our perf stream with drm data will have "drm" or some
similar group name (resulting in one row). mutter/cogl/gnome-shell will
use the thread-id as the group name (or something else that is useful) so
their events are grouped together. gdk-wayland might have it's own group
name as well.

The end result is that we can get a mark row for each series of related
data.
This commit is contained in:
Christian Hergert
2018-05-15 16:32:42 +01:00
parent eb6fdffa6f
commit e853c79be9
4 changed files with 12 additions and 5 deletions

View File

@ -184,7 +184,8 @@ typedef struct
{
SpCaptureFrame frame;
gint64 duration;
gchar name[32];
gchar group[24];
gchar name[40];
gchar message[0];
} SpCaptureMark;
@ -203,7 +204,7 @@ G_STATIC_ASSERT (sizeof (SpCaptureCounter) == 128);
G_STATIC_ASSERT (sizeof (SpCaptureCounterValues) == 96);
G_STATIC_ASSERT (sizeof (SpCaptureFrameCounterDefine) == 32);
G_STATIC_ASSERT (sizeof (SpCaptureFrameCounterSet) == 32);
G_STATIC_ASSERT (sizeof (SpCaptureMark) == 64);
G_STATIC_ASSERT (sizeof (SpCaptureMark) == 96);
static inline gint
sp_capture_address_compare (SpCaptureAddress a,

View File

@ -542,6 +542,7 @@ sp_capture_writer_add_mark (SpCaptureWriter *self,
gint cpu,
GPid pid,
guint64 duration,
const gchar *group,
const gchar *name,
const gchar *message)
{
@ -551,6 +552,7 @@ sp_capture_writer_add_mark (SpCaptureWriter *self,
g_assert (self != NULL);
g_assert (name != NULL);
g_assert (group != NULL);
if (message == NULL)
message = "";
@ -569,7 +571,8 @@ sp_capture_writer_add_mark (SpCaptureWriter *self,
SP_CAPTURE_FRAME_MARK);
ev->duration = duration;
memcpy (ev->name, name, sizeof ev->name);
g_strlcpy (ev->group, group, sizeof ev->group);
g_strlcpy (ev->name, name, sizeof ev->name);
memcpy (ev->message, message, message_len);
self->stat.frame_count[SP_CAPTURE_FRAME_MARK]++;

View File

@ -60,6 +60,7 @@ gboolean sp_capture_writer_add_mark (SpCaptureWriter *
gint cpu,
GPid pid,
guint64 duration,
const gchar *group,
const gchar *name,
const gchar *message);
guint64 sp_capture_writer_add_jitmap (SpCaptureWriter *self,

View File

@ -543,8 +543,8 @@ test_reader_writer_mark (void)
writer = sp_capture_writer_new ("mark1.syscap", 0);
sp_capture_writer_add_mark (writer, SP_CAPTURE_CURRENT_TIME, -1, -1, 125, "Draw", "hdmi-1");
sp_capture_writer_add_mark (writer, SP_CAPTURE_CURRENT_TIME, -1, -1, 0, "Deadline", "hdmi-1");
sp_capture_writer_add_mark (writer, SP_CAPTURE_CURRENT_TIME, -1, -1, 125, "thread-0", "Draw", "hdmi-1");
sp_capture_writer_add_mark (writer, SP_CAPTURE_CURRENT_TIME, -1, -1, 0, "thread-1", "Deadline", "hdmi-1");
g_clear_pointer (&writer, sp_capture_writer_unref);
@ -554,6 +554,7 @@ test_reader_writer_mark (void)
mark = sp_capture_reader_read_mark (reader);
g_assert_nonnull (mark);
g_assert_cmpstr (mark->group, ==, "thread-0");
g_assert_cmpstr (mark->name, ==, "Draw");
g_assert_cmpint (mark->duration, ==, 125);
g_assert_cmpstr (mark->message, ==, "hdmi-1");
@ -562,6 +563,7 @@ test_reader_writer_mark (void)
mark = sp_capture_reader_read_mark (reader);
g_assert_nonnull (mark);
g_assert_cmpstr (mark->group, ==, "thread-1");
g_assert_cmpstr (mark->name, ==, "Deadline");
g_assert_cmpint (mark->duration, ==, 0);
g_assert_cmpstr (mark->message, ==, "hdmi-1");