mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: pre-hash symbols for faster comparisons
This commit is contained in:
@ -29,6 +29,8 @@ struct _SysprofSymbol
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
guint hash;
|
||||
|
||||
GRefString *name;
|
||||
GRefString *binary_path;
|
||||
GRefString *binary_nick;
|
||||
@ -43,4 +45,17 @@ SysprofSymbol *_sysprof_symbol_new (GRefString *name,
|
||||
SysprofAddress begin_address,
|
||||
SysprofAddress end_address);
|
||||
|
||||
static inline gboolean
|
||||
_sysprof_symbol_equal (const SysprofSymbol *a,
|
||||
const SysprofSymbol *b)
|
||||
{
|
||||
if (a == b)
|
||||
return TRUE;
|
||||
|
||||
if (a->hash != b->hash)
|
||||
return FALSE;
|
||||
|
||||
return strcmp (a->name, b->name) == 0;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -144,6 +144,14 @@ _sysprof_symbol_new (GRefString *name,
|
||||
self->binary_nick = binary_nick;
|
||||
self->begin_address = begin_address;
|
||||
self->end_address = end_address;
|
||||
self->hash = g_str_hash (name);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
gboolean
|
||||
sysprof_symbol_equal (const SysprofSymbol *a,
|
||||
const SysprofSymbol *b)
|
||||
{
|
||||
return _sysprof_symbol_equal (a, b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user