mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof: port GPtrArray sort to gtk_tim_sort()
This commit is contained in:
@ -20,7 +20,10 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "timsort/gtktimsortprivate.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include <eggbitset.h>
|
#include <eggbitset.h>
|
||||||
|
|
||||||
#include "sysprof-address-layout-private.h"
|
#include "sysprof-address-layout-private.h"
|
||||||
@ -204,7 +207,11 @@ sysprof_address_layout_lookup (SysprofAddressLayout *self,
|
|||||||
|
|
||||||
self->mmaps_dirty = FALSE;
|
self->mmaps_dirty = FALSE;
|
||||||
|
|
||||||
g_ptr_array_sort (self->mmaps, compare_mmaps);
|
gtk_tim_sort (self->mmaps->pdata,
|
||||||
|
self->mmaps->len,
|
||||||
|
sizeof (gpointer),
|
||||||
|
(GCompareDataFunc)compare_mmaps,
|
||||||
|
NULL);
|
||||||
dups = find_duplicates (self->mmaps);
|
dups = find_duplicates (self->mmaps);
|
||||||
|
|
||||||
if (egg_bitset_iter_init_last (&iter, dups, &i))
|
if (egg_bitset_iter_init_last (&iter, dups, &i))
|
||||||
|
|||||||
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "timsort/gtktimsortprivate.h"
|
||||||
|
|
||||||
#include "sysprof-callgraph-private.h"
|
#include "sysprof-callgraph-private.h"
|
||||||
#include "sysprof-callgraph-frame-private.h"
|
#include "sysprof-callgraph-frame-private.h"
|
||||||
#include "sysprof-callgraph-symbol-private.h"
|
#include "sysprof-callgraph-symbol-private.h"
|
||||||
@ -990,7 +992,11 @@ sysprof_callgraph_list_traceables_for_node_async (SysprofCallgraph *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sort the bitsets by size to shrink potential interscetions */
|
/* Sort the bitsets by size to shrink potential interscetions */
|
||||||
g_ptr_array_sort (bitsets, sort_by_size_asc);
|
gtk_tim_sort (bitsets->pdata,
|
||||||
|
bitsets->len,
|
||||||
|
sizeof (gpointer),
|
||||||
|
(GCompareDataFunc)sort_by_size_asc,
|
||||||
|
NULL);
|
||||||
bitset = egg_bitset_copy (g_ptr_array_index (bitsets, 0));
|
bitset = egg_bitset_copy (g_ptr_array_index (bitsets, 0));
|
||||||
for (guint i = 1; i < bitsets->len; i++)
|
for (guint i = 1; i < bitsets->len; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#include "timsort/gtktimsortprivate.h"
|
||||||
|
|
||||||
#include "sysprof-mount-namespace-private.h"
|
#include "sysprof-mount-namespace-private.h"
|
||||||
|
|
||||||
struct _SysprofMountNamespace
|
struct _SysprofMountNamespace
|
||||||
@ -249,7 +251,11 @@ sysprof_mount_namespace_translate (SysprofMountNamespace *self,
|
|||||||
|
|
||||||
if G_UNLIKELY (self->mounts_dirty)
|
if G_UNLIKELY (self->mounts_dirty)
|
||||||
{
|
{
|
||||||
g_ptr_array_sort (self->mounts, compare_mount);
|
gtk_tim_sort (self->mounts->pdata,
|
||||||
|
self->mounts->len,
|
||||||
|
sizeof (gpointer),
|
||||||
|
(GCompareDataFunc)compare_mount,
|
||||||
|
NULL);
|
||||||
self->mounts_dirty = FALSE;
|
self->mounts_dirty = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user