[sysprof] mark: add group to mark event
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] mark: add group to mark event
- Date: Tue, 15 May 2018 15:34:46 +0000 (UTC)
commit e853c79be9a38ba8abed0f714fcaca5c584192cd
Author: Christian Hergert <chergert redhat com>
Date: Tue May 15 16:32:42 2018 +0100
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.
lib/capture/sp-capture-types.h | 5 +++--
lib/capture/sp-capture-writer.c | 5 ++++-
lib/capture/sp-capture-writer.h | 1 +
tests/test-capture.c | 6 ++++--
4 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/lib/capture/sp-capture-types.h b/lib/capture/sp-capture-types.h
index 8c16921..ed43866 100644
--- a/lib/capture/sp-capture-types.h
+++ b/lib/capture/sp-capture-types.h
@@ -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,
diff --git a/lib/capture/sp-capture-writer.c b/lib/capture/sp-capture-writer.c
index 893b712..a1fa220 100644
--- a/lib/capture/sp-capture-writer.c
+++ b/lib/capture/sp-capture-writer.c
@@ -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]++;
diff --git a/lib/capture/sp-capture-writer.h b/lib/capture/sp-capture-writer.h
index 0c208e7..1867058 100644
--- a/lib/capture/sp-capture-writer.h
+++ b/lib/capture/sp-capture-writer.h
@@ -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,
diff --git a/tests/test-capture.c b/tests/test-capture.c
index ecc88ad..4e348c1 100644
--- a/tests/test-capture.c
+++ b/tests/test-capture.c
@@ -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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]