Revert "libsysprof: parallelize capture symbolizing"

This reverts commit a7a0c782d1.
This commit is contained in:
Christian Hergert
2023-08-16 15:43:49 -07:00
parent 3b97252a8e
commit 48dc402c3b
7 changed files with 135 additions and 227 deletions

View File

@ -28,7 +28,6 @@
struct _SysprofAddressLayout
{
GObject parent_instance;
GRWLock rwlock;
GPtrArray *mmaps;
guint mmaps_dirty : 1;
};
@ -74,7 +73,6 @@ sysprof_address_layout_finalize (GObject *object)
SysprofAddressLayout *self = (SysprofAddressLayout *)object;
g_clear_pointer (&self->mmaps, g_ptr_array_unref);
g_rw_lock_clear (&self->rwlock);
G_OBJECT_CLASS (sysprof_address_layout_parent_class)->finalize (object);
}
@ -90,7 +88,6 @@ sysprof_address_layout_class_init (SysprofAddressLayoutClass *klass)
static void
sysprof_address_layout_init (SysprofAddressLayout *self)
{
g_rw_lock_init (&self->rwlock);
self->mmaps = g_ptr_array_new_with_free_func (g_object_unref);
}
@ -107,13 +104,9 @@ sysprof_address_layout_take (SysprofAddressLayout *self,
g_return_if_fail (SYSPROF_IS_ADDRESS_LAYOUT (self));
g_return_if_fail (SYSPROF_IS_DOCUMENT_MMAP (map));
g_rw_lock_writer_lock (&self->rwlock);
g_ptr_array_add (self->mmaps, map);
self->mmaps_dirty = TRUE;
g_rw_lock_writer_unlock (&self->rwlock);
}
static int
@ -202,42 +195,26 @@ sysprof_address_layout_lookup (SysprofAddressLayout *self,
g_return_val_if_fail (SYSPROF_IS_ADDRESS_LAYOUT (self), NULL);
g_rw_lock_reader_lock (&self->rwlock);
while (self->mmaps_dirty)
if (self->mmaps_dirty)
{
g_autoptr(EggBitset) dups = NULL;
EggBitsetIter iter;
guint old_len = self->mmaps->len;
guint i;
g_rw_lock_reader_unlock (&self->rwlock);
g_rw_lock_writer_lock (&self->rwlock);
self->mmaps_dirty = FALSE;
if (self->mmaps_dirty)
g_ptr_array_sort (self->mmaps, compare_mmaps);
dups = find_duplicates (self->mmaps);
if (egg_bitset_iter_init_last (&iter, dups, &i))
{
self->mmaps_dirty = FALSE;
g_ptr_array_sort (self->mmaps, compare_mmaps);
dups = find_duplicates (self->mmaps);
if (egg_bitset_iter_init_last (&iter, dups, &i))
{
do
g_ptr_array_remove_index (self->mmaps, i);
while (egg_bitset_iter_previous (&iter, &i));
}
/* We can't be monitored when we're in this path as the
* application cannot have gotten access yet. Ignore
* any sort of items changes.
*
* g_list_model_items_changed (G_LIST_MODEL (self),
* 0, old_len, self->mmaps->len);
*/
do
g_ptr_array_remove_index (self->mmaps, i);
while (egg_bitset_iter_previous (&iter, &i));
}
g_rw_lock_writer_unlock (&self->rwlock);
g_rw_lock_reader_lock (&self->rwlock);
g_list_model_items_changed (G_LIST_MODEL (self), 0, old_len, self->mmaps->len);
}
ret = bsearch (&address,
@ -246,7 +223,5 @@ sysprof_address_layout_lookup (SysprofAddressLayout *self,
sizeof (gpointer),
find_by_address);
g_rw_lock_reader_unlock (&self->rwlock);
return ret ? *ret : NULL;
}