mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
replay: add stubs and plumbing to implement a re-record
The goal here is to be able to do a duplicate recording to the previous with a quick key-combination like Ctrl+R. We still need to extract the metadata from the capture file and setup a new profiler, but this gets the mechanics in place.
This commit is contained in:
@ -41,6 +41,7 @@ typedef struct
|
||||
guint has_samples : 1;
|
||||
guint has_counters : 1;
|
||||
guint has_marks : 1;
|
||||
guint can_replay : 1;
|
||||
} SysprofCaptureFeatures;
|
||||
|
||||
typedef struct
|
||||
@ -64,6 +65,7 @@ typedef struct
|
||||
|
||||
guint busy;
|
||||
|
||||
guint can_replay : 1;
|
||||
guint needs_fit : 1;
|
||||
} SysprofCaptureViewPrivate;
|
||||
|
||||
@ -318,7 +320,17 @@ sysprof_capture_view_scan_worker (GTask *task,
|
||||
|
||||
st_buf.frame_count[frame.type]++;
|
||||
|
||||
if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
|
||||
if (frame.type == SYSPROF_CAPTURE_FRAME_METADATA)
|
||||
{
|
||||
const SysprofCaptureMetadata *meta;
|
||||
|
||||
if ((meta = sysprof_capture_reader_read_metadata (reader)))
|
||||
{
|
||||
if (g_strcmp0 (meta->id, "local-profiler") == 0)
|
||||
features.can_replay = TRUE;
|
||||
}
|
||||
}
|
||||
else if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
|
||||
{
|
||||
const SysprofCaptureMark *mark;
|
||||
|
||||
@ -997,3 +1009,13 @@ sysprof_capture_view_get_reader (SysprofCaptureView *self)
|
||||
|
||||
return priv->reader;
|
||||
}
|
||||
|
||||
gboolean
|
||||
sysprof_capture_view_get_can_replay (SysprofCaptureView *self)
|
||||
{
|
||||
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
|
||||
|
||||
g_return_val_if_fail (SYSPROF_IS_CAPTURE_VIEW (self), FALSE);
|
||||
|
||||
return priv->features.can_replay;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user