mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-analyze: rename to SysprofDocumentFrame
We will eventually be adding sub-types for the various frame types, and use this as a common ancestor for item inflation.
This commit is contained in:
@ -1,12 +1,12 @@
|
|||||||
libsysprof_analyze_public_sources = [
|
libsysprof_analyze_public_sources = [
|
||||||
'sysprof-document.c',
|
'sysprof-document.c',
|
||||||
'sysprof-capture-frame-object.c',
|
'sysprof-document-frame.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
libsysprof_analyze_public_headers = [
|
libsysprof_analyze_public_headers = [
|
||||||
'sysprof-analyze.h',
|
'sysprof-analyze.h',
|
||||||
'sysprof-document.h',
|
'sysprof-document.h',
|
||||||
'sysprof-capture-frame-object.h',
|
'sysprof-document-frame.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
libsysprof_analyze_deps = [
|
libsysprof_analyze_deps = [
|
||||||
|
|||||||
@ -25,8 +25,8 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define SYSPROF_ANALYZE_INSIDE
|
#define SYSPROF_ANALYZE_INSIDE
|
||||||
# include "sysprof-capture-frame-object.h"
|
|
||||||
# include "sysprof-document.h"
|
# include "sysprof-document.h"
|
||||||
|
# include "sysprof-document-frame.h"
|
||||||
#undef SYSPROF_ANALYZE_INSIDE
|
#undef SYSPROF_ANALYZE_INSIDE
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* sysprof-capture-frame-object-private.h
|
/* sysprof-document-frame-private.h
|
||||||
*
|
*
|
||||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||||
*
|
*
|
||||||
@ -18,12 +18,16 @@
|
|||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sysprof-capture-frame-object.h"
|
#pragma once
|
||||||
|
|
||||||
|
#include <sysprof-capture.h>
|
||||||
|
|
||||||
|
#include "sysprof-document-frame.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
SysprofCaptureFrameObject *sysprof_capture_frame_object_new (GMappedFile *mapped,
|
SysprofDocumentFrame *sysprof_document_frame_new (GMappedFile *mapped,
|
||||||
gconstpointer data,
|
gconstpointer data,
|
||||||
gboolean is_native);
|
gboolean is_native);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
@ -1,4 +1,4 @@
|
|||||||
/* sysprof-capture-frame-object.c
|
/* sysprof-document-frame.c
|
||||||
*
|
*
|
||||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||||
*
|
*
|
||||||
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "sysprof-capture-frame-object-private.h"
|
#include "sysprof-document-frame-private.h"
|
||||||
|
|
||||||
struct _SysprofCaptureFrameObject
|
struct _SysprofDocumentFrame
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
GMappedFile *mapped_file;
|
GMappedFile *mapped_file;
|
||||||
@ -30,40 +30,40 @@ struct _SysprofCaptureFrameObject
|
|||||||
guint is_native : 1;
|
guint is_native : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_FINAL_TYPE (SysprofCaptureFrameObject, sysprof_capture_frame_object, G_TYPE_OBJECT)
|
G_DEFINE_FINAL_TYPE (SysprofDocumentFrame, sysprof_document_frame, G_TYPE_OBJECT)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_capture_frame_object_finalize (GObject *object)
|
sysprof_document_frame_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
SysprofCaptureFrameObject *self = (SysprofCaptureFrameObject *)object;
|
SysprofDocumentFrame *self = (SysprofDocumentFrame *)object;
|
||||||
|
|
||||||
g_clear_pointer (&self->mapped_file, g_mapped_file_unref);
|
g_clear_pointer (&self->mapped_file, g_mapped_file_unref);
|
||||||
self->frame = NULL;
|
self->frame = NULL;
|
||||||
|
|
||||||
G_OBJECT_CLASS (sysprof_capture_frame_object_parent_class)->finalize (object);
|
G_OBJECT_CLASS (sysprof_document_frame_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_capture_frame_object_class_init (SysprofCaptureFrameObjectClass *klass)
|
sysprof_document_frame_class_init (SysprofDocumentFrameClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = sysprof_capture_frame_object_finalize;
|
object_class->finalize = sysprof_document_frame_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_capture_frame_object_init (SysprofCaptureFrameObject *self)
|
sysprof_document_frame_init (SysprofDocumentFrame *self)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SysprofCaptureFrameObject *
|
SysprofDocumentFrame *
|
||||||
sysprof_capture_frame_object_new (GMappedFile *mapped_file,
|
sysprof_document_frame_new (GMappedFile *mapped_file,
|
||||||
gconstpointer data,
|
gconstpointer data,
|
||||||
gboolean is_native)
|
gboolean is_native)
|
||||||
{
|
{
|
||||||
SysprofCaptureFrameObject *self;
|
SysprofDocumentFrame *self;
|
||||||
|
|
||||||
self = g_object_new (SYSPROF_TYPE_CAPTURE_FRAME_OBJECT, NULL);
|
self = g_object_new (SYSPROF_TYPE_DOCUMENT_FRAME, NULL);
|
||||||
self->mapped_file = g_mapped_file_ref (mapped_file);
|
self->mapped_file = g_mapped_file_ref (mapped_file);
|
||||||
self->frame = data;
|
self->frame = data;
|
||||||
self->is_native = !!is_native;
|
self->is_native = !!is_native;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
/* sysprof-capture-frame-object.h
|
/* sysprof-document-frame.h
|
||||||
*
|
*
|
||||||
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
* Copyright 2023 Christian Hergert <chergert@redhat.com>
|
||||||
*
|
*
|
||||||
@ -20,18 +20,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include <sysprof-capture.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define SYSPROF_TYPE_CAPTURE_FRAME_OBJECT (sysprof_capture_frame_object_get_type())
|
#define SYSPROF_TYPE_DOCUMENT_FRAME (sysprof_document_frame_get_type())
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
G_DECLARE_FINAL_TYPE (SysprofCaptureFrameObject, sysprof_capture_frame_object, SYSPROF, CAPTURE_FRAME_OBJECT, GObject)
|
G_DECLARE_FINAL_TYPE (SysprofDocumentFrame, sysprof_document_frame, SYSPROF, CAPTURE_FRAME_OBJECT, GObject)
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
|
||||||
SysprofCaptureFrame *sysprof_capture_frame_object_get_frame (SysprofCaptureFrameObject *self);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
|
||||||
#include "sysprof-capture-frame-object-private.h"
|
|
||||||
#include "sysprof-document.h"
|
#include "sysprof-document.h"
|
||||||
|
#include "sysprof-document-frame-private.h"
|
||||||
|
|
||||||
struct _SysprofDocument
|
struct _SysprofDocument
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ struct _SysprofDocument
|
|||||||
static GType
|
static GType
|
||||||
sysprof_document_get_item_type (GListModel *model)
|
sysprof_document_get_item_type (GListModel *model)
|
||||||
{
|
{
|
||||||
return SYSPROF_TYPE_CAPTURE_FRAME_OBJECT;
|
return SYSPROF_TYPE_DOCUMENT_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
@ -57,9 +57,9 @@ sysprof_document_get_item (GListModel *model,
|
|||||||
if (position >= self->frames->len)
|
if (position >= self->frames->len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return sysprof_capture_frame_object_new (self->mapped_file,
|
return sysprof_document_frame_new (self->mapped_file,
|
||||||
g_ptr_array_index (self->frames, position),
|
g_ptr_array_index (self->frames, position),
|
||||||
self->is_native);
|
self->is_native);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <sysprof-analyze.h>
|
#include <sysprof-analyze.h>
|
||||||
|
#include <sysprof-capture.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
@ -34,9 +36,9 @@ main (int argc,
|
|||||||
|
|
||||||
for (guint i = 0; i < n_items; i++)
|
for (guint i = 0; i < n_items; i++)
|
||||||
{
|
{
|
||||||
SysprofCaptureFrameObject *obj = g_list_model_get_item (G_LIST_MODEL (document), i);
|
SysprofDocumentFrame *frame = g_list_model_get_item (G_LIST_MODEL (document), i);
|
||||||
|
|
||||||
g_clear_object (&obj);
|
g_clear_object (&frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_object (&document);
|
g_clear_object (&document);
|
||||||
|
|||||||
Reference in New Issue
Block a user