From e763cc14bb070069e6157ef9aba814710a39798e Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 5 May 2023 13:37:03 -0700 Subject: [PATCH] libsysprof-analyze: index locations of file chunks Create a roaring bitmap of list model positions that contain file chunks. We can use this in the future to avoid iterating the whole listmodel for matching file chunks to just the index positions containing file chunks. --- src/libsysprof-analyze/sysprof-document.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libsysprof-analyze/sysprof-document.c b/src/libsysprof-analyze/sysprof-document.c index 94eee0af..768e8486 100644 --- a/src/libsysprof-analyze/sysprof-document.c +++ b/src/libsysprof-analyze/sysprof-document.c @@ -37,6 +37,7 @@ struct _SysprofDocument GMappedFile *mapped_file; const guint8 *base; + GtkBitset *file_chunks; GtkBitset *traceables; GMutex strings_mutex; @@ -102,6 +103,7 @@ sysprof_document_finalize (GObject *object) g_clear_pointer (&self->frames, g_array_unref); g_clear_pointer (&self->strings, g_hash_table_unref); g_clear_pointer (&self->traceables, gtk_bitset_unref); + g_clear_pointer (&self->file_chunks, gtk_bitset_unref); g_mutex_clear (&self->strings_mutex); @@ -124,6 +126,7 @@ sysprof_document_init (SysprofDocument *self) self->strings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_ref_string_release); self->traceables = gtk_bitset_new_empty (); + self->file_chunks = gtk_bitset_new_empty (); } static gboolean @@ -181,6 +184,8 @@ sysprof_document_load (SysprofDocument *self, if (tainted->type == SYSPROF_CAPTURE_FRAME_SAMPLE || tainted->type == SYSPROF_CAPTURE_FRAME_ALLOCATION) gtk_bitset_add (self->traceables, self->frames->len); + else if (tainted->type == SYSPROF_CAPTURE_FRAME_FILE_CHUNK) + gtk_bitset_add (self->file_chunks, self->frames->len); pos += frame_len;