libsysprof-ui: add fork to list of marks

This commit is contained in:
Christian Hergert
2019-05-23 23:58:50 -07:00
parent 697ef7f350
commit d43137475e
2 changed files with 29 additions and 3 deletions

View File

@ -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)

View File

@ -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);
}