mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: implement traceable for samples
This commit is contained in:
@ -21,7 +21,9 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-document-frame-private.h"
|
||||
|
||||
#include "sysprof-document-sample.h"
|
||||
#include "sysprof-document-traceable.h"
|
||||
|
||||
struct _SysprofDocumentSample
|
||||
{
|
||||
@ -40,7 +42,32 @@ enum {
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (SysprofDocumentSample, sysprof_document_sample, SYSPROF_TYPE_DOCUMENT_FRAME)
|
||||
static guint
|
||||
sysprof_document_sample_get_stack_depth (SysprofDocumentTraceable *traceable)
|
||||
{
|
||||
const SysprofCaptureSample *sample = SYSPROF_DOCUMENT_FRAME_GET (traceable, SysprofCaptureSample);
|
||||
|
||||
return SYSPROF_DOCUMENT_FRAME_UINT16 (traceable, sample->n_addrs);
|
||||
}
|
||||
|
||||
static guint64
|
||||
sysprof_document_sample_get_stack_address (SysprofDocumentTraceable *traceable,
|
||||
guint position)
|
||||
{
|
||||
const SysprofCaptureSample *sample = SYSPROF_DOCUMENT_FRAME_GET (traceable, SysprofCaptureSample);
|
||||
|
||||
return SYSPROF_DOCUMENT_FRAME_UINT64 (traceable, sample->addrs[position]);
|
||||
}
|
||||
|
||||
static void
|
||||
traceable_iface_init (SysprofDocumentTraceableInterface *iface)
|
||||
{
|
||||
iface->get_stack_depth = sysprof_document_sample_get_stack_depth;
|
||||
iface->get_stack_address = sysprof_document_sample_get_stack_address;
|
||||
}
|
||||
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (SysprofDocumentSample, sysprof_document_sample, SYSPROF_TYPE_DOCUMENT_FRAME,
|
||||
G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_DOCUMENT_TRACEABLE, traceable_iface_init))
|
||||
|
||||
static GParamSpec *properties [N_PROPS];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user