libsysprof-analyze: add helper to get clock start time

This commit is contained in:
Christian Hergert
2023-06-12 15:11:42 -07:00
parent fc9bb894a1
commit 0529cfb2f0
2 changed files with 18 additions and 0 deletions

View File

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

View File

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