diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c index 5e206afd..c83dbc00 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.c +++ b/src/libsysprof-capture/sysprof-capture-writer.c @@ -1609,3 +1609,30 @@ sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, return TRUE; } + +gboolean +_sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, + const SysprofCaptureFrame *fr) +{ + gpointer begin; + gsize len; + + g_assert (self != NULL); + g_assert ((fr->len & 0x7) == 0); + g_assert (fr->type < SYSPROF_CAPTURE_FRAME_LAST); + + len = fr->len; + + if (!(begin = sysprof_capture_writer_allocate (self, &len))) + return FALSE; + + g_assert (fr->len == len); + g_assert (fr->type < 16); + + memcpy (begin, fr, fr->len); + + if (fr->type < G_N_ELEMENTS (self->stat.frame_count)) + self->stat.frame_count[fr->type]++; + + return TRUE; +} diff --git a/src/libsysprof-capture/sysprof-capture-writer.h b/src/libsysprof-capture/sysprof-capture-writer.h index 657e726d..07120bab 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.h +++ b/src/libsysprof-capture/sysprof-capture-writer.h @@ -237,6 +237,9 @@ gboolean sysprof_capture_writer_cat (Sy SysprofCaptureReader *reader, GError **error); G_GNUC_INTERNAL +gboolean _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, + const SysprofCaptureFrame *frame); +G_GNUC_INTERNAL gboolean _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, int fd, GError **error) G_GNUC_INTERNAL;