mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: allow specifying type in index model
This commit is contained in:
@ -29,7 +29,10 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SysprofDocumentBitsetIndex, sysprof_document_bitset_index, SYSPROF, DOCUMENT_BITSET_INDEX, GObject)
|
||||
|
||||
GListModel *_sysprof_document_bitset_index_new (GListModel *model,
|
||||
EggBitset *bitset);
|
||||
GListModel *_sysprof_document_bitset_index_new (GListModel *model,
|
||||
EggBitset *bitset);
|
||||
GListModel *_sysprof_document_bitset_index_new_full (GListModel *model,
|
||||
EggBitset *bitset,
|
||||
GType type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -27,6 +27,7 @@ struct _SysprofDocumentBitsetIndex
|
||||
GObject parent_instance;
|
||||
GListModel *model;
|
||||
EggBitset *bitset;
|
||||
GType type;
|
||||
};
|
||||
|
||||
static GType
|
||||
@ -34,6 +35,9 @@ sysprof_document_bitset_index_get_item_type (GListModel *model)
|
||||
{
|
||||
SysprofDocumentBitsetIndex *self = SYSPROF_DOCUMENT_BITSET_INDEX (model);
|
||||
|
||||
if (self->type)
|
||||
return self->type;
|
||||
|
||||
if (self->model != NULL)
|
||||
return g_list_model_get_item_type (self->model);
|
||||
|
||||
@ -138,8 +142,9 @@ sysprof_document_bitset_index_init (SysprofDocumentBitsetIndex *self)
|
||||
}
|
||||
|
||||
GListModel *
|
||||
_sysprof_document_bitset_index_new (GListModel *model,
|
||||
EggBitset *bitset)
|
||||
_sysprof_document_bitset_index_new_full (GListModel *model,
|
||||
EggBitset *bitset,
|
||||
GType type)
|
||||
{
|
||||
SysprofDocumentBitsetIndex *self;
|
||||
|
||||
@ -149,6 +154,14 @@ _sysprof_document_bitset_index_new (GListModel *model,
|
||||
self = g_object_new (SYSPROF_TYPE_DOCUMENT_BITSET_INDEX, NULL);
|
||||
self->model = g_object_ref (model);
|
||||
self->bitset = egg_bitset_ref (bitset);
|
||||
self->type = type;
|
||||
|
||||
return G_LIST_MODEL (self);
|
||||
}
|
||||
|
||||
GListModel *
|
||||
_sysprof_document_bitset_index_new (GListModel *model,
|
||||
EggBitset *bitset)
|
||||
{
|
||||
return _sysprof_document_bitset_index_new_full (model, bitset, G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "sysprof-bundled-symbolizer-private.h"
|
||||
#include "sysprof-callgraph-private.h"
|
||||
#include "sysprof-cpu-info-private.h"
|
||||
#include "sysprof-document-allocation.h"
|
||||
#include "sysprof-document-bitset-index-private.h"
|
||||
#include "sysprof-document-counter-private.h"
|
||||
#include "sysprof-document-ctrdef.h"
|
||||
@ -43,6 +44,7 @@
|
||||
#include "sysprof-document-mmap.h"
|
||||
#include "sysprof-document-overlay.h"
|
||||
#include "sysprof-document-process-private.h"
|
||||
#include "sysprof-document-sample.h"
|
||||
#include "sysprof-document-symbols-private.h"
|
||||
#include "sysprof-mark-catalog-private.h"
|
||||
#include "sysprof-mount-private.h"
|
||||
@ -1789,7 +1791,7 @@ sysprof_document_list_allocations (SysprofDocument *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_DOCUMENT (self), NULL);
|
||||
|
||||
return _sysprof_document_bitset_index_new (G_LIST_MODEL (self), self->allocations);
|
||||
return _sysprof_document_bitset_index_new_full (G_LIST_MODEL (self), self->allocations, SYSPROF_TYPE_DOCUMENT_ALLOCATION);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1806,7 +1808,7 @@ sysprof_document_list_samples (SysprofDocument *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_DOCUMENT (self), NULL);
|
||||
|
||||
return _sysprof_document_bitset_index_new (G_LIST_MODEL (self), self->samples);
|
||||
return _sysprof_document_bitset_index_new_full (G_LIST_MODEL (self), self->samples, SYSPROF_TYPE_DOCUMENT_SAMPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1823,7 +1825,7 @@ sysprof_document_list_samples_with_context_switch (SysprofDocument *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_DOCUMENT (self), NULL);
|
||||
|
||||
return _sysprof_document_bitset_index_new (G_LIST_MODEL (self), self->samples_with_context_switch);
|
||||
return _sysprof_document_bitset_index_new_full (G_LIST_MODEL (self), self->samples_with_context_switch, SYSPROF_TYPE_DOCUMENT_SAMPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1845,7 +1847,7 @@ sysprof_document_list_samples_without_context_switch (SysprofDocument *self)
|
||||
bitset = egg_bitset_copy (self->samples);
|
||||
egg_bitset_subtract (bitset, self->samples_with_context_switch);
|
||||
|
||||
return _sysprof_document_bitset_index_new (G_LIST_MODEL (self), bitset);
|
||||
return _sysprof_document_bitset_index_new_full (G_LIST_MODEL (self), bitset, SYSPROF_TYPE_DOCUMENT_SAMPLE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user