mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: move stack-depth to SysprofDocumentTraceable
This makes the property for depth a requirement, which will allow for easier quierying from various listmodel filters.
This commit is contained in:
@ -40,6 +40,7 @@ enum {
|
||||
PROP_ADDRESS,
|
||||
PROP_IS_FREE,
|
||||
PROP_SIZE,
|
||||
PROP_STACK_DEPTH,
|
||||
PROP_TID,
|
||||
N_PROPS
|
||||
};
|
||||
@ -95,6 +96,10 @@ sysprof_document_allocation_get_property (GObject *object,
|
||||
g_value_set_int64 (value, sysprof_document_allocation_get_size (self));
|
||||
break;
|
||||
|
||||
case PROP_STACK_DEPTH:
|
||||
g_value_set_uint (value, sysprof_document_traceable_get_stack_depth (SYSPROF_DOCUMENT_TRACEABLE (self)));
|
||||
break;
|
||||
|
||||
case PROP_TID:
|
||||
g_value_set_int (value, sysprof_document_allocation_get_tid (self));
|
||||
break;
|
||||
@ -141,17 +146,39 @@ sysprof_document_allocation_class_init (SysprofDocumentAllocationClass *klass)
|
||||
* SysprofDocumentAllocation:size:
|
||||
*
|
||||
* The size of the memory that was allocated or freed.
|
||||
*
|
||||
* Since: 45
|
||||
*/
|
||||
properties [PROP_SIZE] =
|
||||
g_param_spec_int64 ("size", NULL, NULL,
|
||||
G_MININT64, G_MAXINT64, 0,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* SysprofDocumentAllocation:is-free:
|
||||
*
|
||||
* If this allocation record is a call to release
|
||||
* #SysprofDocumentAllocation:address.
|
||||
*
|
||||
* Since: 45
|
||||
*/
|
||||
properties [PROP_IS_FREE] =
|
||||
g_param_spec_boolean ("is-free", NULL, NULL,
|
||||
FALSE,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* SysprofDocumentAllocation:stack-depth:
|
||||
*
|
||||
* The depth of the stack trace.
|
||||
*
|
||||
* Since: 45
|
||||
*/
|
||||
properties [PROP_STACK_DEPTH] =
|
||||
g_param_spec_uint ("stack-depth", NULL, NULL,
|
||||
0, G_MAXUINT16, 0,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ struct _SysprofDocumentSampleClass
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DEPTH,
|
||||
PROP_STACK_DEPTH,
|
||||
PROP_TID,
|
||||
N_PROPS
|
||||
};
|
||||
@ -81,8 +81,8 @@ sysprof_document_sample_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEPTH:
|
||||
g_value_set_uint (value, sysprof_document_sample_get_depth (self));
|
||||
case PROP_STACK_DEPTH:
|
||||
g_value_set_uint (value, sysprof_document_traceable_get_stack_depth (SYSPROF_DOCUMENT_TRACEABLE (self)));
|
||||
break;
|
||||
|
||||
case PROP_TID:
|
||||
@ -116,14 +116,14 @@ sysprof_document_sample_class_init (SysprofDocumentSampleClass *klass)
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* SysprofDocumentSample:depth:
|
||||
* SysprofDocumentSample:stack-depth:
|
||||
*
|
||||
* The depth of the stack trace.
|
||||
*
|
||||
* Since: 45
|
||||
*/
|
||||
properties [PROP_DEPTH] =
|
||||
g_param_spec_uint ("depth", NULL, NULL,
|
||||
properties [PROP_STACK_DEPTH] =
|
||||
g_param_spec_uint ("stack-depth", NULL, NULL,
|
||||
0, G_MAXUINT32, 0,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
@ -135,18 +135,6 @@ sysprof_document_sample_init (SysprofDocumentSample *self)
|
||||
{
|
||||
}
|
||||
|
||||
guint
|
||||
sysprof_document_sample_get_depth (SysprofDocumentSample *self)
|
||||
{
|
||||
const SysprofCaptureSample *sample;
|
||||
|
||||
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_SAMPLE (self), 0);
|
||||
|
||||
sample = SYSPROF_DOCUMENT_FRAME_GET (self, SysprofCaptureSample);
|
||||
|
||||
return SYSPROF_DOCUMENT_FRAME_UINT32 (self, sample->n_addrs);
|
||||
}
|
||||
|
||||
int
|
||||
sysprof_document_sample_get_tid (SysprofDocumentSample *self)
|
||||
{
|
||||
|
||||
@ -33,11 +33,9 @@ typedef struct _SysprofDocumentSample SysprofDocumentSample;
|
||||
typedef struct _SysprofDocumentSampleClass SysprofDocumentSampleClass;
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GType sysprof_document_sample_get_type (void) G_GNUC_CONST;
|
||||
GType sysprof_document_sample_get_type (void) G_GNUC_CONST;
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
guint sysprof_document_sample_get_depth (SysprofDocumentSample *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
int sysprof_document_sample_get_tid (SysprofDocumentSample *self);
|
||||
int sysprof_document_sample_get_tid (SysprofDocumentSample *self);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofDocumentSample, g_object_unref)
|
||||
|
||||
|
||||
@ -28,6 +28,21 @@ G_DEFINE_INTERFACE (SysprofDocumentTraceable, sysprof_document_traceable, SYSPRO
|
||||
static void
|
||||
sysprof_document_traceable_default_init (SysprofDocumentTraceableInterface *iface)
|
||||
{
|
||||
/**
|
||||
* SysprofDocumentTraceable:stack-depth:
|
||||
*
|
||||
* The "stack-depth" property contains the number of addresses collected
|
||||
* in the backtrace.
|
||||
*
|
||||
* You may use this value to retrieve the addresses from 0 to ("stack-depth"-1)
|
||||
* by calling sysprof_document_traceable_get_stack_address().
|
||||
*
|
||||
* Since: 45
|
||||
*/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_uint ("stack-depth", NULL, NULL,
|
||||
0, G_MAXUINT16, 0,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
Reference in New Issue
Block a user