mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: add batch getter for stack addresses
This allows caching the interface vfunc to reduce the overhead of accessing each instruction pointer in the array.
This commit is contained in:
@ -57,3 +57,24 @@ sysprof_document_traceable_get_stack_address (SysprofDocumentTraceable *self,
|
||||
{
|
||||
return SYSPROF_DOCUMENT_TRACEABLE_GET_IFACE (self)->get_stack_address (self, position);
|
||||
}
|
||||
|
||||
guint
|
||||
sysprof_document_traceable_get_stack_addresses (SysprofDocumentTraceable *self,
|
||||
guint64 *addresses,
|
||||
guint n_addresses)
|
||||
{
|
||||
guint64 (*decoder) (SysprofDocumentTraceable *, guint);
|
||||
|
||||
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_TRACEABLE (self), 0);
|
||||
|
||||
if (addresses == NULL || n_addresses == 0)
|
||||
return 0;
|
||||
|
||||
decoder = SYSPROF_DOCUMENT_TRACEABLE_GET_IFACE (self)->get_stack_address;
|
||||
n_addresses = MIN (n_addresses, sysprof_document_traceable_get_stack_depth (self));
|
||||
|
||||
for (guint i = 0; i < n_addresses; i++)
|
||||
addresses[i] = decoder (self, i);
|
||||
|
||||
return n_addresses;
|
||||
}
|
||||
|
||||
@ -40,9 +40,13 @@ struct _SysprofDocumentTraceableInterface
|
||||
};
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
guint sysprof_document_traceable_get_stack_depth (SysprofDocumentTraceable *self);
|
||||
guint sysprof_document_traceable_get_stack_depth (SysprofDocumentTraceable *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
guint64 sysprof_document_traceable_get_stack_address (SysprofDocumentTraceable *self,
|
||||
guint position);
|
||||
guint64 sysprof_document_traceable_get_stack_address (SysprofDocumentTraceable *self,
|
||||
guint position);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
guint sysprof_document_traceable_get_stack_addresses (SysprofDocumentTraceable *self,
|
||||
guint64 *addresses,
|
||||
guint n_addresses);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user