From 45f08e07c9f89225277d98dffd3b87c73ececcd4 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 14 Aug 2023 15:05:25 -0700 Subject: [PATCH] libsysprof: externalize access to frames array This can be useful to optimize some walking paths in other layers. --- src/libsysprof/sysprof-document-private.h | 7 +++++++ src/libsysprof/sysprof-document.c | 14 ++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/libsysprof/sysprof-document-private.h b/src/libsysprof/sysprof-document-private.h index 22578c51..6d8e70f9 100644 --- a/src/libsysprof/sysprof-document-private.h +++ b/src/libsysprof/sysprof-document-private.h @@ -28,6 +28,12 @@ G_BEGIN_DECLS +typedef struct _SysprofDocumentFramePointer +{ + guint64 offset : 48; + guint64 length : 16; +} SysprofDocumentFramePointer; + typedef struct _SysprofDocumentTimedValue { gint64 time; @@ -74,5 +80,6 @@ SysprofSymbol *_sysprof_document_thread_symbol (SysprofDocument *self, int pid, int tid); SysprofSymbol *_sysprof_document_kernel_symbol (SysprofDocument *self); +GArray *_sysprof_document_get_frames (SysprofDocument *self); G_END_DECLS diff --git a/src/libsysprof/sysprof-document.c b/src/libsysprof/sysprof-document.c index 64e69ba4..6fa742a9 100644 --- a/src/libsysprof/sysprof-document.c +++ b/src/libsysprof/sysprof-document.c @@ -106,12 +106,6 @@ struct _SysprofDocument guint needs_swap : 1; }; -typedef struct _SysprofDocumentFramePointer -{ - guint64 offset : 48; - guint64 length : 16; -} SysprofDocumentFramePointer; - enum { PROP_0, PROP_ALLOCATIONS, @@ -2676,3 +2670,11 @@ sysprof_document_save_finish (SysprofDocument *self, return g_task_propagate_boolean (G_TASK (result), error); } + +GArray * +_sysprof_document_get_frames (SysprofDocument *self) +{ + g_return_val_if_fail (SYSPROF_IS_DOCUMENT (self), NULL); + + return g_array_ref (self->frames); +}