diff --git a/src/libsysprof-analyze/sysprof-document.c b/src/libsysprof-analyze/sysprof-document.c index c353cb9b..47ca0fb2 100644 --- a/src/libsysprof-analyze/sysprof-document.c +++ b/src/libsysprof-analyze/sysprof-document.c @@ -1286,3 +1286,19 @@ _sysprof_document_kernel_symbol (SysprofDocument *self) return self->symbols->context_switches[SYSPROF_ADDRESS_CONTEXT_KERNEL]; } + +/** + * sysprof_document_get_clock_at_start: + * @self: a #SysprofDocument + * + * Gets the clock time when the recording started. + * + * Returns: the clock time, generally of `CLOCK_MONOTONIC` + */ +gint64 +sysprof_document_get_clock_at_start (SysprofDocument *self) +{ + g_return_val_if_fail (SYSPROF_IS_DOCUMENT (self), 0); + + return self->header.time; +} diff --git a/src/libsysprof-analyze/sysprof-document.h b/src/libsysprof-analyze/sysprof-document.h index cd0ac1a4..fe87ae4d 100644 --- a/src/libsysprof-analyze/sysprof-document.h +++ b/src/libsysprof-analyze/sysprof-document.h @@ -36,6 +36,8 @@ G_BEGIN_DECLS SYSPROF_AVAILABLE_IN_ALL G_DECLARE_FINAL_TYPE (SysprofDocument, sysprof_document, SYSPROF, DOCUMENT, GObject) +SYSPROF_AVAILABLE_IN_ALL +gint64 sysprof_document_get_clock_at_start (SysprofDocument *self); SYSPROF_AVAILABLE_IN_ALL SysprofDocumentFile *sysprof_document_lookup_file (SysprofDocument *self, const char *path);