[sysprof] libsysprof-ui: add fork to list of marks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-ui: add fork to list of marks
- Date: Wed, 29 May 2019 22:45:29 +0000 (UTC)
commit d43137475e51a04eeb63c246e8f6ba5a39e10125
Author: Christian Hergert <chergert redhat com>
Date: Thu May 23 23:58:50 2019 -0700
libsysprof-ui: add fork to list of marks
src/libsysprof-ui/sysprof-capture-view.c | 8 +++++++-
src/libsysprof-ui/sysprof-marks-model.c | 24 ++++++++++++++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index 2d36e79..a7462a3 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -40,6 +40,7 @@ typedef struct
gint64 end_time;
guint has_samples : 1;
guint has_counters : 1;
+ guint has_forks : 1;
guint has_marks : 1;
guint can_replay : 1;
} SysprofCaptureFeatures;
@@ -330,6 +331,11 @@ sysprof_capture_view_scan_worker (GTask *task,
features.can_replay = TRUE;
}
}
+ else if (frame.type == SYSPROF_CAPTURE_FRAME_FORK)
+ {
+ features.has_forks = TRUE;
+ sysprof_capture_reader_read_fork (reader);
+ }
else if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
{
const SysprofCaptureMark *mark;
@@ -465,7 +471,7 @@ sysprof_capture_view_scan_finish (SysprofCaptureView *self,
if (!priv->features.has_samples)
gtk_widget_hide (GTK_WIDGET (priv->callgraph_view));
- if (!priv->features.has_marks)
+ if (!priv->features.has_marks && !priv->features.has_forks)
gtk_widget_hide (GTK_WIDGET (priv->marks_view));
if (!priv->features.has_counters)
diff --git a/src/libsysprof-ui/sysprof-marks-model.c b/src/libsysprof-ui/sysprof-marks-model.c
index abedb5f..fa5772a 100644
--- a/src/libsysprof-ui/sysprof-marks-model.c
+++ b/src/libsysprof-ui/sysprof-marks-model.c
@@ -311,7 +311,8 @@ cursor_foreach_cb (const SysprofCaptureFrame *frame,
g_assert (SYSPROF_IS_MARKS_MODEL (self));
g_assert (frame->type == SYSPROF_CAPTURE_FRAME_MARK ||
frame->type == SYSPROF_CAPTURE_FRAME_CTRSET ||
- frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
+ frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF ||
+ frame->type == SYSPROF_CAPTURE_FRAME_FORK);
if (frame->type == SYSPROF_CAPTURE_FRAME_MARK)
{
@@ -329,6 +330,22 @@ cursor_foreach_cb (const SysprofCaptureFrame *frame,
if G_LIKELY (item.end_time > self->max_end_time)
self->max_end_time = item.end_time;
+ g_array_append_val (self->items, item);
+ }
+ else if (frame->type == SYSPROF_CAPTURE_FRAME_FORK)
+ {
+ SysprofCaptureFork *fk = (SysprofCaptureFork *)frame;
+ g_autofree gchar *message = g_strdup_printf ("PID: %d, Child PID: %d", frame->pid, fk->child_pid);
+
+ item.begin_time = frame->time;
+ item.end_time = item.begin_time;
+ item.group = g_string_chunk_insert_const (self->chunks, "fork");
+ item.name = g_string_chunk_insert_const (self->chunks, "Fork");
+ item.message = g_string_chunk_insert_const (self->chunks, message);
+ item.value.v64 = 0;
+ item.is_counter = FALSE;
+ item.counter_type = 0;
+
g_array_append_val (self->items, item);
}
else if (frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF)
@@ -475,7 +492,10 @@ sysprof_marks_model_new_async (SysprofCaptureReader *reader,
}
else if (kind == SYSPROF_MARKS_MODEL_MARKS)
{
- static const SysprofCaptureFrameType types[] = { SYSPROF_CAPTURE_FRAME_MARK };
+ static const SysprofCaptureFrameType types[] = {
+ SYSPROF_CAPTURE_FRAME_MARK,
+ SYSPROF_CAPTURE_FRAME_FORK,
+ };
c = sysprof_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]