[sysprof/wip/chergert/sysprof-3] build: rename all symbols to use sysprof_ as prefix
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] build: rename all symbols to use sysprof_ as prefix
- Date: Wed, 8 May 2019 19:05:10 +0000 (UTC)
commit 1bc605f351e76d567af91324a58ed5dfbccf4801
Author: Christian Hergert <chergert redhat com>
Date: Wed May 8 12:03:46 2019 -0700
build: rename all symbols to use sysprof_ as prefix
As we gain in usage, we need to be more careful about using a prefix
that will not collide with other symbols. So version 3 of our ABI will
change to using Sysprof/SYSPROF/sysprof as the various prefixes.
The soname/api version bump will happen later on this branch so that
things are easier to test up until then.
src/libsysprof-capture/meson.build | 32 +-
src/libsysprof-capture/sp-capture-cursor.c | 265 ----------
src/libsysprof-capture/sp-capture-reader.h | 91 ----
src/libsysprof-capture/sp-capture-types.h | 256 ----------
...dress-fallback.h => sysprof-address-fallback.h} | 0
.../{sp-address.c => sysprof-address.c} | 42 +-
.../{sp-address.h => sysprof-address.h} | 32 +-
...ure-condition.c => sysprof-capture-condition.c} | 198 ++++----
...ure-condition.h => sysprof-capture-condition.h} | 30 +-
src/libsysprof-capture/sysprof-capture-cursor.c | 265 ++++++++++
...p-capture-cursor.h => sysprof-capture-cursor.h} | 32 +-
...p-capture-reader.c => sysprof-capture-reader.c} | 364 +++++++-------
src/libsysprof-capture/sysprof-capture-reader.h | 91 ++++
src/libsysprof-capture/sysprof-capture-types.h | 256 ++++++++++
...il-private.h => sysprof-capture-util-private.h} | 26 +-
.../{sp-capture-util.c => sysprof-capture-util.c} | 34 +-
...p-capture-writer.c => sysprof-capture-writer.c} | 376 +++++++-------
...p-capture-writer.h => sysprof-capture-writer.h} | 68 +--
src/libsysprof-capture/sysprof-capture.h | 12 +-
.../{sp-clock.c => sysprof-clock.c} | 14 +-
.../{sp-clock.h => sysprof-clock.h} | 24 +-
.../{sp-platform.c => sysprof-platform.c} | 10 +-
.../{sp-platform.h => sysprof-platform.h} | 4 +-
src/libsysprof-ui/meson.build | 72 +--
src/libsysprof-ui/rectangles.c | 24 +-
src/libsysprof-ui/sp-cell-renderer-percent.h | 62 ---
src/libsysprof-ui/sp-cpu-visualizer-row.c | 173 -------
...p-callgraph-view.c => sysprof-callgraph-view.c} | 206 ++++----
...p-callgraph-view.h => sysprof-callgraph-view.h} | 24 +-
...r-percent.c => sysprof-cell-renderer-percent.c} | 40 +-
src/libsysprof-ui/sysprof-cell-renderer-percent.h | 62 +++
.../{sp-color-cycle.c => sysprof-color-cycle.c} | 34 +-
.../{sp-color-cycle.h => sysprof-color-cycle.h} | 18 +-
src/libsysprof-ui/sysprof-cpu-visualizer-row.c | 173 +++++++
...sualizer-row.h => sysprof-cpu-visualizer-row.h} | 10 +-
...pty-state-view.c => sysprof-empty-state-view.c} | 44 +-
...pty-state-view.h => sysprof-empty-state-view.h} | 10 +-
...ed-state-view.c => sysprof-failed-state-view.c} | 16 +-
...ng-state-view.h => sysprof-failed-state-view.h} | 16 +-
...ualizer-row.c => sysprof-line-visualizer-row.c} | 228 ++++-----
...ualizer-row.h => sysprof-line-visualizer-row.h} | 24 +-
...ualizer-row.c => sysprof-mark-visualizer-row.c} | 156 +++---
...ualizer-row.h => sysprof-mark-visualizer-row.h} | 18 +-
.../{sp-model-filter.c => sysprof-model-filter.c} | 152 +++---
.../{sp-model-filter.h => sysprof-model-filter.h} | 20 +-
.../{sp-multi-paned.c => sysprof-multi-paned.c} | 560 ++++++++++-----------
.../{sp-multi-paned.h => sysprof-multi-paned.h} | 16 +-
...ess-model-row.c => sysprof-process-model-row.c} | 112 ++---
...ess-model-row.h => sysprof-process-model-row.h} | 18 +-
...enu-button.c => sysprof-profiler-menu-button.c} | 322 ++++++------
...enu-button.h => sysprof-profiler-menu-button.h} | 18 +-
...state-view.c => sysprof-recording-state-view.c} | 74 +--
...state-view.h => sysprof-recording-state-view.h} | 16 +-
...{sp-theme-manager.c => sysprof-theme-manager.c} | 60 +--
...{sp-theme-manager.h => sysprof-theme-manager.h} | 12 +-
src/libsysprof-ui/sysprof-ui.h | 32 +-
...visualizer-list.c => sysprof-visualizer-list.c} | 190 +++----
...visualizer-list.h => sysprof-visualizer-list.h} | 26 +-
...-private.h => sysprof-visualizer-row-private.h} | 6 +-
...p-visualizer-row.c => sysprof-visualizer-row.c} | 138 ++---
...p-visualizer-row.h => sysprof-visualizer-row.h} | 40 +-
...sualizer-ticks.c => sysprof-visualizer-ticks.c} | 56 +--
...sualizer-ticks.h => sysprof-visualizer-ticks.h} | 16 +-
...visualizer-view.c => sysprof-visualizer-view.c} | 376 +++++++-------
...visualizer-view.h => sysprof-visualizer-view.h} | 38 +-
.../{sp-zoom-manager.c => sysprof-zoom-manager.c} | 164 +++---
.../{sp-zoom-manager.h => sysprof-zoom-manager.h} | 30 +-
src/libsysprof/binfile.c | 4 +-
src/libsysprof/meson.build | 96 ++--
src/libsysprof/sp-jitmap-symbol-resolver.c | 125 -----
src/libsysprof/sp-profiler.h | 184 -------
src/libsysprof/sp-source.h | 132 -----
...graph-profile.c => sysprof-callgraph-profile.c} | 208 ++++----
...graph-profile.h => sysprof-callgraph-profile.h} | 18 +-
...capture-gobject.c => sysprof-capture-gobject.c} | 10 +-
...capture-gobject.h => sysprof-capture-gobject.h} | 14 +-
...ol-resolver.c => sysprof-elf-symbol-resolver.c} | 102 ++--
...ol-resolver.h => sysprof-elf-symbol-resolver.h} | 10 +-
.../{sp-gjs-source.c => sysprof-gjs-source.c} | 104 ++--
.../{sp-gjs-source.h => sysprof-gjs-source.h} | 10 +-
...hostinfo-source.c => sysprof-hostinfo-source.c} | 110 ++--
...hostinfo-source.h => sysprof-hostinfo-source.h} | 10 +-
src/libsysprof/sysprof-jitmap-symbol-resolver.c | 125 +++++
...resolver.h => sysprof-jitmap-symbol-resolver.h} | 10 +-
.../{sp-kallsyms.c => sysprof-kallsyms.c} | 22 +-
.../{sp-kallsyms.h => sysprof-kallsyms.h} | 12 +-
...resolver.c => sysprof-kernel-symbol-resolver.c} | 42 +-
...resolver.h => sysprof-kernel-symbol-resolver.h} | 10 +-
...{sp-kernel-symbol.c => sysprof-kernel-symbol.c} | 70 +--
...{sp-kernel-symbol.h => sysprof-kernel-symbol.h} | 10 +-
.../{sp-line-reader.c => sysprof-line-reader.c} | 36 +-
.../{sp-line-reader.h => sysprof-line-reader.h} | 12 +-
...p-local-profiler.c => sysprof-local-profiler.c} | 314 ++++++------
...p-local-profiler.h => sysprof-local-profiler.h} | 12 +-
...{sp-map-lookaside.c => sysprof-map-lookaside.c} | 62 +--
...{sp-map-lookaside.h => sysprof-map-lookaside.h} | 26 +-
...{sp-memory-source.c => sysprof-memory-source.c} | 126 ++---
...{sp-memory-source.h => sysprof-memory-source.h} | 10 +-
.../{sp-perf-counter.c => sysprof-perf-counter.c} | 132 ++---
.../{sp-perf-counter.h => sysprof-perf-counter.h} | 62 +--
.../{sp-perf-source.c => sysprof-perf-source.c} | 262 +++++-----
.../{sp-perf-source.h => sysprof-perf-source.h} | 12 +-
.../{sp-proc-source.c => sysprof-proc-source.c} | 116 ++---
.../{sp-proc-source.h => sysprof-proc-source.h} | 12 +-
...s-model-item.c => sysprof-process-model-item.c} | 74 +--
...s-model-item.h => sysprof-process-model-item.h} | 22 +-
...{sp-process-model.c => sysprof-process-model.c} | 116 ++---
...{sp-process-model.h => sysprof-process-model.h} | 12 +-
src/libsysprof/{sp-profile.c => sysprof-profile.c} | 32 +-
src/libsysprof/{sp-profile.h => sysprof-profile.h} | 26 +-
.../{sp-profiler.c => sysprof-profiler.c} | 130 ++---
src/libsysprof/sysprof-profiler.h | 184 +++++++
.../{sp-selection.c => sysprof-selection.c} | 68 +--
.../{sp-selection.h => sysprof-selection.h} | 24 +-
...til-private.h => sysprof-source-util-private.h} | 6 +-
.../{sp-source-util.c => sysprof-source-util.c} | 8 +-
src/libsysprof/{sp-source.c => sysprof-source.c} | 70 +--
src/libsysprof/sysprof-source.h | 132 +++++
.../{sp-symbol-dirs.c => sysprof-symbol-dirs.c} | 46 +-
.../{sp-symbol-dirs.h => sysprof-symbol-dirs.h} | 8 +-
...symbol-resolver.c => sysprof-symbol-resolver.c} | 66 +--
...symbol-resolver.h => sysprof-symbol-resolver.h} | 40 +-
src/libsysprof/sysprof.h | 42 +-
src/sysprof/meson.build | 6 +-
.../{sp-application.c => sysprof-application.c} | 90 ++--
.../{sp-application.h => sysprof-application.h} | 14 +-
src/sysprof/{sp-credits.h => sysprof-credits.h} | 6 +-
...window-settings.c => sysprof-window-settings.c} | 32 +-
...window-settings.h => sysprof-window-settings.h} | 10 +-
src/sysprof/{sp-window.c => sysprof-window.c} | 536 ++++++++++----------
src/sysprof/{sp-window.h => sysprof-window.h} | 40 +-
src/sysprof/sysprof.c | 8 +-
src/sysprofd/meson.build | 6 +-
src/sysprofd/sysprofd.c | 9 +-
src/tests/test-capture-cursor.c | 34 +-
src/tests/test-capture.c | 280 +++++------
src/tests/test-kallsyms.c | 8 +-
src/tests/test-model-filter.c | 46 +-
src/tests/test-process-model.c | 18 +-
src/tests/test-zoom.c | 56 +--
src/tools/sysprof-cat.c | 114 ++---
src/tools/sysprof-cli.c | 46 +-
src/tools/sysprof-dump.c | 70 +--
143 files changed, 5797 insertions(+), 5794 deletions(-)
---
diff --git a/src/libsysprof-capture/meson.build b/src/libsysprof-capture/meson.build
index f5d3dab..ce487dd 100644
--- a/src/libsysprof-capture/meson.build
+++ b/src/libsysprof-capture/meson.build
@@ -1,25 +1,25 @@
libsysprof_capture_headers = files([
- 'sp-address.h',
- 'sp-clock.h',
- 'sp-capture-condition.h',
- 'sp-capture-cursor.h',
- 'sp-capture-reader.h',
- 'sp-capture-types.h',
- 'sp-capture-writer.h',
- 'sp-platform.h',
+ 'sysprof-address.h',
+ 'sysprof-clock.h',
+ 'sysprof-capture-condition.h',
+ 'sysprof-capture-cursor.h',
+ 'sysprof-capture-reader.h',
+ 'sysprof-capture-types.h',
+ 'sysprof-capture-writer.h',
+ 'sysprof-platform.h',
'sysprof-capture.h',
'sysprof-version-macros.h',
])
libsysprof_capture_sources = files([
- 'sp-address.c',
- 'sp-capture-condition.c',
- 'sp-capture-cursor.c',
- 'sp-capture-reader.c',
- 'sp-capture-util.c',
- 'sp-capture-writer.c',
- 'sp-clock.c',
- 'sp-platform.c',
+ 'sysprof-address.c',
+ 'sysprof-capture-condition.c',
+ 'sysprof-capture-cursor.c',
+ 'sysprof-capture-reader.c',
+ 'sysprof-capture-util.c',
+ 'sysprof-capture-writer.c',
+ 'sysprof-clock.c',
+ 'sysprof-platform.c',
])
configure_file(
diff --git a/src/libsysprof-capture/sp-address-fallback.h b/src/libsysprof-capture/sysprof-address-fallback.h
similarity index 100%
rename from src/libsysprof-capture/sp-address-fallback.h
rename to src/libsysprof-capture/sysprof-address-fallback.h
diff --git a/src/libsysprof-capture/sp-address.c b/src/libsysprof-capture/sysprof-address.c
similarity index 61%
rename from src/libsysprof-capture/sp-address.c
rename to src/libsysprof-capture/sysprof-address.c
index 0e9d4b9..1a3545e 100644
--- a/src/libsysprof-capture/sp-address.c
+++ b/src/libsysprof-capture/sysprof-address.c
@@ -1,4 +1,4 @@
-/* sp-address.c
+/* sysprof-address.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -23,16 +23,16 @@
#ifdef __linux__
# include <linux/perf_event.h>
#else
-# include "sp-address-fallback.h"
+# include "sysprof-address-fallback.h"
#endif
-#include "sp-address.h"
+#include "sysprof-address.h"
gboolean
-sp_address_is_context_switch (SpAddress address,
- SpAddressContext *context)
+sysprof_address_is_context_switch (SysprofAddress address,
+ SysprofAddressContext *context)
{
- SpAddressContext dummy;
+ SysprofAddressContext dummy;
if (context == NULL)
context = &dummy;
@@ -40,59 +40,59 @@ sp_address_is_context_switch (SpAddress address,
switch (address)
{
case PERF_CONTEXT_HV:
- *context = SP_ADDRESS_CONTEXT_HYPERVISOR;
+ *context = SYSPROF_ADDRESS_CONTEXT_HYPERVISOR;
return TRUE;
case PERF_CONTEXT_KERNEL:
- *context = SP_ADDRESS_CONTEXT_KERNEL;
+ *context = SYSPROF_ADDRESS_CONTEXT_KERNEL;
return TRUE;
case PERF_CONTEXT_USER:
- *context = SP_ADDRESS_CONTEXT_USER;
+ *context = SYSPROF_ADDRESS_CONTEXT_USER;
return TRUE;
case PERF_CONTEXT_GUEST:
- *context = SP_ADDRESS_CONTEXT_GUEST;
+ *context = SYSPROF_ADDRESS_CONTEXT_GUEST;
return TRUE;
case PERF_CONTEXT_GUEST_KERNEL:
- *context = SP_ADDRESS_CONTEXT_GUEST_KERNEL;
+ *context = SYSPROF_ADDRESS_CONTEXT_GUEST_KERNEL;
return TRUE;
case PERF_CONTEXT_GUEST_USER:
- *context = SP_ADDRESS_CONTEXT_GUEST_USER;
+ *context = SYSPROF_ADDRESS_CONTEXT_GUEST_USER;
return TRUE;
default:
- *context = SP_ADDRESS_CONTEXT_NONE;
+ *context = SYSPROF_ADDRESS_CONTEXT_NONE;
return FALSE;
}
}
const gchar *
-sp_address_context_to_string (SpAddressContext context)
+sysprof_address_context_to_string (SysprofAddressContext context)
{
switch (context)
{
- case SP_ADDRESS_CONTEXT_HYPERVISOR:
+ case SYSPROF_ADDRESS_CONTEXT_HYPERVISOR:
return "- - hypervisor - -";
- case SP_ADDRESS_CONTEXT_KERNEL:
+ case SYSPROF_ADDRESS_CONTEXT_KERNEL:
return "- - kernel - -";
- case SP_ADDRESS_CONTEXT_USER:
+ case SYSPROF_ADDRESS_CONTEXT_USER:
return "- - user - -";
- case SP_ADDRESS_CONTEXT_GUEST:
+ case SYSPROF_ADDRESS_CONTEXT_GUEST:
return "- - guest - -";
- case SP_ADDRESS_CONTEXT_GUEST_KERNEL:
+ case SYSPROF_ADDRESS_CONTEXT_GUEST_KERNEL:
return "- - guest kernel - -";
- case SP_ADDRESS_CONTEXT_GUEST_USER:
+ case SYSPROF_ADDRESS_CONTEXT_GUEST_USER:
return "- - guest user - -";
- case SP_ADDRESS_CONTEXT_NONE:
+ case SYSPROF_ADDRESS_CONTEXT_NONE:
default:
return "- - unknown - -";
}
diff --git a/src/libsysprof-capture/sp-address.h b/src/libsysprof-capture/sysprof-address.h
similarity index 58%
rename from src/libsysprof-capture/sp-address.h
rename to src/libsysprof-capture/sysprof-address.h
index 858de17..0dcb424 100644
--- a/src/libsysprof-capture/sp-address.h
+++ b/src/libsysprof-capture/sysprof-address.h
@@ -1,4 +1,4 @@
-/* sp-address.h
+/* sysprof-address.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -24,30 +24,30 @@
G_BEGIN_DECLS
-typedef guint64 SpAddress;
+typedef guint64 SysprofAddress;
-G_STATIC_ASSERT (sizeof (SpAddress) >= sizeof (gpointer));
+G_STATIC_ASSERT (sizeof (SysprofAddress) >= sizeof (gpointer));
typedef enum
{
- SP_ADDRESS_CONTEXT_NONE = 0,
- SP_ADDRESS_CONTEXT_HYPERVISOR,
- SP_ADDRESS_CONTEXT_KERNEL,
- SP_ADDRESS_CONTEXT_USER,
- SP_ADDRESS_CONTEXT_GUEST,
- SP_ADDRESS_CONTEXT_GUEST_KERNEL,
- SP_ADDRESS_CONTEXT_GUEST_USER,
-} SpAddressContext;
+ SYSPROF_ADDRESS_CONTEXT_NONE = 0,
+ SYSPROF_ADDRESS_CONTEXT_HYPERVISOR,
+ SYSPROF_ADDRESS_CONTEXT_KERNEL,
+ SYSPROF_ADDRESS_CONTEXT_USER,
+ SYSPROF_ADDRESS_CONTEXT_GUEST,
+ SYSPROF_ADDRESS_CONTEXT_GUEST_KERNEL,
+ SYSPROF_ADDRESS_CONTEXT_GUEST_USER,
+} SysprofAddressContext;
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_address_is_context_switch (SpAddress address,
- SpAddressContext *context);
+gboolean sysprof_address_is_context_switch (SysprofAddress address,
+ SysprofAddressContext *context);
SYSPROF_AVAILABLE_IN_ALL
-const gchar *sp_address_context_to_string (SpAddressContext context);
+const gchar *sysprof_address_context_to_string (SysprofAddressContext context);
static inline gint
-sp_address_compare (SpAddress a,
- SpAddress b)
+sysprof_address_compare (SysprofAddress a,
+ SysprofAddress b)
{
if (a < b)
return -1;
diff --git a/src/libsysprof-capture/sp-capture-condition.c
b/src/libsysprof-capture/sysprof-capture-condition.c
similarity index 53%
rename from src/libsysprof-capture/sp-capture-condition.c
rename to src/libsysprof-capture/sysprof-capture-condition.c
index 9cac082..0bfd25e 100644
--- a/src/libsysprof-capture/sp-capture-condition.c
+++ b/src/libsysprof-capture/sysprof-capture-condition.c
@@ -1,4 +1,4 @@
-/* sp-capture-condition.c
+/* sysprof-capture-condition.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,20 +18,20 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-capture-condition"
+#define G_LOG_DOMAIN "sysprof-capture-condition"
#include "config.h"
#include <string.h>
-#include "sp-capture-condition.h"
+#include "sysprof-capture-condition.h"
/**
- * SECTION:sp-capture-condition
- * @title: SpCaptureCondition
+ * SECTION:sysprof-capture-condition
+ * @title: SysprofCaptureCondition
*
- * The #SpCaptureCondition type is an abstraction on an operation
- * for a sort of AST to the #SpCaptureCursor. The goal is that if
+ * The #SysprofCaptureCondition type is an abstraction on an operation
+ * for a sort of AST to the #SysprofCaptureCursor. The goal is that if
* we abstract the types of fields we want to match in the cursor
* that we can opportunistically add indexes to speed up the operation
* later on without changing the implementation of cursor consumers.
@@ -39,17 +39,17 @@
typedef enum
{
- SP_CAPTURE_CONDITION_AND,
- SP_CAPTURE_CONDITION_WHERE_TYPE_IN,
- SP_CAPTURE_CONDITION_WHERE_TIME_BETWEEN,
- SP_CAPTURE_CONDITION_WHERE_PID_IN,
- SP_CAPTURE_CONDITION_WHERE_COUNTER_IN,
-} SpCaptureConditionType;
-
-struct _SpCaptureCondition
+ SYSPROF_CAPTURE_CONDITION_AND,
+ SYSPROF_CAPTURE_CONDITION_WHERE_TYPE_IN,
+ SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN,
+ SYSPROF_CAPTURE_CONDITION_WHERE_PID_IN,
+ SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN,
+} SysprofCaptureConditionType;
+
+struct _SysprofCaptureCondition
{
volatile gint ref_count;
- SpCaptureConditionType type;
+ SysprofCaptureConditionType type;
union {
GArray *where_type_in;
struct {
@@ -59,37 +59,37 @@ struct _SpCaptureCondition
GArray *where_pid_in;
GArray *where_counter_in;
struct {
- SpCaptureCondition *left;
- SpCaptureCondition *right;
+ SysprofCaptureCondition *left;
+ SysprofCaptureCondition *right;
} and;
} u;
};
gboolean
-sp_capture_condition_match (const SpCaptureCondition *self,
- const SpCaptureFrame *frame)
+sysprof_capture_condition_match (const SysprofCaptureCondition *self,
+ const SysprofCaptureFrame *frame)
{
g_assert (self != NULL);
g_assert (frame != NULL);
switch (self->type)
{
- case SP_CAPTURE_CONDITION_AND:
- return sp_capture_condition_match (self->u.and.left, frame) &&
- sp_capture_condition_match (self->u.and.right, frame);
+ case SYSPROF_CAPTURE_CONDITION_AND:
+ return sysprof_capture_condition_match (self->u.and.left, frame) &&
+ sysprof_capture_condition_match (self->u.and.right, frame);
- case SP_CAPTURE_CONDITION_WHERE_TYPE_IN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_TYPE_IN:
for (guint i = 0; i < self->u.where_type_in->len; i++)
{
- if (frame->type == g_array_index (self->u.where_type_in, SpCaptureFrameType, i))
+ if (frame->type == g_array_index (self->u.where_type_in, SysprofCaptureFrameType, i))
return TRUE;
}
return FALSE;
- case SP_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
return (frame->time >= self->u.where_time_between.begin && frame->time <=
self->u.where_time_between.end);
- case SP_CAPTURE_CONDITION_WHERE_PID_IN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_PID_IN:
for (guint i = 0; i < self->u.where_pid_in->len; i++)
{
if (frame->pid == g_array_index (self->u.where_pid_in, gint32, i))
@@ -97,10 +97,10 @@ sp_capture_condition_match (const SpCaptureCondition *self,
}
return FALSE;
- case SP_CAPTURE_CONDITION_WHERE_COUNTER_IN:
- if (frame->type == SP_CAPTURE_FRAME_CTRSET)
+ case SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN:
+ if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET)
{
- const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
+ const SysprofCaptureFrameCounterSet *set = (SysprofCaptureFrameCounterSet *)frame;
for (guint i = 0; i < self->u.where_counter_in->len; i++)
{
@@ -120,9 +120,9 @@ sp_capture_condition_match (const SpCaptureCondition *self,
}
}
}
- else if (frame->type == SP_CAPTURE_FRAME_CTRDEF)
+ else if (frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF)
{
- const SpCaptureFrameCounterDefine *def = (SpCaptureFrameCounterDefine *)frame;
+ const SysprofCaptureFrameCounterDefine *def = (SysprofCaptureFrameCounterDefine *)frame;
for (guint i = 0; i < self->u.where_counter_in->len; i++)
{
@@ -147,47 +147,47 @@ sp_capture_condition_match (const SpCaptureCondition *self,
return FALSE;
}
-static SpCaptureCondition *
-sp_capture_condition_init (void)
+static SysprofCaptureCondition *
+sysprof_capture_condition_init (void)
{
- SpCaptureCondition *self;
+ SysprofCaptureCondition *self;
- self = g_slice_new0 (SpCaptureCondition);
+ self = g_slice_new0 (SysprofCaptureCondition);
self->ref_count = 1;
return g_steal_pointer (&self);
}
-SpCaptureCondition *
-sp_capture_condition_copy (const SpCaptureCondition *self)
+SysprofCaptureCondition *
+sysprof_capture_condition_copy (const SysprofCaptureCondition *self)
{
- SpCaptureCondition *copy;
+ SysprofCaptureCondition *copy;
- copy = sp_capture_condition_init ();
+ copy = sysprof_capture_condition_init ();
copy->type = self->type;
switch (self->type)
{
- case SP_CAPTURE_CONDITION_AND:
- return sp_capture_condition_new_and (
- sp_capture_condition_copy (self->u.and.left),
- sp_capture_condition_copy (self->u.and.right));
+ case SYSPROF_CAPTURE_CONDITION_AND:
+ return sysprof_capture_condition_new_and (
+ sysprof_capture_condition_copy (self->u.and.left),
+ sysprof_capture_condition_copy (self->u.and.right));
- case SP_CAPTURE_CONDITION_WHERE_TYPE_IN:
- return sp_capture_condition_new_where_type_in (
+ case SYSPROF_CAPTURE_CONDITION_WHERE_TYPE_IN:
+ return sysprof_capture_condition_new_where_type_in (
self->u.where_type_in->len,
- (const SpCaptureFrameType *)(gpointer)self->u.where_type_in->data);
+ (const SysprofCaptureFrameType *)(gpointer)self->u.where_type_in->data);
- case SP_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
break;
- case SP_CAPTURE_CONDITION_WHERE_PID_IN:
- return sp_capture_condition_new_where_pid_in (
+ case SYSPROF_CAPTURE_CONDITION_WHERE_PID_IN:
+ return sysprof_capture_condition_new_where_pid_in (
self->u.where_pid_in->len,
(const gint32 *)(gpointer)self->u.where_pid_in->data);
- case SP_CAPTURE_CONDITION_WHERE_COUNTER_IN:
- return sp_capture_condition_new_where_counter_in (
+ case SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN:
+ return sysprof_capture_condition_new_where_counter_in (
self->u.where_counter_in->len,
(const guint *)(gpointer)self->u.where_counter_in->data);
@@ -200,27 +200,27 @@ sp_capture_condition_copy (const SpCaptureCondition *self)
}
static void
-sp_capture_condition_finalize (SpCaptureCondition *self)
+sysprof_capture_condition_finalize (SysprofCaptureCondition *self)
{
switch (self->type)
{
- case SP_CAPTURE_CONDITION_AND:
- sp_capture_condition_unref (self->u.and.left);
- sp_capture_condition_unref (self->u.and.right);
+ case SYSPROF_CAPTURE_CONDITION_AND:
+ sysprof_capture_condition_unref (self->u.and.left);
+ sysprof_capture_condition_unref (self->u.and.right);
break;
- case SP_CAPTURE_CONDITION_WHERE_TYPE_IN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_TYPE_IN:
g_array_free (self->u.where_type_in, TRUE);
break;
- case SP_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
break;
- case SP_CAPTURE_CONDITION_WHERE_PID_IN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_PID_IN:
g_array_free (self->u.where_pid_in, TRUE);
break;
- case SP_CAPTURE_CONDITION_WHERE_COUNTER_IN:
+ case SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN:
g_array_free (self->u.where_counter_in, TRUE);
break;
@@ -229,11 +229,11 @@ sp_capture_condition_finalize (SpCaptureCondition *self)
break;
}
- g_slice_free (SpCaptureCondition, self);
+ g_slice_free (SysprofCaptureCondition, self);
}
-SpCaptureCondition *
-sp_capture_condition_ref (SpCaptureCondition *self)
+SysprofCaptureCondition *
+sysprof_capture_condition_ref (SysprofCaptureCondition *self)
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count > 0, NULL);
@@ -243,37 +243,37 @@ sp_capture_condition_ref (SpCaptureCondition *self)
}
void
-sp_capture_condition_unref (SpCaptureCondition *self)
+sysprof_capture_condition_unref (SysprofCaptureCondition *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
- sp_capture_condition_finalize (self);
+ sysprof_capture_condition_finalize (self);
}
-SpCaptureCondition *
-sp_capture_condition_new_where_type_in (guint n_types,
- const SpCaptureFrameType *types)
+SysprofCaptureCondition *
+sysprof_capture_condition_new_where_type_in (guint n_types,
+ const SysprofCaptureFrameType *types)
{
- SpCaptureCondition *self;
+ SysprofCaptureCondition *self;
g_return_val_if_fail (types != NULL, NULL);
- self = sp_capture_condition_init ();
- self->type = SP_CAPTURE_CONDITION_WHERE_TYPE_IN;
- self->u.where_type_in = g_array_sized_new (FALSE, FALSE, sizeof (SpCaptureFrameType), n_types);
+ self = sysprof_capture_condition_init ();
+ self->type = SYSPROF_CAPTURE_CONDITION_WHERE_TYPE_IN;
+ self->u.where_type_in = g_array_sized_new (FALSE, FALSE, sizeof (SysprofCaptureFrameType), n_types);
g_array_set_size (self->u.where_type_in, n_types);
- memcpy (self->u.where_type_in->data, types, sizeof (SpCaptureFrameType) * n_types);
+ memcpy (self->u.where_type_in->data, types, sizeof (SysprofCaptureFrameType) * n_types);
return self;
}
-SpCaptureCondition *
-sp_capture_condition_new_where_time_between (gint64 begin_time,
+SysprofCaptureCondition *
+sysprof_capture_condition_new_where_time_between (gint64 begin_time,
gint64 end_time)
{
- SpCaptureCondition *self;
+ SysprofCaptureCondition *self;
if G_UNLIKELY (begin_time > end_time)
{
@@ -282,24 +282,24 @@ sp_capture_condition_new_where_time_between (gint64 begin_time,
end_time = tmp;
}
- self = sp_capture_condition_init ();
- self->type = SP_CAPTURE_CONDITION_WHERE_TIME_BETWEEN;
+ self = sysprof_capture_condition_init ();
+ self->type = SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN;
self->u.where_time_between.begin = begin_time;
self->u.where_time_between.end = end_time;
return self;
}
-SpCaptureCondition *
-sp_capture_condition_new_where_pid_in (guint n_pids,
+SysprofCaptureCondition *
+sysprof_capture_condition_new_where_pid_in (guint n_pids,
const gint32 *pids)
{
- SpCaptureCondition *self;
+ SysprofCaptureCondition *self;
g_return_val_if_fail (pids != NULL, NULL);
- self = sp_capture_condition_init ();
- self->type = SP_CAPTURE_CONDITION_WHERE_PID_IN;
+ self = sysprof_capture_condition_init ();
+ self->type = SYSPROF_CAPTURE_CONDITION_WHERE_PID_IN;
self->u.where_pid_in = g_array_sized_new (FALSE, FALSE, sizeof (gint32), n_pids);
g_array_set_size (self->u.where_pid_in, n_pids);
memcpy (self->u.where_pid_in->data, pids, sizeof (gint32) * n_pids);
@@ -307,16 +307,16 @@ sp_capture_condition_new_where_pid_in (guint n_pids,
return self;
}
-SpCaptureCondition *
-sp_capture_condition_new_where_counter_in (guint n_counters,
+SysprofCaptureCondition *
+sysprof_capture_condition_new_where_counter_in (guint n_counters,
const guint *counters)
{
- SpCaptureCondition *self;
+ SysprofCaptureCondition *self;
g_return_val_if_fail (counters != NULL || n_counters == 0, NULL);
- self = sp_capture_condition_init ();
- self->type = SP_CAPTURE_CONDITION_WHERE_COUNTER_IN;
+ self = sysprof_capture_condition_init ();
+ self->type = SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN;
self->u.where_counter_in = g_array_sized_new (FALSE, FALSE, sizeof (guint), n_counters);
if (n_counters > 0)
@@ -329,26 +329,26 @@ sp_capture_condition_new_where_counter_in (guint n_counters,
}
/**
- * sp_capture_condition_new_and:
- * @left: (transfer full): An #SpCaptureCondition
- * @right: (transfer full): An #SpCaptureCondition
+ * sysprof_capture_condition_new_and:
+ * @left: (transfer full): An #SysprofCaptureCondition
+ * @right: (transfer full): An #SysprofCaptureCondition
*
- * Creates a new #SpCaptureCondition that requires both left and right
+ * Creates a new #SysprofCaptureCondition that requires both left and right
* to evaluate to %TRUE.
*
- * Returns: (transfer full): A new #SpCaptureCondition.
+ * Returns: (transfer full): A new #SysprofCaptureCondition.
*/
-SpCaptureCondition *
-sp_capture_condition_new_and (SpCaptureCondition *left,
- SpCaptureCondition *right)
+SysprofCaptureCondition *
+sysprof_capture_condition_new_and (SysprofCaptureCondition *left,
+ SysprofCaptureCondition *right)
{
- SpCaptureCondition *self;
+ SysprofCaptureCondition *self;
g_return_val_if_fail (left != NULL, NULL);
g_return_val_if_fail (right != NULL, NULL);
- self = sp_capture_condition_init ();
- self->type = SP_CAPTURE_CONDITION_AND;
+ self = sysprof_capture_condition_init ();
+ self->type = SYSPROF_CAPTURE_CONDITION_AND;
self->u.and.left = left;
self->u.and.right = right;
diff --git a/src/libsysprof-capture/sp-capture-condition.h
b/src/libsysprof-capture/sysprof-capture-condition.h
similarity index 55%
rename from src/libsysprof-capture/sp-capture-condition.h
rename to src/libsysprof-capture/sysprof-capture-condition.h
index 2ac46ec..2f7e22e 100644
--- a/src/libsysprof-capture/sp-capture-condition.h
+++ b/src/libsysprof-capture/sysprof-capture-condition.h
@@ -1,4 +1,4 @@
-/* sp-capture-condition.h
+/* sysprof-capture-condition.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,36 +20,36 @@
#pragma once
-#include "sp-capture-types.h"
+#include "sysprof-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_copy (const SpCaptureCondition *self);
+SysprofCaptureCondition *sysprof_capture_condition_copy (const SysprofCaptureCondition
*self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_condition_unref (SpCaptureCondition *self);
+void sysprof_capture_condition_unref (SysprofCaptureCondition *self);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_ref (SpCaptureCondition *self);
+SysprofCaptureCondition *sysprof_capture_condition_ref (SysprofCaptureCondition
*self);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_new_and (SpCaptureCondition *left,
- SpCaptureCondition *right);
+SysprofCaptureCondition *sysprof_capture_condition_new_and (SysprofCaptureCondition
*left,
+ SysprofCaptureCondition *right);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_new_where_type_in (guint n_types,
- const SpCaptureFrameType *types);
+SysprofCaptureCondition *sysprof_capture_condition_new_where_type_in (guint n_types,
+ const SysprofCaptureFrameType *types);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_new_where_time_between (gint64 begin_time,
+SysprofCaptureCondition *sysprof_capture_condition_new_where_time_between (gint64
begin_time,
gint64 end_time);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_new_where_pid_in (guint n_pids,
+SysprofCaptureCondition *sysprof_capture_condition_new_where_pid_in (guint n_pids,
const gint32 *pids);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCondition *sp_capture_condition_new_where_counter_in (guint n_counters,
+SysprofCaptureCondition *sysprof_capture_condition_new_where_counter_in (guint
n_counters,
const guint *counters);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_condition_match (const SpCaptureCondition *self,
- const SpCaptureFrame *frame);
+gboolean sysprof_capture_condition_match (const SysprofCaptureCondition *self,
+ const SysprofCaptureFrame *frame);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureCondition, sp_capture_condition_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCaptureCondition, sysprof_capture_condition_unref)
G_END_DECLS
diff --git a/src/libsysprof-capture/sysprof-capture-cursor.c b/src/libsysprof-capture/sysprof-capture-cursor.c
new file mode 100644
index 0000000..26e724f
--- /dev/null
+++ b/src/libsysprof-capture/sysprof-capture-cursor.c
@@ -0,0 +1,265 @@
+/* sysprof-capture-cursor.c
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "sysprof-capture-cursor"
+
+#include "config.h"
+
+#include "sysprof-capture-condition.h"
+#include "sysprof-capture-cursor.h"
+#include "sysprof-capture-reader.h"
+
+#define READ_DELEGATE(f) ((ReadDelegate)(f))
+
+typedef const SysprofCaptureFrame *(*ReadDelegate) (SysprofCaptureReader *);
+
+struct _SysprofCaptureCursor
+{
+ volatile gint ref_count;
+ GPtrArray *conditions;
+ SysprofCaptureReader *reader;
+ guint reversed : 1;
+};
+
+static void
+sysprof_capture_cursor_finalize (SysprofCaptureCursor *self)
+{
+ g_clear_pointer (&self->conditions, g_ptr_array_unref);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
+ g_slice_free (SysprofCaptureCursor, self);
+}
+
+static SysprofCaptureCursor *
+sysprof_capture_cursor_init (void)
+{
+ SysprofCaptureCursor *self;
+
+ self = g_slice_new0 (SysprofCaptureCursor);
+ self->conditions = g_ptr_array_new_with_free_func ((GDestroyNotify) sysprof_capture_condition_unref);
+ self->ref_count = 1;
+
+ return g_steal_pointer (&self);
+}
+
+/**
+ * sysprof_capture_cursor_ref:
+ * @self: a #SysprofCaptureCursor
+ *
+ * Returns: (transfer full): @self
+ *
+ * Since: 3.34
+ */
+SysprofCaptureCursor *
+sysprof_capture_cursor_ref (SysprofCaptureCursor *self)
+{
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (self->ref_count > 0, NULL);
+
+ g_atomic_int_inc (&self->ref_count);
+ return self;
+}
+
+/**
+ * sysprof_capture_cursor_unref:
+ * @self: a #SysprofCaptureCursor
+ *
+ * Since: 3.34
+ */
+void
+sysprof_capture_cursor_unref (SysprofCaptureCursor *self)
+{
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (self->ref_count > 0);
+
+ if (g_atomic_int_dec_and_test (&self->ref_count))
+ sysprof_capture_cursor_finalize (self);
+}
+
+/**
+ * sysprof_capture_cursor_foreach:
+ * @self: a #SysprofCaptureCursor
+ * @callback: (scope call): a closure to execute
+ * @user_data: user data for @callback
+ *
+ */
+void
+sysprof_capture_cursor_foreach (SysprofCaptureCursor *self,
+ SysprofCaptureCursorCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (self->reader != NULL);
+ g_return_if_fail (callback != NULL);
+
+ for (;;)
+ {
+ const SysprofCaptureFrame *frame;
+ SysprofCaptureFrameType type = 0;
+ ReadDelegate delegate = NULL;
+
+ if (!sysprof_capture_reader_peek_type (self->reader, &type))
+ return;
+
+ switch (type)
+ {
+ case SYSPROF_CAPTURE_FRAME_TIMESTAMP:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_timestamp);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_SAMPLE:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_sample);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_MAP:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_map);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_MARK:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_mark);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_PROCESS:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_process);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_FORK:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_fork);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_EXIT:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_exit);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_JITMAP:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_jitmap);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_CTRDEF:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_counter_define);
+ break;
+
+ case SYSPROF_CAPTURE_FRAME_CTRSET:
+ delegate = READ_DELEGATE (sysprof_capture_reader_read_counter_set);
+ break;
+
+ default:
+ if (!sysprof_capture_reader_skip (self->reader))
+ return;
+ delegate = NULL;
+ break;
+ }
+
+ if (delegate == NULL)
+ continue;
+
+ if (NULL == (frame = delegate (self->reader)))
+ return;
+
+ if (self->conditions->len == 0)
+ {
+ if (!callback (frame, user_data))
+ return;
+ }
+ else
+ {
+ for (guint i = 0; i < self->conditions->len; i++)
+ {
+ const SysprofCaptureCondition *condition = g_ptr_array_index (self->conditions, i);
+
+ if (sysprof_capture_condition_match (condition, frame))
+ {
+ if (!callback (frame, user_data))
+ return;
+ break;
+ }
+ }
+ }
+ }
+}
+
+void
+sysprof_capture_cursor_reset (SysprofCaptureCursor *self)
+{
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (self->reader != NULL);
+
+ sysprof_capture_reader_reset (self->reader);
+}
+
+void
+sysprof_capture_cursor_reverse (SysprofCaptureCursor *self)
+{
+ g_return_if_fail (self != NULL);
+
+ self->reversed = !self->reversed;
+}
+
+/**
+ * sysprof_capture_cursor_add_condition:
+ * @self: An #SysprofCaptureCursor
+ * @condition: (transfer full): An #SysprofCaptureCondition
+ *
+ * Adds the condition to the cursor. This condition must evaluate to
+ * true or a given #SysprofCapureFrame will not be matched.
+ */
+void
+sysprof_capture_cursor_add_condition (SysprofCaptureCursor *self,
+ SysprofCaptureCondition *condition)
+{
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (condition != NULL);
+
+ g_ptr_array_add (self->conditions, condition);
+}
+
+/**
+ * sysprof_capture_cursor_new:
+ * @self: a #SysprofCaptureCursor
+ *
+ * Returns: (transfer full): a new cursor for @reader
+ */
+SysprofCaptureCursor *
+sysprof_capture_cursor_new (SysprofCaptureReader *reader)
+{
+ SysprofCaptureCursor *self;
+
+ g_return_val_if_fail (reader != NULL, NULL);
+
+ self = sysprof_capture_cursor_init ();
+ self->reader = sysprof_capture_reader_copy (reader);
+ sysprof_capture_reader_reset (self->reader);
+
+ return self;
+}
+
+/**
+ * sysprof_capture_cursor_get_reader:
+ *
+ * Gets the underlying reader that is used by the cursor.
+ *
+ * Returns: (transfer none): An #SysprofCaptureReader
+ */
+SysprofCaptureReader *
+sysprof_capture_cursor_get_reader (SysprofCaptureCursor *self)
+{
+ g_return_val_if_fail (self != NULL, NULL);
+
+ return self->reader;
+}
diff --git a/src/libsysprof-capture/sp-capture-cursor.h b/src/libsysprof-capture/sysprof-capture-cursor.h
similarity index 54%
rename from src/libsysprof-capture/sp-capture-cursor.h
rename to src/libsysprof-capture/sysprof-capture-cursor.h
index 51cc532..7f680e6 100644
--- a/src/libsysprof-capture/sp-capture-cursor.h
+++ b/src/libsysprof-capture/sysprof-capture-cursor.h
@@ -1,4 +1,4 @@
-/* sp-capture-cursor.h
+/* sysprof-capture-cursor.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,15 +20,15 @@
#pragma once
-#include "sp-capture-types.h"
+#include "sysprof-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-typedef struct _SpCaptureCursor SpCaptureCursor;
+typedef struct _SysprofCaptureCursor SysprofCaptureCursor;
/**
- * SpCaptureCursorCallback:
+ * SysprofCaptureCursorCallback:
*
* This is the prototype for callbacks that are called for each frame
* matching the cursor query.
@@ -38,29 +38,29 @@ typedef struct _SpCaptureCursor SpCaptureCursor;
*
* Returns: %TRUE if iteration should stop, otherwise %FALSE.
*/
-typedef gboolean (*SpCaptureCursorCallback) (const SpCaptureFrame *frame,
+typedef gboolean (*SysprofCaptureCursorCallback) (const SysprofCaptureFrame *frame,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCursor *sp_capture_cursor_new (SpCaptureReader *reader);
+SysprofCaptureCursor *sysprof_capture_cursor_new (SysprofCaptureReader *reader);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_cursor_unref (SpCaptureCursor *self);
+void sysprof_capture_cursor_unref (SysprofCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureCursor *sp_capture_cursor_ref (SpCaptureCursor *self);
+SysprofCaptureCursor *sysprof_capture_cursor_ref (SysprofCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureReader *sp_capture_cursor_get_reader (SpCaptureCursor *self);
+SysprofCaptureReader *sysprof_capture_cursor_get_reader (SysprofCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_cursor_foreach (SpCaptureCursor *self,
- SpCaptureCursorCallback callback,
+void sysprof_capture_cursor_foreach (SysprofCaptureCursor *self,
+ SysprofCaptureCursorCallback callback,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_cursor_reset (SpCaptureCursor *self);
+void sysprof_capture_cursor_reset (SysprofCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_cursor_reverse (SpCaptureCursor *self);
+void sysprof_capture_cursor_reverse (SysprofCaptureCursor *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_cursor_add_condition (SpCaptureCursor *self,
- SpCaptureCondition *condition);
+void sysprof_capture_cursor_add_condition (SysprofCaptureCursor *self,
+ SysprofCaptureCondition *condition);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureCursor, sp_capture_cursor_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCaptureCursor, sysprof_capture_cursor_unref)
G_END_DECLS
diff --git a/src/libsysprof-capture/sp-capture-reader.c b/src/libsysprof-capture/sysprof-capture-reader.c
similarity index 58%
rename from src/libsysprof-capture/sp-capture-reader.c
rename to src/libsysprof-capture/sysprof-capture-reader.c
index 92c88b0..8113bb1 100644
--- a/src/libsysprof-capture/sp-capture-reader.c
+++ b/src/libsysprof-capture/sysprof-capture-reader.c
@@ -1,4 +1,4 @@
-/* sp-capture-reader.c
+/* sysprof-capture-reader.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-capture-reader"
+#define G_LOG_DOMAIN "sysprof-capture-reader"
#include "config.h"
@@ -29,11 +29,11 @@
#include <sys/types.h>
#include <unistd.h>
-#include "sp-capture-reader.h"
-#include "sp-capture-util-private.h"
-#include "sp-capture-writer.h"
+#include "sysprof-capture-reader.h"
+#include "sysprof-capture-util-private.h"
+#include "sysprof-capture-writer.h"
-struct _SpCaptureReader
+struct _SysprofCaptureReader
{
volatile gint ref_count;
gchar *filename;
@@ -44,24 +44,24 @@ struct _SpCaptureReader
gsize fd_off;
int fd;
gint endian;
- SpCaptureFileHeader header;
+ SysprofCaptureFileHeader header;
gint64 end_time;
};
-#ifdef SP_ENABLE_GOBJECT
-G_DEFINE_BOXED_TYPE (SpCaptureReader, sp_capture_reader,
- sp_capture_reader_ref, sp_capture_reader_unref)
+#ifdef SYSPROF_ENABLE_GOBJECT
+G_DEFINE_BOXED_TYPE (SysprofCaptureReader, sysprof_capture_reader,
+ sysprof_capture_reader_ref, sysprof_capture_reader_unref)
#endif
static gboolean
-sp_capture_reader_read_file_header (SpCaptureReader *self,
- SpCaptureFileHeader *header,
+sysprof_capture_reader_read_file_header (SysprofCaptureReader *self,
+ SysprofCaptureFileHeader *header,
GError **error)
{
g_assert (self != NULL);
g_assert (header != NULL);
- if (sizeof *header != _sp_pread (self->fd, header, sizeof *header, 0L))
+ if (sizeof *header != _sysprof_pread (self->fd, header, sizeof *header, 0L))
{
g_set_error (error,
G_FILE_ERROR,
@@ -70,7 +70,7 @@ sp_capture_reader_read_file_header (SpCaptureReader *self,
return FALSE;
}
- if (header->magic != SP_CAPTURE_MAGIC)
+ if (header->magic != SYSPROF_CAPTURE_MAGIC)
{
g_set_error (error,
G_FILE_ERROR,
@@ -85,7 +85,7 @@ sp_capture_reader_read_file_header (SpCaptureReader *self,
}
static void
-sp_capture_reader_finalize (SpCaptureReader *self)
+sysprof_capture_reader_finalize (SysprofCaptureReader *self)
{
if (self != NULL)
{
@@ -97,7 +97,7 @@ sp_capture_reader_finalize (SpCaptureReader *self)
}
const gchar *
-sp_capture_reader_get_time (SpCaptureReader *self)
+sysprof_capture_reader_get_time (SysprofCaptureReader *self)
{
g_return_val_if_fail (self != NULL, NULL);
@@ -105,7 +105,7 @@ sp_capture_reader_get_time (SpCaptureReader *self)
}
const gchar *
-sp_capture_reader_get_filename (SpCaptureReader *self)
+sysprof_capture_reader_get_filename (SysprofCaptureReader *self)
{
g_return_val_if_fail (self != NULL, NULL);
@@ -113,7 +113,7 @@ sp_capture_reader_get_filename (SpCaptureReader *self)
}
/**
- * sp_capture_reader_new_from_fd:
+ * sysprof_capture_reader_new_from_fd:
* @fd: an fd to take ownership from
* @error: a location for a #GError or %NULL
*
@@ -121,28 +121,28 @@ sp_capture_reader_get_filename (SpCaptureReader *self)
*
* This is useful if you don't necessarily have access to the filename itself.
*
- * Returns: (transfer full): an #SpCaptureReader or %NULL upon failure.
+ * Returns: (transfer full): an #SysprofCaptureReader or %NULL upon failure.
*/
-SpCaptureReader *
-sp_capture_reader_new_from_fd (int fd,
+SysprofCaptureReader *
+sysprof_capture_reader_new_from_fd (int fd,
GError **error)
{
- SpCaptureReader *self;
+ SysprofCaptureReader *self;
g_assert (fd > -1);
- self = g_new0 (SpCaptureReader, 1);
+ self = g_new0 (SysprofCaptureReader, 1);
self->ref_count = 1;
self->bufsz = G_MAXUSHORT * 2;
self->buf = g_malloc (self->bufsz);
self->len = 0;
self->pos = 0;
self->fd = fd;
- self->fd_off = sizeof (SpCaptureFileHeader);
+ self->fd_off = sizeof (SysprofCaptureFileHeader);
- if (!sp_capture_reader_read_file_header (self, &self->header, error))
+ if (!sysprof_capture_reader_read_file_header (self, &self->header, error))
{
- sp_capture_reader_finalize (self);
+ sysprof_capture_reader_finalize (self);
return NULL;
}
@@ -154,11 +154,11 @@ sp_capture_reader_new_from_fd (int fd,
return self;
}
-SpCaptureReader *
-sp_capture_reader_new (const gchar *filename,
+SysprofCaptureReader *
+sysprof_capture_reader_new (const gchar *filename,
GError **error)
{
- SpCaptureReader *self;
+ SysprofCaptureReader *self;
int fd;
g_assert (filename != NULL);
@@ -172,7 +172,7 @@ sp_capture_reader_new (const gchar *filename,
return NULL;
}
- if (NULL == (self = sp_capture_reader_new_from_fd (fd, error)))
+ if (NULL == (self = sysprof_capture_reader_new_from_fd (fd, error)))
{
close (fd);
return NULL;
@@ -184,8 +184,8 @@ sp_capture_reader_new (const gchar *filename,
}
static inline void
-sp_capture_reader_bswap_frame (SpCaptureReader *self,
- SpCaptureFrame *frame)
+sysprof_capture_reader_bswap_frame (SysprofCaptureReader *self,
+ SysprofCaptureFrame *frame)
{
g_assert (self != NULL);
g_assert (frame!= NULL);
@@ -200,8 +200,8 @@ sp_capture_reader_bswap_frame (SpCaptureReader *self,
}
static inline void
-sp_capture_reader_bswap_map (SpCaptureReader *self,
- SpCaptureMap *map)
+sysprof_capture_reader_bswap_map (SysprofCaptureReader *self,
+ SysprofCaptureMap *map)
{
g_assert (self != NULL);
g_assert (map != NULL);
@@ -216,8 +216,8 @@ sp_capture_reader_bswap_map (SpCaptureReader *self,
}
static inline void
-sp_capture_reader_bswap_mark (SpCaptureReader *self,
- SpCaptureMark *mark)
+sysprof_capture_reader_bswap_mark (SysprofCaptureReader *self,
+ SysprofCaptureMark *mark)
{
g_assert (self != NULL);
g_assert (mark != NULL);
@@ -227,8 +227,8 @@ sp_capture_reader_bswap_mark (SpCaptureReader *self,
}
static inline void
-sp_capture_reader_bswap_jitmap (SpCaptureReader *self,
- SpCaptureJitmap *jitmap)
+sysprof_capture_reader_bswap_jitmap (SysprofCaptureReader *self,
+ SysprofCaptureJitmap *jitmap)
{
g_assert (self != NULL);
g_assert (jitmap != NULL);
@@ -238,7 +238,7 @@ sp_capture_reader_bswap_jitmap (SpCaptureReader *self,
}
static gboolean
-sp_capture_reader_ensure_space_for (SpCaptureReader *self,
+sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self,
gsize len)
{
g_assert (self != NULL);
@@ -260,7 +260,7 @@ sp_capture_reader_ensure_space_for (SpCaptureReader *self,
g_assert (self->len < self->bufsz);
/* Read into our buffer after our current read position */
- r = _sp_pread (self->fd,
+ r = _sysprof_pread (self->fd,
&self->buf[self->len],
self->bufsz - self->len,
self->fd_off);
@@ -277,56 +277,56 @@ sp_capture_reader_ensure_space_for (SpCaptureReader *self,
}
gboolean
-sp_capture_reader_skip (SpCaptureReader *self)
+sysprof_capture_reader_skip (SysprofCaptureReader *self)
{
- SpCaptureFrame *frame;
+ SysprofCaptureFrame *frame;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
- if (!sp_capture_reader_ensure_space_for (self, sizeof (SpCaptureFrame)))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof (SysprofCaptureFrame)))
return FALSE;
- frame = (SpCaptureFrame *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, frame);
+ frame = (SysprofCaptureFrame *)(gpointer)&self->buf[self->pos];
+ sysprof_capture_reader_bswap_frame (self, frame);
- if (frame->len < sizeof (SpCaptureFrame))
+ if (frame->len < sizeof (SysprofCaptureFrame))
return FALSE;
- if (!sp_capture_reader_ensure_space_for (self, frame->len))
+ if (!sysprof_capture_reader_ensure_space_for (self, frame->len))
return FALSE;
- frame = (SpCaptureFrame *)(gpointer)&self->buf[self->pos];
+ frame = (SysprofCaptureFrame *)(gpointer)&self->buf[self->pos];
self->pos += frame->len;
- if ((self->pos % SP_CAPTURE_ALIGN) != 0)
+ if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0)
return FALSE;
return TRUE;
}
gboolean
-sp_capture_reader_peek_frame (SpCaptureReader *self,
- SpCaptureFrame *frame)
+sysprof_capture_reader_peek_frame (SysprofCaptureReader *self,
+ SysprofCaptureFrame *frame)
{
- SpCaptureFrame *real_frame;
+ SysprofCaptureFrame *real_frame;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->len);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *real_frame))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *real_frame))
return FALSE;
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
- real_frame = (SpCaptureFrame *)(gpointer)&self->buf[self->pos];
+ real_frame = (SysprofCaptureFrame *)(gpointer)&self->buf[self->pos];
*frame = *real_frame;
- sp_capture_reader_bswap_frame (self, frame);
+ sysprof_capture_reader_bswap_frame (self, frame);
if (frame->time > self->end_time)
self->end_time = frame->time;
@@ -335,15 +335,15 @@ sp_capture_reader_peek_frame (SpCaptureReader *self,
}
gboolean
-sp_capture_reader_peek_type (SpCaptureReader *self,
- SpCaptureFrameType *type)
+sysprof_capture_reader_peek_type (SysprofCaptureReader *self,
+ SysprofCaptureFrameType *type)
{
- SpCaptureFrame frame;
+ SysprofCaptureFrame frame;
g_assert (self != NULL);
g_assert (type != NULL);
- if (!sp_capture_reader_peek_frame (self, &frame))
+ if (!sysprof_capture_reader_peek_frame (self, &frame))
return FALSE;
*type = frame.type;
@@ -351,24 +351,24 @@ sp_capture_reader_peek_type (SpCaptureReader *self,
return TRUE;
}
-static const SpCaptureFrame *
-sp_capture_reader_read_basic (SpCaptureReader *self,
- SpCaptureFrameType type,
+static const SysprofCaptureFrame *
+sysprof_capture_reader_read_basic (SysprofCaptureReader *self,
+ SysprofCaptureFrameType type,
gsize extra)
{
- SpCaptureFrame *frame;
+ SysprofCaptureFrame *frame;
gsize len = sizeof *frame + extra;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, len))
+ if (!sysprof_capture_reader_ensure_space_for (self, len))
return NULL;
- frame = (SpCaptureFrame *)(gpointer)&self->buf[self->pos];
+ frame = (SysprofCaptureFrame *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, frame);
+ sysprof_capture_reader_bswap_frame (self, frame);
if (frame->len < len)
return NULL;
@@ -381,29 +381,29 @@ sp_capture_reader_read_basic (SpCaptureReader *self,
return frame;
}
-const SpCaptureTimestamp *
-sp_capture_reader_read_timestamp (SpCaptureReader *self)
+const SysprofCaptureTimestamp *
+sysprof_capture_reader_read_timestamp (SysprofCaptureReader *self)
{
- return (SpCaptureTimestamp *)
- sp_capture_reader_read_basic (self, SP_CAPTURE_FRAME_TIMESTAMP, 0);
+ return (SysprofCaptureTimestamp *)
+ sysprof_capture_reader_read_basic (self, SYSPROF_CAPTURE_FRAME_TIMESTAMP, 0);
}
-const SpCaptureExit *
-sp_capture_reader_read_exit (SpCaptureReader *self)
+const SysprofCaptureExit *
+sysprof_capture_reader_read_exit (SysprofCaptureReader *self)
{
- return (SpCaptureExit *)
- sp_capture_reader_read_basic (self, SP_CAPTURE_FRAME_EXIT, 0);
+ return (SysprofCaptureExit *)
+ sysprof_capture_reader_read_basic (self, SYSPROF_CAPTURE_FRAME_EXIT, 0);
}
-const SpCaptureFork *
-sp_capture_reader_read_fork (SpCaptureReader *self)
+const SysprofCaptureFork *
+sysprof_capture_reader_read_fork (SysprofCaptureReader *self)
{
- SpCaptureFork *fk;
+ SysprofCaptureFork *fk;
g_assert (self != NULL);
- fk = (SpCaptureFork *)
- sp_capture_reader_read_basic (self, SP_CAPTURE_FRAME_FORK, sizeof(guint32));
+ fk = (SysprofCaptureFork *)
+ sysprof_capture_reader_read_basic (self, SYSPROF_CAPTURE_FRAME_FORK, sizeof(guint32));
if (fk != NULL)
{
@@ -414,78 +414,78 @@ sp_capture_reader_read_fork (SpCaptureReader *self)
return fk;
}
-const SpCaptureMap *
-sp_capture_reader_read_map (SpCaptureReader *self)
+const SysprofCaptureMap *
+sysprof_capture_reader_read_map (SysprofCaptureReader *self)
{
- SpCaptureMap *map;
+ SysprofCaptureMap *map;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *map))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *map))
return NULL;
- map = (SpCaptureMap *)(gpointer)&self->buf[self->pos];
+ map = (SysprofCaptureMap *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, &map->frame);
+ sysprof_capture_reader_bswap_frame (self, &map->frame);
- if (map->frame.type != SP_CAPTURE_FRAME_MAP)
+ if (map->frame.type != SYSPROF_CAPTURE_FRAME_MAP)
return NULL;
if (map->frame.len < (sizeof *map + 1))
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, map->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, map->frame.len))
return NULL;
- map = (SpCaptureMap *)(gpointer)&self->buf[self->pos];
+ map = (SysprofCaptureMap *)(gpointer)&self->buf[self->pos];
if (self->buf[self->pos + map->frame.len - 1] != '\0')
return NULL;
- sp_capture_reader_bswap_map (self, map);
+ sysprof_capture_reader_bswap_map (self, map);
self->pos += map->frame.len;
- if ((self->pos % SP_CAPTURE_ALIGN) != 0)
+ if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0)
return NULL;
return map;
}
-const SpCaptureMark *
-sp_capture_reader_read_mark (SpCaptureReader *self)
+const SysprofCaptureMark *
+sysprof_capture_reader_read_mark (SysprofCaptureReader *self)
{
- SpCaptureMark *mark;
+ SysprofCaptureMark *mark;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *mark))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *mark))
return NULL;
- mark = (SpCaptureMark *)(gpointer)&self->buf[self->pos];
+ mark = (SysprofCaptureMark *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, &mark->frame);
+ sysprof_capture_reader_bswap_frame (self, &mark->frame);
- if (mark->frame.type != SP_CAPTURE_FRAME_MARK)
+ if (mark->frame.type != SYSPROF_CAPTURE_FRAME_MARK)
return NULL;
if (mark->frame.len < (sizeof *mark + 1))
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, mark->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, mark->frame.len))
return NULL;
- mark = (SpCaptureMark *)(gpointer)&self->buf[self->pos];
+ mark = (SysprofCaptureMark *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_mark (self, mark);
+ sysprof_capture_reader_bswap_mark (self, mark);
self->pos += mark->frame.len;
- if ((self->pos % SP_CAPTURE_ALIGN) != 0)
+ if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0)
return NULL;
/* Ensure trailing \0 in name and message */
@@ -495,74 +495,74 @@ sp_capture_reader_read_mark (SpCaptureReader *self)
return mark;
}
-const SpCaptureProcess *
-sp_capture_reader_read_process (SpCaptureReader *self)
+const SysprofCaptureProcess *
+sysprof_capture_reader_read_process (SysprofCaptureReader *self)
{
- SpCaptureProcess *process;
+ SysprofCaptureProcess *process;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *process))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *process))
return NULL;
- process = (SpCaptureProcess *)(gpointer)&self->buf[self->pos];
+ process = (SysprofCaptureProcess *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, &process->frame);
+ sysprof_capture_reader_bswap_frame (self, &process->frame);
- if (process->frame.type != SP_CAPTURE_FRAME_PROCESS)
+ if (process->frame.type != SYSPROF_CAPTURE_FRAME_PROCESS)
return NULL;
if (process->frame.len < (sizeof *process + 1))
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, process->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, process->frame.len))
return NULL;
- process = (SpCaptureProcess *)(gpointer)&self->buf[self->pos];
+ process = (SysprofCaptureProcess *)(gpointer)&self->buf[self->pos];
if (self->buf[self->pos + process->frame.len - 1] != '\0')
return NULL;
self->pos += process->frame.len;
- if ((self->pos % SP_CAPTURE_ALIGN) != 0)
+ if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0)
return NULL;
return process;
}
GHashTable *
-sp_capture_reader_read_jitmap (SpCaptureReader *self)
+sysprof_capture_reader_read_jitmap (SysprofCaptureReader *self)
{
g_autoptr(GHashTable) ret = NULL;
- SpCaptureJitmap *jitmap;
+ SysprofCaptureJitmap *jitmap;
guint8 *buf;
guint8 *endptr;
guint i;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *jitmap))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *jitmap))
return NULL;
- jitmap = (SpCaptureJitmap *)(gpointer)&self->buf[self->pos];
+ jitmap = (SysprofCaptureJitmap *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, &jitmap->frame);
+ sysprof_capture_reader_bswap_frame (self, &jitmap->frame);
- if (jitmap->frame.type != SP_CAPTURE_FRAME_JITMAP)
+ if (jitmap->frame.type != SYSPROF_CAPTURE_FRAME_JITMAP)
return NULL;
if (jitmap->frame.len < sizeof *jitmap)
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, jitmap->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, jitmap->frame.len))
return NULL;
- jitmap = (SpCaptureJitmap *)(gpointer)&self->buf[self->pos];
+ jitmap = (SysprofCaptureJitmap *)(gpointer)&self->buf[self->pos];
ret = g_hash_table_new_full (NULL, NULL, NULL, g_free);
@@ -571,7 +571,7 @@ sp_capture_reader_read_jitmap (SpCaptureReader *self)
for (i = 0; i < jitmap->n_jitmaps; i++)
{
- SpCaptureAddress addr;
+ SysprofCaptureAddress addr;
const gchar *str;
if (buf + sizeof addr >= endptr)
@@ -592,30 +592,30 @@ sp_capture_reader_read_jitmap (SpCaptureReader *self)
g_hash_table_insert (ret, GSIZE_TO_POINTER (addr), g_strdup (str));
}
- sp_capture_reader_bswap_jitmap (self, jitmap);
+ sysprof_capture_reader_bswap_jitmap (self, jitmap);
self->pos += jitmap->frame.len;
return g_steal_pointer (&ret);
}
-const SpCaptureSample *
-sp_capture_reader_read_sample (SpCaptureReader *self)
+const SysprofCaptureSample *
+sysprof_capture_reader_read_sample (SysprofCaptureReader *self)
{
- SpCaptureSample *sample;
+ SysprofCaptureSample *sample;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *sample))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *sample))
return NULL;
- sample = (SpCaptureSample *)(gpointer)&self->buf[self->pos];
+ sample = (SysprofCaptureSample *)(gpointer)&self->buf[self->pos];
- sp_capture_reader_bswap_frame (self, &sample->frame);
+ sysprof_capture_reader_bswap_frame (self, &sample->frame);
- if (sample->frame.type != SP_CAPTURE_FRAME_SAMPLE)
+ if (sample->frame.type != SYSPROF_CAPTURE_FRAME_SAMPLE)
return NULL;
if (sample->frame.len < sizeof *sample)
@@ -624,13 +624,13 @@ sp_capture_reader_read_sample (SpCaptureReader *self)
if (self->endian != G_BYTE_ORDER)
sample->n_addrs = GUINT16_SWAP_LE_BE (sample->n_addrs);
- if (sample->frame.len < (sizeof *sample + (sizeof(SpCaptureAddress) * sample->n_addrs)))
+ if (sample->frame.len < (sizeof *sample + (sizeof(SysprofCaptureAddress) * sample->n_addrs)))
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, sample->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, sample->frame.len))
return NULL;
- sample = (SpCaptureSample *)(gpointer)&self->buf[self->pos];
+ sample = (SysprofCaptureSample *)(gpointer)&self->buf[self->pos];
if (G_UNLIKELY (self->endian != G_BYTE_ORDER))
{
@@ -645,21 +645,21 @@ sp_capture_reader_read_sample (SpCaptureReader *self)
return sample;
}
-const SpCaptureFrameCounterDefine *
-sp_capture_reader_read_counter_define (SpCaptureReader *self)
+const SysprofCaptureFrameCounterDefine *
+sysprof_capture_reader_read_counter_define (SysprofCaptureReader *self)
{
- SpCaptureFrameCounterDefine *def;
+ SysprofCaptureFrameCounterDefine *def;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *def))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *def))
return NULL;
- def = (SpCaptureFrameCounterDefine *)(gpointer)&self->buf[self->pos];
+ def = (SysprofCaptureFrameCounterDefine *)(gpointer)&self->buf[self->pos];
- if (def->frame.type != SP_CAPTURE_FRAME_CTRDEF)
+ if (def->frame.type != SYSPROF_CAPTURE_FRAME_CTRDEF)
return NULL;
if (def->frame.len < sizeof *def)
@@ -668,13 +668,13 @@ sp_capture_reader_read_counter_define (SpCaptureReader *self)
if (G_UNLIKELY (self->endian != G_BYTE_ORDER))
def->n_counters = GUINT16_SWAP_LE_BE (def->n_counters);
- if (def->frame.len < (sizeof *def + (sizeof (SpCaptureFrameCounterDefine) * def->n_counters)))
+ if (def->frame.len < (sizeof *def + (sizeof (SysprofCaptureFrameCounterDefine) * def->n_counters)))
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, def->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, def->frame.len))
return NULL;
- def = (SpCaptureFrameCounterDefine *)(gpointer)&self->buf[self->pos];
+ def = (SysprofCaptureFrameCounterDefine *)(gpointer)&self->buf[self->pos];
if (G_UNLIKELY (self->endian != G_BYTE_ORDER))
{
@@ -692,21 +692,21 @@ sp_capture_reader_read_counter_define (SpCaptureReader *self)
return def;
}
-const SpCaptureFrameCounterSet *
-sp_capture_reader_read_counter_set (SpCaptureReader *self)
+const SysprofCaptureFrameCounterSet *
+sysprof_capture_reader_read_counter_set (SysprofCaptureReader *self)
{
- SpCaptureFrameCounterSet *set;
+ SysprofCaptureFrameCounterSet *set;
g_assert (self != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
g_assert (self->pos <= self->bufsz);
- if (!sp_capture_reader_ensure_space_for (self, sizeof *set))
+ if (!sysprof_capture_reader_ensure_space_for (self, sizeof *set))
return NULL;
- set = (SpCaptureFrameCounterSet *)(gpointer)&self->buf[self->pos];
+ set = (SysprofCaptureFrameCounterSet *)(gpointer)&self->buf[self->pos];
- if (set->frame.type != SP_CAPTURE_FRAME_CTRSET)
+ if (set->frame.type != SYSPROF_CAPTURE_FRAME_CTRSET)
return NULL;
if (set->frame.len < sizeof *set)
@@ -715,13 +715,13 @@ sp_capture_reader_read_counter_set (SpCaptureReader *self)
if (self->endian != G_BYTE_ORDER)
set->n_values = GUINT16_SWAP_LE_BE (set->n_values);
- if (set->frame.len < (sizeof *set + (sizeof (SpCaptureCounterValues) * set->n_values)))
+ if (set->frame.len < (sizeof *set + (sizeof (SysprofCaptureCounterValues) * set->n_values)))
return NULL;
- if (!sp_capture_reader_ensure_space_for (self, set->frame.len))
+ if (!sysprof_capture_reader_ensure_space_for (self, set->frame.len))
return NULL;
- set = (SpCaptureFrameCounterSet *)(gpointer)&self->buf[self->pos];
+ set = (SysprofCaptureFrameCounterSet *)(gpointer)&self->buf[self->pos];
if (G_UNLIKELY (self->endian != G_BYTE_ORDER))
{
@@ -745,19 +745,19 @@ sp_capture_reader_read_counter_set (SpCaptureReader *self)
}
gboolean
-sp_capture_reader_reset (SpCaptureReader *self)
+sysprof_capture_reader_reset (SysprofCaptureReader *self)
{
g_assert (self != NULL);
- self->fd_off = sizeof (SpCaptureFileHeader);
+ self->fd_off = sizeof (SysprofCaptureFileHeader);
self->pos = 0;
self->len = 0;
return TRUE;
}
-SpCaptureReader *
-sp_capture_reader_ref (SpCaptureReader *self)
+SysprofCaptureReader *
+sysprof_capture_reader_ref (SysprofCaptureReader *self)
{
g_assert (self != NULL);
g_assert (self->ref_count > 0);
@@ -768,18 +768,18 @@ sp_capture_reader_ref (SpCaptureReader *self)
}
void
-sp_capture_reader_unref (SpCaptureReader *self)
+sysprof_capture_reader_unref (SysprofCaptureReader *self)
{
g_assert (self != NULL);
g_assert (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
- sp_capture_reader_finalize (self);
+ sysprof_capture_reader_finalize (self);
}
gboolean
-sp_capture_reader_splice (SpCaptureReader *self,
- SpCaptureWriter *dest,
+sysprof_capture_reader_splice (SysprofCaptureReader *self,
+ SysprofCaptureWriter *dest,
GError **error)
{
g_assert (self != NULL);
@@ -787,7 +787,7 @@ sp_capture_reader_splice (SpCaptureReader *self,
g_assert (dest != NULL);
/* Flush before writing anything to ensure consistency */
- if (!sp_capture_writer_flush (dest))
+ if (!sysprof_capture_writer_flush (dest))
{
g_set_error (error,
G_FILE_ERROR,
@@ -802,12 +802,12 @@ sp_capture_reader_splice (SpCaptureReader *self,
*/
/* Perform the splice */
- return _sp_capture_writer_splice_from_fd (dest, self->fd, error);
+ return _sysprof_capture_writer_splice_from_fd (dest, self->fd, error);
}
/**
- * sp_capture_reader_save_as:
- * @self: An #SpCaptureReader
+ * sysprof_capture_reader_save_as:
+ * @self: An #SysprofCaptureReader
* @filename: the file to save the capture as
* @error: a location for a #GError or %NULL.
*
@@ -817,7 +817,7 @@ sp_capture_reader_splice (SpCaptureReader *self,
* Returns: %TRUE on success; otherwise %FALSE and @error is set.
*/
gboolean
-sp_capture_reader_save_as (SpCaptureReader *self,
+sysprof_capture_reader_save_as (SysprofCaptureReader *self,
const gchar *filename,
GError **error)
{
@@ -848,7 +848,7 @@ sp_capture_reader_save_as (SpCaptureReader *self,
{
gssize written;
- written = _sp_sendfile (fd, self->fd, &in_off, to_write);
+ written = _sysprof_sendfile (fd, self->fd, &in_off, to_write);
if (written < 0)
goto handle_errno;
@@ -878,7 +878,7 @@ handle_errno:
}
gint64
-sp_capture_reader_get_start_time (SpCaptureReader *self)
+sysprof_capture_reader_get_start_time (SysprofCaptureReader *self)
{
g_return_val_if_fail (self != NULL, 0);
@@ -889,7 +889,7 @@ sp_capture_reader_get_start_time (SpCaptureReader *self)
}
/**
- * sp_capture_reader_get_end_time:
+ * sysprof_capture_reader_get_end_time:
*
* This function will return the end time for the capture, which is the
* same as the last event added to the capture.
@@ -904,7 +904,7 @@ sp_capture_reader_get_start_time (SpCaptureReader *self)
* Since: 3.22.1
*/
gint64
-sp_capture_reader_get_end_time (SpCaptureReader *self)
+sysprof_capture_reader_get_end_time (SysprofCaptureReader *self)
{
g_return_val_if_fail (self != NULL, 0);
@@ -919,7 +919,7 @@ sp_capture_reader_get_end_time (SpCaptureReader *self)
}
/**
- * sp_capture_reader_copy:
+ * sysprof_capture_reader_copy:
*
* This function makes a copy of the reader. Since readers use
* positioned reads with pread(), this allows you to have multiple
@@ -928,10 +928,10 @@ sp_capture_reader_get_end_time (SpCaptureReader *self)
*
* Returns: (transfer full): A copy of @self with a new file-descriptor.
*/
-SpCaptureReader *
-sp_capture_reader_copy (SpCaptureReader *self)
+SysprofCaptureReader *
+sysprof_capture_reader_copy (SysprofCaptureReader *self)
{
- SpCaptureReader *copy;
+ SysprofCaptureReader *copy;
int fd;
g_return_val_if_fail (self != NULL, NULL);
@@ -939,7 +939,7 @@ sp_capture_reader_copy (SpCaptureReader *self)
if (-1 == (fd = dup (self->fd)))
return NULL;
- copy = g_new0 (SpCaptureReader, 1);
+ copy = g_new0 (SysprofCaptureReader, 1);
*copy = *self;
diff --git a/src/libsysprof-capture/sysprof-capture-reader.h b/src/libsysprof-capture/sysprof-capture-reader.h
new file mode 100644
index 0000000..eece17b
--- /dev/null
+++ b/src/libsysprof-capture/sysprof-capture-reader.h
@@ -0,0 +1,91 @@
+/* sysprof-capture-reader.h
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include "sysprof-capture-types.h"
+#include "sysprof-version-macros.h"
+
+G_BEGIN_DECLS
+
+typedef struct _SysprofCaptureReader SysprofCaptureReader;
+
+SYSPROF_AVAILABLE_IN_ALL
+SysprofCaptureReader *sysprof_capture_reader_new (const gchar
*filename,
+ GError **error);
+SYSPROF_AVAILABLE_IN_ALL
+SysprofCaptureReader *sysprof_capture_reader_new_from_fd (int fd,
+ GError **error);
+SYSPROF_AVAILABLE_IN_ALL
+SysprofCaptureReader *sysprof_capture_reader_copy (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+SysprofCaptureReader *sysprof_capture_reader_ref (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_capture_reader_unref (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const gchar *sysprof_capture_reader_get_filename (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const gchar *sysprof_capture_reader_get_time (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+gint64 sysprof_capture_reader_get_start_time (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+gint64 sysprof_capture_reader_get_end_time (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_capture_reader_skip (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_capture_reader_peek_type (SysprofCaptureReader
*self,
+ SysprofCaptureFrameType *type);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_capture_reader_peek_frame (SysprofCaptureReader
*self,
+ SysprofCaptureFrame *frame);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureMap *sysprof_capture_reader_read_map (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureMark *sysprof_capture_reader_read_mark (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureExit *sysprof_capture_reader_read_exit (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureFork *sysprof_capture_reader_read_fork (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureTimestamp *sysprof_capture_reader_read_timestamp (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureProcess *sysprof_capture_reader_read_process (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureSample *sysprof_capture_reader_read_sample (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+GHashTable *sysprof_capture_reader_read_jitmap (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureFrameCounterDefine *sysprof_capture_reader_read_counter_define (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureFrameCounterSet *sysprof_capture_reader_read_counter_set (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_capture_reader_reset (SysprofCaptureReader
*self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_capture_reader_splice (SysprofCaptureReader
*self,
+ SysprofCaptureWriter *dest,
+ GError **error);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_capture_reader_save_as (SysprofCaptureReader
*self,
+ const gchar *filename,
+ GError **error);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCaptureReader, sysprof_capture_reader_unref)
+
+G_END_DECLS
diff --git a/src/libsysprof-capture/sysprof-capture-types.h b/src/libsysprof-capture/sysprof-capture-types.h
new file mode 100644
index 0000000..0a58337
--- /dev/null
+++ b/src/libsysprof-capture/sysprof-capture-types.h
@@ -0,0 +1,256 @@
+/* sysprof-capture-types.h
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib.h>
+
+#include "sysprof-clock.h"
+
+G_BEGIN_DECLS
+
+#define SYSPROF_CAPTURE_MAGIC (GUINT32_TO_LE(0xFDCA975E))
+#define SYSPROF_CAPTURE_ALIGN (sizeof(SysprofCaptureAddress))
+
+#if defined(_MSC_VER)
+# define SYSPROF_ALIGNED_BEGIN(_N) __declspec(align (_N))
+# define SYSPROF_ALIGNED_END(_N)
+#else
+# define SYSPROF_ALIGNED_BEGIN(_N)
+# define SYSPROF_ALIGNED_END(_N) __attribute__((aligned ((_N))))
+#endif
+
+#if GLIB_SIZEOF_VOID_P == 8
+# define SYSPROF_CAPTURE_JITMAP_MARK G_GUINT64_CONSTANT(0xE000000000000000)
+# define SYSPROF_CAPTURE_ADDRESS_FORMAT "0x%016lx"
+#elif GLIB_SIZEOF_VOID_P == 4
+# define SYSPROF_CAPTURE_JITMAP_MARK G_GUINT64_CONSTANT(0xE0000000)
+# define SYSPROF_CAPTURE_ADDRESS_FORMAT "0x%016llx"
+#else
+#error Unknown GLIB_SIZEOF_VOID_P
+#endif
+
+#define SYSPROF_CAPTURE_CURRENT_TIME (sysprof_clock_get_current_time())
+#define SYSPROF_CAPTURE_COUNTER_INT64 0
+#define SYSPROF_CAPTURE_COUNTER_DOUBLE 1
+
+typedef struct _SysprofCaptureReader SysprofCaptureReader;
+typedef struct _SysprofCaptureWriter SysprofCaptureWriter;
+typedef struct _SysprofCaptureCursor SysprofCaptureCursor;
+typedef struct _SysprofCaptureCondition SysprofCaptureCondition;
+
+typedef guint64 SysprofCaptureAddress;
+
+typedef union
+{
+ gint64 v64;
+ gdouble vdbl;
+} SysprofCaptureCounterValue;
+
+typedef enum
+{
+ SYSPROF_CAPTURE_FRAME_TIMESTAMP = 1,
+ SYSPROF_CAPTURE_FRAME_SAMPLE = 2,
+ SYSPROF_CAPTURE_FRAME_MAP = 3,
+ SYSPROF_CAPTURE_FRAME_PROCESS = 4,
+ SYSPROF_CAPTURE_FRAME_FORK = 5,
+ SYSPROF_CAPTURE_FRAME_EXIT = 6,
+ SYSPROF_CAPTURE_FRAME_JITMAP = 7,
+ SYSPROF_CAPTURE_FRAME_CTRDEF = 8,
+ SYSPROF_CAPTURE_FRAME_CTRSET = 9,
+ SYSPROF_CAPTURE_FRAME_MARK = 10,
+} SysprofCaptureFrameType;
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ guint32 magic;
+ guint32 version : 8;
+ guint32 little_endian : 1;
+ guint32 padding : 23;
+ gchar capture_time[64];
+ gint64 time;
+ gint64 end_time;
+ gchar suffix[168];
+} SysprofCaptureFileHeader
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ guint16 len;
+ gint16 cpu;
+ gint32 pid;
+ gint64 time;
+ guint32 type : 8;
+ guint32 padding1 : 24;
+ guint32 padding2;
+ guint8 data[0];
+} SysprofCaptureFrame
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ guint64 start;
+ guint64 end;
+ guint64 offset;
+ guint64 inode;
+ gchar filename[0];
+} SysprofCaptureMap
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ guint32 n_jitmaps;
+ guint8 data[0];
+} SysprofCaptureJitmap
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ gchar cmdline[0];
+} SysprofCaptureProcess
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ guint32 n_addrs : 16;
+ guint32 padding1 : 16;
+ gint32 tid;
+ SysprofCaptureAddress addrs[0];
+} SysprofCaptureSample
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ gint32 child_pid;
+} SysprofCaptureFork
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+} SysprofCaptureExit
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+} SysprofCaptureTimestamp
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ gchar category[32];
+ gchar name[32];
+ gchar description[52];
+ guint32 id : 24;
+ guint32 type : 8;
+ SysprofCaptureCounterValue value;
+} SysprofCaptureCounter
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ guint32 n_counters : 16;
+ guint32 padding1 : 16;
+ guint32 padding2;
+ SysprofCaptureCounter counters[0];
+} SysprofCaptureFrameCounterDefine
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ /*
+ * 96 bytes might seem a bit odd, but the counter frame header is 32
+ * bytes. So this makes a nice 2-cacheline aligned size which is
+ * useful when the number of counters is rather small.
+ */
+ guint32 ids[8];
+ SysprofCaptureCounterValue values[8];
+} SysprofCaptureCounterValues
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ guint32 n_values : 16;
+ guint32 padding1 : 16;
+ guint32 padding2;
+ SysprofCaptureCounterValues values[0];
+} SysprofCaptureFrameCounterSet
+SYSPROF_ALIGNED_END(1);
+
+SYSPROF_ALIGNED_BEGIN(1)
+typedef struct
+{
+ SysprofCaptureFrame frame;
+ gint64 duration;
+ gchar group[24];
+ gchar name[40];
+ gchar message[0];
+} SysprofCaptureMark
+SYSPROF_ALIGNED_END(1);
+
+G_STATIC_ASSERT (sizeof (SysprofCaptureFileHeader) == 256);
+G_STATIC_ASSERT (sizeof (SysprofCaptureFrame) == 24);
+G_STATIC_ASSERT (sizeof (SysprofCaptureMap) == 56);
+G_STATIC_ASSERT (sizeof (SysprofCaptureJitmap) == 28);
+G_STATIC_ASSERT (sizeof (SysprofCaptureProcess) == 24);
+G_STATIC_ASSERT (sizeof (SysprofCaptureSample) == 32);
+G_STATIC_ASSERT (sizeof (SysprofCaptureFork) == 28);
+G_STATIC_ASSERT (sizeof (SysprofCaptureExit) == 24);
+G_STATIC_ASSERT (sizeof (SysprofCaptureTimestamp) == 24);
+G_STATIC_ASSERT (sizeof (SysprofCaptureCounter) == 128);
+G_STATIC_ASSERT (sizeof (SysprofCaptureCounterValues) == 96);
+G_STATIC_ASSERT (sizeof (SysprofCaptureFrameCounterDefine) == 32);
+G_STATIC_ASSERT (sizeof (SysprofCaptureFrameCounterSet) == 32);
+G_STATIC_ASSERT (sizeof (SysprofCaptureMark) == 96);
+
+static inline gint
+sysprof_capture_address_compare (SysprofCaptureAddress a,
+ SysprofCaptureAddress b)
+{
+ if (a < b)
+ return -1;
+ if (a > b)
+ return 1;
+ else
+ return 0;
+}
+
+G_END_DECLS
diff --git a/src/libsysprof-capture/sp-capture-util-private.h
b/src/libsysprof-capture/sysprof-capture-util-private.h
similarity index 69%
rename from src/libsysprof-capture/sp-capture-util-private.h
rename to src/libsysprof-capture/sysprof-capture-util-private.h
index ab486d1..041ec97 100644
--- a/src/libsysprof-capture/sp-capture-util-private.h
+++ b/src/libsysprof-capture/sysprof-capture-util-private.h
@@ -1,4 +1,4 @@
-/* sp-capture-util-private.h
+/* sysprof-capture-util-private.h
*
* Copyright 2019 Christian Hergert <chergert redhat com>
*
@@ -29,27 +29,27 @@
#include <unistd.h>
#ifdef __linux__
-# define _sp_getpagesize() getpagesize()
-# define _sp_pread(a,b,c,d) pread(a,b,c,d)
-# define _sp_pwrite(a,b,c,d) pwrite(a,b,c,d)
-# define _sp_write(a,b,c) write(a,b,c)
-# define _sp_getpid() getpid()
-# define _sp_sendfile(a,b,c,d) sendfile(a,b,c,d)
+# define _sysprof_getpagesize() getpagesize()
+# define _sysprof_pread(a,b,c,d) pread(a,b,c,d)
+# define _sysprof_pwrite(a,b,c,d) pwrite(a,b,c,d)
+# define _sysprof_write(a,b,c) write(a,b,c)
+# define _sysprof_getpid() getpid()
+# define _sysprof_sendfile(a,b,c,d) sendfile(a,b,c,d)
#else
-size_t _sp_getpagesize (void);
-ssize_t _sp_pread (int fd,
+size_t _sysprof_getpagesize (void);
+ssize_t _sysprof_pread (int fd,
void *buf,
size_t count,
off_t offset);
-ssize_t _sp_pwrite (int fd,
+ssize_t _sysprof_pwrite (int fd,
const void *buf,
size_t count,
off_t offset);
-ssize_t _sp_write (int fd,
+ssize_t _sysprof_write (int fd,
const void *buf,
size_t count);
-gint32 _sp_getpid (void);
-ssize_t _sp_sendfile (int out_fd,
+gint32 _sysprof_getpid (void);
+ssize_t _sysprof_sendfile (int out_fd,
int in_fd,
off_t *offset,
size_t count);
diff --git a/src/libsysprof-capture/sp-capture-util.c b/src/libsysprof-capture/sysprof-capture-util.c
similarity index 84%
rename from src/libsysprof-capture/sp-capture-util.c
rename to src/libsysprof-capture/sysprof-capture-util.c
index ee02f49..e229b41 100644
--- a/src/libsysprof-capture/sp-capture-util.c
+++ b/src/libsysprof-capture/sysprof-capture-util.c
@@ -1,4 +1,4 @@
-/* sp-capture-util.c
+/* sysprof-capture-util.c
*
* Copyright 2019 Christian Hergert <chergert redhat com>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-capture-util"
+#define G_LOG_DOMAIN "sysprof-capture-util"
#include "config.h"
@@ -31,14 +31,14 @@
# include <windows.h>
#endif
-#include "sp-capture-util-private.h"
+#include "sysprof-capture-util-private.h"
#ifdef G_OS_WIN32
-static G_LOCK_DEFINE (_sp_io_sync);
+static G_LOCK_DEFINE (_sysprof_io_sync);
#endif
size_t
-(_sp_getpagesize) (void)
+(_sysprof_getpagesize) (void)
{
static size_t pgsz = 0;
@@ -57,7 +57,7 @@ size_t
}
ssize_t
-(_sp_pread) (int fd,
+(_sysprof_pread) (int fd,
void *buf,
size_t count,
off_t offset)
@@ -65,11 +65,11 @@ ssize_t
#ifdef G_OS_WIN32
ssize_t ret = -1;
- G_LOCK (_sp_io_sync);
+ G_LOCK (_sysprof_io_sync);
errno = 0;
if (lseek (fd, offset, SEEK_SET) != -1)
ret = read (fd, buf, count);
- G_UNLOCK (_sp_io_sync);
+ G_UNLOCK (_sysprof_io_sync);
return ret;
#else
@@ -79,7 +79,7 @@ ssize_t
}
ssize_t
-(_sp_pwrite) (int fd,
+(_sysprof_pwrite) (int fd,
const void *buf,
size_t count,
off_t offset)
@@ -87,11 +87,11 @@ ssize_t
#ifdef G_OS_WIN32
ssize_t ret = -1;
- G_LOCK (_sp_io_sync);
+ G_LOCK (_sysprof_io_sync);
errno = 0;
if (lseek (fd, offset, SEEK_SET) != -1)
ret = write (fd, buf, count);
- G_UNLOCK (_sp_io_sync);
+ G_UNLOCK (_sysprof_io_sync);
return ret;
#else
@@ -101,17 +101,17 @@ ssize_t
}
ssize_t
-(_sp_write) (int fd,
+(_sysprof_write) (int fd,
const void *buf,
size_t count)
{
#ifdef G_OS_WIN32
ssize_t ret = -1;
- G_LOCK (_sp_io_sync);
+ G_LOCK (_sysprof_io_sync);
errno = 0;
ret = write (fd, buf, count);
- G_UNLOCK (_sp_io_sync);
+ G_UNLOCK (_sysprof_io_sync);
return ret;
#else
@@ -121,7 +121,7 @@ ssize_t
}
gint32
-(_sp_getpid) (void)
+(_sysprof_getpid) (void)
{
#ifdef G_OS_WIN32
return _getpid ();
@@ -131,7 +131,7 @@ gint32
}
ssize_t
-(_sp_sendfile) (int out_fd,
+(_sysprof_sendfile) (int out_fd,
int in_fd,
off_t *offset,
size_t count)
@@ -163,7 +163,7 @@ ssize_t
to_read = count;
errno = 0;
- n_read = _sp_pread (in_fd, buf, to_read, rpos);
+ n_read = _sysprof_pread (in_fd, buf, to_read, rpos);
if (n_read <= 0)
return -1;
diff --git a/src/libsysprof-capture/sp-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c
similarity index 68%
rename from src/libsysprof-capture/sp-capture-writer.c
rename to src/libsysprof-capture/sysprof-capture-writer.c
index 2d0513d..30866b5 100644
--- a/src/libsysprof-capture/sp-capture-writer.c
+++ b/src/libsysprof-capture/sysprof-capture-writer.c
@@ -1,4 +1,4 @@
-/* sp-capture-writer.c
+/* sysprof-capture-writer.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-capture-writer"
+#define G_LOG_DOMAIN "sysprof-capture-writer"
#include "config.h"
@@ -35,11 +35,11 @@
#include <sys/types.h>
#include <unistd.h>
-#include "sp-capture-reader.h"
-#include "sp-capture-util-private.h"
-#include "sp-capture-writer.h"
+#include "sysprof-capture-reader.h"
+#include "sysprof-capture-util-private.h"
+#include "sysprof-capture-writer.h"
-#define DEFAULT_BUFFER_SIZE (_sp_getpagesize() * 64L)
+#define DEFAULT_BUFFER_SIZE (_sysprof_getpagesize() * 64L)
#define INVALID_ADDRESS (G_GUINT64_CONSTANT(0))
#define MAX_COUNTERS ((1 << 24) - 1)
@@ -50,9 +50,9 @@ typedef struct
/* The unique address for the string */
guint64 addr;
-} SpCaptureJitmapBucket;
+} SysprofCaptureJitmapBucket;
-struct _SpCaptureWriter
+struct _SysprofCaptureWriter
{
/*
* This is our buffer location for incoming strings. This is used
@@ -64,7 +64,7 @@ struct _SpCaptureWriter
gchar addr_buf[4096*4];
/* Our hashtable for deduplication. */
- SpCaptureJitmapBucket addr_hash[512];
+ SysprofCaptureJitmapBucket addr_hash[512];
/* We keep the large fields above so that our allocation will be page
* alinged for the write buffer. This improves the performance of large
@@ -101,21 +101,21 @@ struct _SpCaptureWriter
gint next_counter_id;
/* Statistics while recording */
- SpCaptureStat stat;
+ SysprofCaptureStat stat;
};
-#ifdef SP_ENABLE_GOBJECT
-G_DEFINE_BOXED_TYPE (SpCaptureWriter, sp_capture_writer,
- sp_capture_writer_ref, sp_capture_writer_unref)
+#ifdef SYSPROF_ENABLE_GOBJECT
+G_DEFINE_BOXED_TYPE (SysprofCaptureWriter, sysprof_capture_writer,
+ sysprof_capture_writer_ref, sysprof_capture_writer_unref)
#endif
static inline void
-sp_capture_writer_frame_init (SpCaptureFrame *frame_,
+sysprof_capture_writer_frame_init (SysprofCaptureFrame *frame_,
gint len,
gint cpu,
gint32 pid,
gint64 time_,
- SpCaptureFrameType type)
+ SysprofCaptureFrameType type)
{
g_assert (frame_ != NULL);
@@ -129,19 +129,19 @@ sp_capture_writer_frame_init (SpCaptureFrame *frame_,
}
static void
-sp_capture_writer_finalize (SpCaptureWriter *self)
+sysprof_capture_writer_finalize (SysprofCaptureWriter *self)
{
if (self != NULL)
{
- sp_capture_writer_flush (self);
+ sysprof_capture_writer_flush (self);
close (self->fd);
g_free (self->buf);
g_free (self);
}
}
-SpCaptureWriter *
-sp_capture_writer_ref (SpCaptureWriter *self)
+SysprofCaptureWriter *
+sysprof_capture_writer_ref (SysprofCaptureWriter *self)
{
g_assert (self != NULL);
g_assert (self->ref_count > 0);
@@ -152,17 +152,17 @@ sp_capture_writer_ref (SpCaptureWriter *self)
}
void
-sp_capture_writer_unref (SpCaptureWriter *self)
+sysprof_capture_writer_unref (SysprofCaptureWriter *self)
{
g_assert (self != NULL);
g_assert (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
- sp_capture_writer_finalize (self);
+ sysprof_capture_writer_finalize (self);
}
static gboolean
-sp_capture_writer_flush_data (SpCaptureWriter *self)
+sysprof_capture_writer_flush_data (SysprofCaptureWriter *self)
{
const guint8 *buf;
gssize written;
@@ -170,14 +170,14 @@ sp_capture_writer_flush_data (SpCaptureWriter *self)
g_assert (self != NULL);
g_assert (self->pos <= self->len);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
buf = self->buf;
to_write = self->pos;
while (to_write > 0)
{
- written = _sp_write (self->fd, buf, to_write);
+ written = _sysprof_write (self->fd, buf, to_write);
if (written < 0)
return FALSE;
@@ -196,13 +196,13 @@ sp_capture_writer_flush_data (SpCaptureWriter *self)
}
static inline void
-sp_capture_writer_realign (gsize *pos)
+sysprof_capture_writer_realign (gsize *pos)
{
- *pos = (*pos + SP_CAPTURE_ALIGN - 1) & ~(SP_CAPTURE_ALIGN - 1);
+ *pos = (*pos + SYSPROF_CAPTURE_ALIGN - 1) & ~(SYSPROF_CAPTURE_ALIGN - 1);
}
static inline gboolean
-sp_capture_writer_ensure_space_for (SpCaptureWriter *self,
+sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self,
gsize len)
{
/* Check for max frame size */
@@ -211,7 +211,7 @@ sp_capture_writer_ensure_space_for (SpCaptureWriter *self,
if ((self->len - self->pos) < len)
{
- if (!sp_capture_writer_flush_data (self))
+ if (!sysprof_capture_writer_flush_data (self))
return FALSE;
}
@@ -219,33 +219,33 @@ sp_capture_writer_ensure_space_for (SpCaptureWriter *self,
}
static inline gpointer
-sp_capture_writer_allocate (SpCaptureWriter *self,
+sysprof_capture_writer_allocate (SysprofCaptureWriter *self,
gsize *len)
{
gpointer p;
g_assert (self != NULL);
g_assert (len != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
- sp_capture_writer_realign (len);
+ sysprof_capture_writer_realign (len);
- if (!sp_capture_writer_ensure_space_for (self, *len))
+ if (!sysprof_capture_writer_ensure_space_for (self, *len))
return NULL;
p = (gpointer)&self->buf[self->pos];
self->pos += *len;
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
return p;
}
static gboolean
-sp_capture_writer_flush_jitmap (SpCaptureWriter *self)
+sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self)
{
- SpCaptureJitmap jitmap;
+ SysprofCaptureJitmap jitmap;
gssize r;
gsize len;
@@ -258,20 +258,20 @@ sp_capture_writer_flush_jitmap (SpCaptureWriter *self)
len = sizeof jitmap + self->addr_buf_pos;
- sp_capture_writer_realign (&len);
+ sysprof_capture_writer_realign (&len);
- sp_capture_writer_frame_init (&jitmap.frame,
+ sysprof_capture_writer_frame_init (&jitmap.frame,
len,
-1,
- _sp_getpid (),
- SP_CAPTURE_CURRENT_TIME,
- SP_CAPTURE_FRAME_JITMAP);
+ _sysprof_getpid (),
+ SYSPROF_CAPTURE_CURRENT_TIME,
+ SYSPROF_CAPTURE_FRAME_JITMAP);
jitmap.n_jitmaps = self->addr_hash_size;
- if (sizeof jitmap != _sp_write (self->fd, &jitmap, sizeof jitmap))
+ if (sizeof jitmap != _sysprof_write (self->fd, &jitmap, sizeof jitmap))
return FALSE;
- r = _sp_write (self->fd, self->addr_buf, len - sizeof jitmap);
+ r = _sysprof_write (self->fd, self->addr_buf, len - sizeof jitmap);
if (r < 0 || (gsize)r != (len - sizeof jitmap))
return FALSE;
@@ -279,15 +279,15 @@ sp_capture_writer_flush_jitmap (SpCaptureWriter *self)
self->addr_hash_size = 0;
memset (self->addr_hash, 0, sizeof self->addr_hash);
- self->stat.frame_count[SP_CAPTURE_FRAME_JITMAP]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_JITMAP]++;
return TRUE;
}
static gboolean
-sp_capture_writer_lookup_jitmap (SpCaptureWriter *self,
+sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
const gchar *name,
- SpCaptureAddress *addr)
+ SysprofCaptureAddress *addr)
{
guint hash;
guint i;
@@ -300,7 +300,7 @@ sp_capture_writer_lookup_jitmap (SpCaptureWriter *self,
for (i = hash; i < G_N_ELEMENTS (self->addr_hash); i++)
{
- SpCaptureJitmapBucket *bucket = &self->addr_hash[i];
+ SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i];
if (bucket->str == NULL)
return FALSE;
@@ -314,7 +314,7 @@ sp_capture_writer_lookup_jitmap (SpCaptureWriter *self,
for (i = 0; i < hash; i++)
{
- SpCaptureJitmapBucket *bucket = &self->addr_hash[i];
+ SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i];
if (bucket->str == NULL)
return FALSE;
@@ -329,11 +329,11 @@ sp_capture_writer_lookup_jitmap (SpCaptureWriter *self,
return FALSE;
}
-static SpCaptureAddress
-sp_capture_writer_insert_jitmap (SpCaptureWriter *self,
+static SysprofCaptureAddress
+sysprof_capture_writer_insert_jitmap (SysprofCaptureWriter *self,
const gchar *str)
{
- SpCaptureAddress addr;
+ SysprofCaptureAddress addr;
gchar *dst;
gsize len;
guint hash;
@@ -341,14 +341,14 @@ sp_capture_writer_insert_jitmap (SpCaptureWriter *self,
g_assert (self != NULL);
g_assert (str != NULL);
- g_assert ((self->pos % SP_CAPTURE_ALIGN) == 0);
+ g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
len = sizeof addr + strlen (str) + 1;
if ((self->addr_hash_size == G_N_ELEMENTS (self->addr_hash)) ||
((sizeof self->addr_buf - self->addr_buf_pos) < len))
{
- if (!sp_capture_writer_flush_jitmap (self))
+ if (!sysprof_capture_writer_flush_jitmap (self))
return INVALID_ADDRESS;
g_assert (self->addr_hash_size == 0);
@@ -359,7 +359,7 @@ sp_capture_writer_insert_jitmap (SpCaptureWriter *self,
g_assert (len > sizeof addr);
/* Allocate the next unique address */
- addr = SP_CAPTURE_JITMAP_MARK | ++self->addr_seq;
+ addr = SYSPROF_CAPTURE_JITMAP_MARK | ++self->addr_seq;
/* Copy the address into the buffer */
dst = (gchar *)&self->addr_buf[self->addr_buf_pos];
@@ -382,7 +382,7 @@ sp_capture_writer_insert_jitmap (SpCaptureWriter *self,
/* Start from the current hash bucket and go forward */
for (i = hash; i < G_N_ELEMENTS (self->addr_hash); i++)
{
- SpCaptureJitmapBucket *bucket = &self->addr_hash[i];
+ SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i];
if (G_LIKELY (bucket->str == NULL))
{
@@ -396,7 +396,7 @@ sp_capture_writer_insert_jitmap (SpCaptureWriter *self,
/* Wrap around to the beginning */
for (i = 0; i < hash; i++)
{
- SpCaptureJitmapBucket *bucket = &self->addr_hash[i];
+ SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i];
if (G_LIKELY (bucket->str == NULL))
{
@@ -412,13 +412,13 @@ sp_capture_writer_insert_jitmap (SpCaptureWriter *self,
return INVALID_ADDRESS;
}
-SpCaptureWriter *
-sp_capture_writer_new_from_fd (int fd,
+SysprofCaptureWriter *
+sysprof_capture_writer_new_from_fd (int fd,
gsize buffer_size)
{
g_autofree gchar *nowstr = NULL;
- SpCaptureWriter *self;
- SpCaptureFileHeader *header;
+ SysprofCaptureWriter *self;
+ SysprofCaptureFileHeader *header;
GTimeVal tv;
gsize header_len = sizeof(*header);
@@ -429,12 +429,12 @@ sp_capture_writer_new_from_fd (int fd,
buffer_size = DEFAULT_BUFFER_SIZE;
g_assert (fd != -1);
- g_assert (buffer_size % _sp_getpagesize() == 0);
+ g_assert (buffer_size % _sysprof_getpagesize() == 0);
if (ftruncate (fd, 0) != 0)
return NULL;
- self = g_new0 (SpCaptureWriter, 1);
+ self = g_new0 (SysprofCaptureWriter, 1);
self->ref_count = 1;
self->fd = fd;
self->buf = (guint8 *)g_malloc0 (buffer_size);
@@ -444,15 +444,15 @@ sp_capture_writer_new_from_fd (int fd,
g_get_current_time (&tv);
nowstr = g_time_val_to_iso8601 (&tv);
- header = sp_capture_writer_allocate (self, &header_len);
+ header = sysprof_capture_writer_allocate (self, &header_len);
if (header == NULL)
{
- sp_capture_writer_finalize (self);
+ sysprof_capture_writer_finalize (self);
return NULL;
}
- header->magic = SP_CAPTURE_MAGIC;
+ header->magic = SYSPROF_CAPTURE_MAGIC;
header->version = 1;
#ifdef G_LITTLE_ENDIAN
header->little_endian = TRUE;
@@ -461,19 +461,19 @@ sp_capture_writer_new_from_fd (int fd,
#endif
header->padding = 0;
g_strlcpy (header->capture_time, nowstr, sizeof header->capture_time);
- header->time = SP_CAPTURE_CURRENT_TIME;
+ header->time = SYSPROF_CAPTURE_CURRENT_TIME;
header->end_time = 0;
memset (header->suffix, 0, sizeof header->suffix);
- if (!sp_capture_writer_flush_data (self))
+ if (!sysprof_capture_writer_flush_data (self))
{
- sp_capture_writer_finalize (self);
+ sysprof_capture_writer_finalize (self);
return NULL;
}
g_assert (self->pos == 0);
g_assert (self->len > 0);
- g_assert (self->len % _sp_getpagesize() == 0);
+ g_assert (self->len % _sysprof_getpagesize() == 0);
g_assert (self->buf != NULL);
g_assert (self->addr_hash_size == 0);
g_assert (self->fd != -1);
@@ -481,21 +481,21 @@ sp_capture_writer_new_from_fd (int fd,
return self;
}
-SpCaptureWriter *
-sp_capture_writer_new (const gchar *filename,
+SysprofCaptureWriter *
+sysprof_capture_writer_new (const gchar *filename,
gsize buffer_size)
{
- SpCaptureWriter *self;
+ SysprofCaptureWriter *self;
int fd;
g_assert (filename != NULL);
- g_assert (buffer_size % _sp_getpagesize() == 0);
+ g_assert (buffer_size % _sysprof_getpagesize() == 0);
if ((-1 == (fd = open (filename, O_CREAT | O_RDWR, 0640))) ||
(-1 == ftruncate (fd, 0L)))
return NULL;
- self = sp_capture_writer_new_from_fd (fd, buffer_size);
+ self = sysprof_capture_writer_new_from_fd (fd, buffer_size);
if (self == NULL)
close (fd);
@@ -504,7 +504,7 @@ sp_capture_writer_new (const gchar *filename,
}
gboolean
-sp_capture_writer_add_map (SpCaptureWriter *self,
+sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
@@ -514,7 +514,7 @@ sp_capture_writer_add_map (SpCaptureWriter *self,
guint64 inode,
const gchar *filename)
{
- SpCaptureMap *ev;
+ SysprofCaptureMap *ev;
gsize len;
if (filename == NULL)
@@ -525,16 +525,16 @@ sp_capture_writer_add_map (SpCaptureWriter *self,
len = sizeof *ev + strlen (filename) + 1;
- ev = (SpCaptureMap *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureMap *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_MAP);
+ SYSPROF_CAPTURE_FRAME_MAP);
ev->start = start;
ev->end = end;
ev->offset = offset;
@@ -543,13 +543,13 @@ sp_capture_writer_add_map (SpCaptureWriter *self,
g_strlcpy (ev->filename, filename, len - sizeof *ev);
ev->filename[len - sizeof *ev - 1] = '\0';
- self->stat.frame_count[SP_CAPTURE_FRAME_MAP]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MAP]++;
return TRUE;
}
gboolean
-sp_capture_writer_add_mark (SpCaptureWriter *self,
+sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
@@ -558,7 +558,7 @@ sp_capture_writer_add_mark (SpCaptureWriter *self,
const gchar *name,
const gchar *message)
{
- SpCaptureMark *ev;
+ SysprofCaptureMark *ev;
gsize message_len;
gsize len;
@@ -571,32 +571,32 @@ sp_capture_writer_add_mark (SpCaptureWriter *self,
message_len = strlen (message) + 1;
len = sizeof *ev + message_len;
- ev = (SpCaptureMark *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureMark *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_MARK);
+ SYSPROF_CAPTURE_FRAME_MARK);
ev->duration = duration;
g_strlcpy (ev->group, group, sizeof ev->group);
g_strlcpy (ev->name, name, sizeof ev->name);
memcpy (ev->message, message, message_len);
- self->stat.frame_count[SP_CAPTURE_FRAME_MARK]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MARK]++;
return TRUE;
}
-SpCaptureAddress
-sp_capture_writer_add_jitmap (SpCaptureWriter *self,
+SysprofCaptureAddress
+sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
const gchar *name)
{
- SpCaptureAddress addr = INVALID_ADDRESS;
+ SysprofCaptureAddress addr = INVALID_ADDRESS;
if (name == NULL)
name = "";
@@ -604,20 +604,20 @@ sp_capture_writer_add_jitmap (SpCaptureWriter *self,
g_assert (self != NULL);
g_assert (name != NULL);
- if (!sp_capture_writer_lookup_jitmap (self, name, &addr))
- addr = sp_capture_writer_insert_jitmap (self, name);
+ if (!sysprof_capture_writer_lookup_jitmap (self, name, &addr))
+ addr = sysprof_capture_writer_insert_jitmap (self, name);
return addr;
}
gboolean
-sp_capture_writer_add_process (SpCaptureWriter *self,
+sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
const gchar *cmdline)
{
- SpCaptureProcess *ev;
+ SysprofCaptureProcess *ev;
gsize len;
if (cmdline == NULL)
@@ -628,148 +628,148 @@ sp_capture_writer_add_process (SpCaptureWriter *self,
len = sizeof *ev + strlen (cmdline) + 1;
- ev = (SpCaptureProcess *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureProcess *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_PROCESS);
+ SYSPROF_CAPTURE_FRAME_PROCESS);
g_strlcpy (ev->cmdline, cmdline, len - sizeof *ev);
ev->cmdline[len - sizeof *ev - 1] = '\0';
- self->stat.frame_count[SP_CAPTURE_FRAME_PROCESS]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_PROCESS]++;
return TRUE;
}
gboolean
-sp_capture_writer_add_sample (SpCaptureWriter *self,
+sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
gint32 tid,
- const SpCaptureAddress *addrs,
+ const SysprofCaptureAddress *addrs,
guint n_addrs)
{
- SpCaptureSample *ev;
+ SysprofCaptureSample *ev;
gsize len;
g_assert (self != NULL);
- len = sizeof *ev + (n_addrs * sizeof (SpCaptureAddress));
+ len = sizeof *ev + (n_addrs * sizeof (SysprofCaptureAddress));
- ev = (SpCaptureSample *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureSample *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_SAMPLE);
+ SYSPROF_CAPTURE_FRAME_SAMPLE);
ev->n_addrs = n_addrs;
ev->tid = tid;
- memcpy (ev->addrs, addrs, (n_addrs * sizeof (SpCaptureAddress)));
+ memcpy (ev->addrs, addrs, (n_addrs * sizeof (SysprofCaptureAddress)));
- self->stat.frame_count[SP_CAPTURE_FRAME_SAMPLE]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE]++;
return TRUE;
}
gboolean
-sp_capture_writer_add_fork (SpCaptureWriter *self,
+sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
gint32 child_pid)
{
- SpCaptureFork *ev;
+ SysprofCaptureFork *ev;
gsize len = sizeof *ev;
g_assert (self != NULL);
- ev = (SpCaptureFork *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureFork *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_FORK);
+ SYSPROF_CAPTURE_FRAME_FORK);
ev->child_pid = child_pid;
- self->stat.frame_count[SP_CAPTURE_FRAME_FORK]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]++;
return TRUE;
}
gboolean
-sp_capture_writer_add_exit (SpCaptureWriter *self,
+sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid)
{
- SpCaptureExit *ev;
+ SysprofCaptureExit *ev;
gsize len = sizeof *ev;
g_assert (self != NULL);
- ev = (SpCaptureExit *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureExit *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_EXIT);
+ SYSPROF_CAPTURE_FRAME_EXIT);
- self->stat.frame_count[SP_CAPTURE_FRAME_EXIT]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]++;
return TRUE;
}
gboolean
-sp_capture_writer_add_timestamp (SpCaptureWriter *self,
+sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid)
{
- SpCaptureTimestamp *ev;
+ SysprofCaptureTimestamp *ev;
gsize len = sizeof *ev;
g_assert (self != NULL);
- ev = (SpCaptureTimestamp *)sp_capture_writer_allocate (self, &len);
+ ev = (SysprofCaptureTimestamp *)sysprof_capture_writer_allocate (self, &len);
if (!ev)
return FALSE;
- sp_capture_writer_frame_init (&ev->frame,
+ sysprof_capture_writer_frame_init (&ev->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_TIMESTAMP);
+ SYSPROF_CAPTURE_FRAME_TIMESTAMP);
- self->stat.frame_count[SP_CAPTURE_FRAME_TIMESTAMP]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_TIMESTAMP]++;
return TRUE;
}
static gboolean
-sp_capture_writer_flush_end_time (SpCaptureWriter *self)
+sysprof_capture_writer_flush_end_time (SysprofCaptureWriter *self)
{
- gint64 end_time = SP_CAPTURE_CURRENT_TIME;
+ gint64 end_time = SYSPROF_CAPTURE_CURRENT_TIME;
ssize_t ret;
g_assert (self != NULL);
@@ -777,10 +777,10 @@ sp_capture_writer_flush_end_time (SpCaptureWriter *self)
/* This field is opportunistic, so a failure is okay. */
again:
- ret = _sp_pwrite (self->fd,
+ ret = _sysprof_pwrite (self->fd,
&end_time,
sizeof (end_time),
- G_STRUCT_OFFSET (SpCaptureFileHeader, end_time));
+ G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time));
if (ret < 0 && errno == EAGAIN)
goto again;
@@ -789,18 +789,18 @@ again:
}
gboolean
-sp_capture_writer_flush (SpCaptureWriter *self)
+sysprof_capture_writer_flush (SysprofCaptureWriter *self)
{
g_assert (self != NULL);
- return (sp_capture_writer_flush_jitmap (self) &&
- sp_capture_writer_flush_data (self) &&
- sp_capture_writer_flush_end_time (self));
+ return (sysprof_capture_writer_flush_jitmap (self) &&
+ sysprof_capture_writer_flush_data (self) &&
+ sysprof_capture_writer_flush_end_time (self));
}
/**
- * sp_capture_writer_save_as:
- * @self: A #SpCaptureWriter
+ * sysprof_capture_writer_save_as:
+ * @self: A #SysprofCaptureWriter
* @filename: the file to save the capture as
* @error: a location for a #GError or %NULL.
*
@@ -812,7 +812,7 @@ sp_capture_writer_flush (SpCaptureWriter *self)
* Returns: %TRUE if successful, otherwise %FALSE and @error is set.
*/
gboolean
-sp_capture_writer_save_as (SpCaptureWriter *self,
+sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
const gchar *filename,
GError **error)
{
@@ -828,7 +828,7 @@ sp_capture_writer_save_as (SpCaptureWriter *self,
if (-1 == (fd = open (filename, O_CREAT | O_RDWR, 0640)))
goto handle_errno;
- if (!sp_capture_writer_flush (self))
+ if (!sysprof_capture_writer_flush (self))
goto handle_errno;
if (-1 == (pos = lseek (self->fd, 0L, SEEK_CUR)))
@@ -841,7 +841,7 @@ sp_capture_writer_save_as (SpCaptureWriter *self,
{
gssize written;
- written = _sp_sendfile (fd, self->fd, &in_off, pos);
+ written = _sysprof_sendfile (fd, self->fd, &in_off, pos);
if (written < 0)
goto handle_errno;
@@ -874,23 +874,23 @@ handle_errno:
}
/**
- * _sp_capture_writer_splice_from_fd:
- * @self: An #SpCaptureWriter
+ * _sysprof_capture_writer_splice_from_fd:
+ * @self: An #SysprofCaptureWriter
* @fd: the fd to read from.
* @error: A location for a #GError, or %NULL.
*
- * This is internal API for SpCaptureWriter and SpCaptureReader to
+ * This is internal API for SysprofCaptureWriter and SysprofCaptureReader to
* communicate when splicing a reader into a writer.
*
- * This should not be used outside of #SpCaptureReader or
- * #SpCaptureWriter.
+ * This should not be used outside of #SysprofCaptureReader or
+ * #SysprofCaptureWriter.
*
* This will not advance the position of @fd.
*
* Returns: %TRUE if successful; otherwise %FALSE and @error is set.
*/
gboolean
-_sp_capture_writer_splice_from_fd (SpCaptureWriter *self,
+_sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
int fd,
GError **error)
{
@@ -920,7 +920,7 @@ _sp_capture_writer_splice_from_fd (SpCaptureWriter *self,
{
gssize written;
- written = _sp_sendfile (self->fd, fd, &in_off, to_write);
+ written = _sysprof_sendfile (self->fd, fd, &in_off, to_write);
if (written < 0)
goto handle_errno;
@@ -945,9 +945,9 @@ handle_errno:
}
/**
- * sp_capture_writer_splice:
- * @self: An #SpCaptureWriter
- * @dest: An #SpCaptureWriter
+ * sysprof_capture_writer_splice:
+ * @self: An #SysprofCaptureWriter
+ * @dest: An #SysprofCaptureWriter
* @error: A location for a #GError, or %NULL.
*
* This function will copy the capture @self into the capture @dest. This
@@ -958,8 +958,8 @@ handle_errno:
* Returns: %TRUE if successful, otherwise %FALSE and and @error is set.
*/
gboolean
-sp_capture_writer_splice (SpCaptureWriter *self,
- SpCaptureWriter *dest,
+sysprof_capture_writer_splice (SysprofCaptureWriter *self,
+ SysprofCaptureWriter *dest,
GError **error)
{
gboolean ret;
@@ -971,7 +971,7 @@ sp_capture_writer_splice (SpCaptureWriter *self,
g_assert (dest->fd != -1);
/* Flush before writing anything to ensure consistency */
- if (!sp_capture_writer_flush (self) || !sp_capture_writer_flush (dest))
+ if (!sysprof_capture_writer_flush (self) || !sysprof_capture_writer_flush (dest))
goto handle_errno;
/* Track our current position so we can reset */
@@ -979,7 +979,7 @@ sp_capture_writer_splice (SpCaptureWriter *self,
goto handle_errno;
/* Perform the splice */
- ret = _sp_capture_writer_splice_from_fd (dest, self->fd, error);
+ ret = _sysprof_capture_writer_splice_from_fd (dest, self->fd, error);
/* Now reset or file-descriptor position (it should be the same */
if (pos != lseek (self->fd, pos, SEEK_SET))
@@ -1000,21 +1000,21 @@ handle_errno:
}
/**
- * sp_capture_writer_create_reader:
- * @self: A #SpCaptureWriter
+ * sysprof_capture_writer_create_reader:
+ * @self: A #SysprofCaptureWriter
* @error: a location for a #GError, or %NULL
*
* Creates a new reader for the writer.
*
* Since readers use positioned reads, this uses the same file-descriptor for
- * the #SpCaptureReader. Therefore, if you are writing to the capture while
+ * the #SysprofCaptureReader. Therefore, if you are writing to the capture while
* also consuming from the reader, you could get transient failures unless you
* synchronize the operations.
*
- * Returns: (transfer full): A #SpCaptureReader.
+ * Returns: (transfer full): A #SysprofCaptureReader.
*/
-SpCaptureReader *
-sp_capture_writer_create_reader (SpCaptureWriter *self,
+SysprofCaptureReader *
+sysprof_capture_writer_create_reader (SysprofCaptureWriter *self,
GError **error)
{
int copy;
@@ -1022,7 +1022,7 @@ sp_capture_writer_create_reader (SpCaptureWriter *self,
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->fd != -1, NULL);
- if (!sp_capture_writer_flush (self))
+ if (!sysprof_capture_writer_flush (self))
{
g_set_error (error,
G_FILE_ERROR,
@@ -1038,20 +1038,20 @@ sp_capture_writer_create_reader (SpCaptureWriter *self,
if (-1 == (copy = dup (self->fd)))
return NULL;
- return sp_capture_reader_new_from_fd (copy, error);
+ return sysprof_capture_reader_new_from_fd (copy, error);
}
/**
- * sp_capture_writer_stat:
- * @self: A #SpCaptureWriter
- * @stat: (out): A location for an #SpCaptureStat
+ * sysprof_capture_writer_stat:
+ * @self: A #SysprofCaptureWriter
+ * @stat: (out): A location for an #SysprofCaptureStat
*
* This function will fill @stat with statistics generated while capturing
* the profiler session.
*/
void
-sp_capture_writer_stat (SpCaptureWriter *self,
- SpCaptureStat *stat)
+sysprof_capture_writer_stat (SysprofCaptureWriter *self,
+ SysprofCaptureStat *stat)
{
g_return_if_fail (self != NULL);
g_return_if_fail (stat != NULL);
@@ -1060,14 +1060,14 @@ sp_capture_writer_stat (SpCaptureWriter *self,
}
gboolean
-sp_capture_writer_define_counters (SpCaptureWriter *self,
+sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
- const SpCaptureCounter *counters,
+ const SysprofCaptureCounter *counters,
guint n_counters)
{
- SpCaptureFrameCounterDefine *def;
+ SysprofCaptureFrameCounterDefine *def;
gsize len;
guint i;
@@ -1079,16 +1079,16 @@ sp_capture_writer_define_counters (SpCaptureWriter *self,
len = sizeof *def + (sizeof *counters * n_counters);
- def = (SpCaptureFrameCounterDefine *)sp_capture_writer_allocate (self, &len);
+ def = (SysprofCaptureFrameCounterDefine *)sysprof_capture_writer_allocate (self, &len);
if (!def)
return FALSE;
- sp_capture_writer_frame_init (&def->frame,
+ sysprof_capture_writer_frame_init (&def->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_CTRDEF);
+ SYSPROF_CAPTURE_FRAME_CTRDEF);
def->padding1 = 0;
def->padding2 = 0;
def->n_counters = n_counters;
@@ -1104,21 +1104,21 @@ sp_capture_writer_define_counters (SpCaptureWriter *self,
def->counters[i] = counters[i];
}
- self->stat.frame_count[SP_CAPTURE_FRAME_CTRDEF]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRDEF]++;
return TRUE;
}
gboolean
-sp_capture_writer_set_counters (SpCaptureWriter *self,
+sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
const guint *counters_ids,
- const SpCaptureCounterValue *values,
+ const SysprofCaptureCounterValue *values,
guint n_counters)
{
- SpCaptureFrameCounterSet *set;
+ SysprofCaptureFrameCounterSet *set;
gsize len;
guint n_groups;
guint group;
@@ -1137,20 +1137,20 @@ sp_capture_writer_set_counters (SpCaptureWriter *self,
if ((n_groups * G_N_ELEMENTS (set->values[0].values)) != n_counters)
n_groups++;
- len = sizeof *set + (n_groups * sizeof (SpCaptureCounterValues));
+ len = sizeof *set + (n_groups * sizeof (SysprofCaptureCounterValues));
- set = (SpCaptureFrameCounterSet *)sp_capture_writer_allocate (self, &len);
+ set = (SysprofCaptureFrameCounterSet *)sysprof_capture_writer_allocate (self, &len);
if (!set)
return FALSE;
memset (set, 0, len);
- sp_capture_writer_frame_init (&set->frame,
+ sysprof_capture_writer_frame_init (&set->frame,
len,
cpu,
pid,
time,
- SP_CAPTURE_FRAME_CTRSET);
+ SYSPROF_CAPTURE_FRAME_CTRSET);
set->padding1 = 0;
set->padding2 = 0;
set->n_values = n_groups;
@@ -1169,13 +1169,13 @@ sp_capture_writer_set_counters (SpCaptureWriter *self,
}
}
- self->stat.frame_count[SP_CAPTURE_FRAME_CTRSET]++;
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRSET]++;
return TRUE;
}
/**
- * sp_capture_writer_request_counter:
+ * sysprof_capture_writer_request_counter:
*
* This requests a series of counter identifiers for the capture.
*
@@ -1188,7 +1188,7 @@ sp_capture_writer_set_counters (SpCaptureWriter *self,
* Returns: The next series of counter values or zero on failure.
*/
guint
-sp_capture_writer_request_counter (SpCaptureWriter *self,
+sysprof_capture_writer_request_counter (SysprofCaptureWriter *self,
guint n_counters)
{
gint ret;
@@ -1205,7 +1205,7 @@ sp_capture_writer_request_counter (SpCaptureWriter *self,
}
gboolean
-_sp_capture_writer_set_time_range (SpCaptureWriter *self,
+_sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self,
gint64 start_time,
gint64 end_time)
{
@@ -1214,19 +1214,19 @@ _sp_capture_writer_set_time_range (SpCaptureWriter *self,
g_assert (self != NULL);
do_start:
- ret = _sp_pwrite (self->fd,
+ ret = _sysprof_pwrite (self->fd,
&start_time,
sizeof (start_time),
- G_STRUCT_OFFSET (SpCaptureFileHeader, time));
+ G_STRUCT_OFFSET (SysprofCaptureFileHeader, time));
if (ret < 0 && errno == EAGAIN)
goto do_start;
do_end:
- ret = _sp_pwrite (self->fd,
+ ret = _sysprof_pwrite (self->fd,
&end_time,
sizeof (end_time),
- G_STRUCT_OFFSET (SpCaptureFileHeader, end_time));
+ G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time));
if (ret < 0 && errno == EAGAIN)
goto do_end;
@@ -1234,8 +1234,8 @@ do_end:
return TRUE;
}
-SpCaptureWriter *
-sp_capture_writer_new_from_env (gsize buffer_size)
+SysprofCaptureWriter *
+sysprof_capture_writer_new_from_env (gsize buffer_size)
{
const gchar *fdstr;
int fd;
@@ -1250,5 +1250,5 @@ sp_capture_writer_new_from_env (gsize buffer_size)
if (fd < 2)
return NULL;
- return sp_capture_writer_new_from_fd (dup (fd), buffer_size);
+ return sysprof_capture_writer_new_from_fd (dup (fd), buffer_size);
}
diff --git a/src/libsysprof-capture/sp-capture-writer.h b/src/libsysprof-capture/sysprof-capture-writer.h
similarity index 68%
rename from src/libsysprof-capture/sp-capture-writer.h
rename to src/libsysprof-capture/sysprof-capture-writer.h
index 1e84c05..5adcee9 100644
--- a/src/libsysprof-capture/sp-capture-writer.h
+++ b/src/libsysprof-capture/sysprof-capture-writer.h
@@ -1,4 +1,4 @@
-/* sp-capture-writer.h
+/* sysprof-capture-writer.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,17 +20,17 @@
#pragma once
-#include "sp-capture-types.h"
+#include "sysprof-capture-types.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-typedef struct _SpCaptureWriter SpCaptureWriter;
+typedef struct _SysprofCaptureWriter SysprofCaptureWriter;
typedef struct
{
/*
- * The number of frames indexed by SpCaptureFrameType
+ * The number of frames indexed by SysprofCaptureFrameType
*/
gsize frame_count[16];
@@ -38,25 +38,25 @@ typedef struct
* Padding for future expansion.
*/
gsize padding[48];
-} SpCaptureStat;
+} SysprofCaptureStat;
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureWriter *sp_capture_writer_new_from_env (gsize buffer_size);
+SysprofCaptureWriter *sysprof_capture_writer_new_from_env (gsize buffer_size);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureWriter *sp_capture_writer_new (const gchar *filename,
+SysprofCaptureWriter *sysprof_capture_writer_new (const gchar *filename,
gsize buffer_size);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureWriter *sp_capture_writer_new_from_fd (int fd,
+SysprofCaptureWriter *sysprof_capture_writer_new_from_fd (int fd,
gsize buffer_size);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureWriter *sp_capture_writer_ref (SpCaptureWriter *self);
+SysprofCaptureWriter *sysprof_capture_writer_ref (SysprofCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_writer_unref (SpCaptureWriter *self);
+void sysprof_capture_writer_unref (SysprofCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_capture_writer_stat (SpCaptureWriter *self,
- SpCaptureStat *stat);
+void sysprof_capture_writer_stat (SysprofCaptureWriter *self,
+ SysprofCaptureStat *stat);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_map (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
@@ -66,7 +66,7 @@ gboolean sp_capture_writer_add_map (SpCaptureWriter *
guint64 inode,
const gchar *filename);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_mark (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
@@ -75,78 +75,78 @@ gboolean sp_capture_writer_add_mark (SpCaptureWriter *
const gchar *name,
const gchar *message);
SYSPROF_AVAILABLE_IN_ALL
-guint64 sp_capture_writer_add_jitmap (SpCaptureWriter *self,
+guint64 sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
const gchar *name);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_process (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
const gchar *cmdline);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_sample (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
gint32 tid,
- const SpCaptureAddress *addrs,
+ const SysprofCaptureAddress *addrs,
guint n_addrs);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_fork (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
gint32 child_pid);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_exit (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_add_timestamp (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_define_counters (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
- const SpCaptureCounter *counters,
+ const SysprofCaptureCounter *counters,
guint n_counters);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_set_counters (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
gint64 time,
gint cpu,
gint32 pid,
const guint *counters_ids,
- const SpCaptureCounterValue *values,
+ const SysprofCaptureCounterValue *values,
guint n_counters);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_flush (SpCaptureWriter *self);
+gboolean sysprof_capture_writer_flush (SysprofCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_save_as (SpCaptureWriter *self,
+gboolean sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
const gchar *filename,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
-guint sp_capture_writer_request_counter (SpCaptureWriter *self,
+guint sysprof_capture_writer_request_counter (SysprofCaptureWriter *self,
guint n_counters);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureReader *sp_capture_writer_create_reader (SpCaptureWriter *self,
+SysprofCaptureReader *sysprof_capture_writer_create_reader (SysprofCaptureWriter *self,
GError **error);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_capture_writer_splice (SpCaptureWriter *self,
- SpCaptureWriter *dest,
+gboolean sysprof_capture_writer_splice (SysprofCaptureWriter *self,
+ SysprofCaptureWriter *dest,
GError **error);
G_GNUC_INTERNAL
-gboolean _sp_capture_writer_splice_from_fd (SpCaptureWriter *self,
+gboolean _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
int fd,
GError **error) G_GNUC_INTERNAL;
G_GNUC_INTERNAL
-gboolean _sp_capture_writer_set_time_range (SpCaptureWriter *self,
+gboolean _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self,
gint64 start_time,
gint64 end_time) G_GNUC_INTERNAL;
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureWriter, sp_capture_writer_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCaptureWriter, sysprof_capture_writer_unref)
G_END_DECLS
diff --git a/src/libsysprof-capture/sysprof-capture.h b/src/libsysprof-capture/sysprof-capture.h
index d949b92..63d2aef 100644
--- a/src/libsysprof-capture/sysprof-capture.h
+++ b/src/libsysprof-capture/sysprof-capture.h
@@ -26,12 +26,12 @@ G_BEGIN_DECLS
#define SYSPROF_CAPTURE_INSIDE
-# include "sp-address.h"
-# include "sp-capture-condition.h"
-# include "sp-capture-cursor.h"
-# include "sp-capture-reader.h"
-# include "sp-capture-writer.h"
-# include "sp-clock.h"
+# include "sysprof-address.h"
+# include "sysprof-capture-condition.h"
+# include "sysprof-capture-cursor.h"
+# include "sysprof-capture-reader.h"
+# include "sysprof-capture-writer.h"
+# include "sysprof-clock.h"
# include "sysprof-version.h"
# include "sysprof-version-macros.h"
diff --git a/src/libsysprof-capture/sp-clock.c b/src/libsysprof-capture/sysprof-clock.c
similarity index 86%
rename from src/libsysprof-capture/sp-clock.c
rename to src/libsysprof-capture/sysprof-clock.c
index d65e136..96c1fc8 100644
--- a/src/libsysprof-capture/sp-clock.c
+++ b/src/libsysprof-capture/sysprof-clock.c
@@ -1,4 +1,4 @@
-/* sp-clock.c
+/* sysprof-clock.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,16 +18,16 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-clock"
+#define G_LOG_DOMAIN "sysprof-clock"
#include "config.h"
-#include "sp-clock.h"
+#include "sysprof-clock.h"
-gint sp_clock = -1;
+gint sysprof_clock = -1;
void
-sp_clock_init (void)
+sysprof_clock_init (void)
{
static const gint clock_ids[] = {
CLOCK_MONOTONIC,
@@ -39,7 +39,7 @@ sp_clock_init (void)
CLOCK_REALTIME,
};
- if (sp_clock != -1)
+ if (sysprof_clock != -1)
return;
for (guint i = 0; i < G_N_ELEMENTS (clock_ids); i++)
@@ -49,7 +49,7 @@ sp_clock_init (void)
if (0 == clock_gettime (clock_id, &ts))
{
- sp_clock = clock_id;
+ sysprof_clock = clock_id;
return;
}
}
diff --git a/src/libsysprof-capture/sp-clock.h b/src/libsysprof-capture/sysprof-clock.h
similarity index 72%
rename from src/libsysprof-capture/sp-clock.h
rename to src/libsysprof-capture/sysprof-clock.h
index e53773c..aa84812 100644
--- a/src/libsysprof-capture/sp-clock.h
+++ b/src/libsysprof-capture/sysprof-clock.h
@@ -1,4 +1,4 @@
-/* sp-clock.h
+/* sysprof-clock.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -27,18 +27,18 @@
G_BEGIN_DECLS
-typedef gint SpClock;
-typedef gint64 SpTimeStamp;
-typedef gint32 SpTimeSpan;
+typedef gint SysprofClock;
+typedef gint64 SysprofTimeStamp;
+typedef gint32 SysprofTimeSysprofan;
SYSPROF_AVAILABLE_IN_ALL
-SpClock sp_clock;
+SysprofClock sysprof_clock;
-static inline SpTimeStamp
-sp_clock_get_current_time (void)
+static inline SysprofTimeStamp
+sysprof_clock_get_current_time (void)
{
struct timespec ts;
- SpClock clock = sp_clock;
+ SysprofClock clock = sysprof_clock;
if G_UNLIKELY (clock == -1)
clock = CLOCK_MONOTONIC;
@@ -47,13 +47,13 @@ sp_clock_get_current_time (void)
return (ts.tv_sec * G_GINT64_CONSTANT (1000000000)) + ts.tv_nsec;
}
-static inline SpTimeSpan
-sp_clock_get_relative_time (SpTimeStamp epoch)
+static inline SysprofTimeSysprofan
+sysprof_clock_get_relative_time (SysprofTimeStamp epoch)
{
- return sp_clock_get_current_time () - epoch;
+ return sysprof_clock_get_current_time () - epoch;
}
SYSPROF_AVAILABLE_IN_ALL
-void sp_clock_init (void);
+void sysprof_clock_init (void);
G_END_DECLS
diff --git a/src/libsysprof-capture/sp-platform.c b/src/libsysprof-capture/sysprof-platform.c
similarity index 92%
rename from src/libsysprof-capture/sp-platform.c
rename to src/libsysprof-capture/sysprof-platform.c
index 176f74b..6d7b0e9 100644
--- a/src/libsysprof-capture/sp-platform.c
+++ b/src/libsysprof-capture/sysprof-platform.c
@@ -1,4 +1,4 @@
-/* sp-platform.c
+/* sysprof-platform.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-platform"
+#define G_LOG_DOMAIN "sysprof-platform"
#include "config.h"
@@ -27,10 +27,10 @@
#include <sys/syscall.h>
#include <unistd.h>
-#include "sp-platform.h"
+#include "sysprof-platform.h"
/**
- * sp_memfd_create:
+ * sysprof_memfd_create:
* @name: (nullable): A descriptive name for the memfd or %NULL
*
* Creates a new memfd using the memfd_create syscall if available.
@@ -40,7 +40,7 @@
* Returns: An fd if successful; otherwise -1 and errno is set.
*/
int
-sp_memfd_create (const gchar *name)
+sysprof_memfd_create (const gchar *name)
{
#ifdef __NR_memfd_create
if (name == NULL)
diff --git a/src/libsysprof-capture/sp-platform.h b/src/libsysprof-capture/sysprof-platform.h
similarity index 92%
rename from src/libsysprof-capture/sp-platform.h
rename to src/libsysprof-capture/sysprof-platform.h
index 06d845b..ef1a3fc 100644
--- a/src/libsysprof-capture/sp-platform.h
+++ b/src/libsysprof-capture/sysprof-platform.h
@@ -1,4 +1,4 @@
-/* sp-platform.h
+/* sysprof-platform.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -25,6 +25,6 @@
G_BEGIN_DECLS
SYSPROF_AVAILABLE_IN_ALL
-int sp_memfd_create (const gchar *desc);
+int sysprof_memfd_create (const gchar *desc);
G_END_DECLS
diff --git a/src/libsysprof-ui/meson.build b/src/libsysprof-ui/meson.build
index 36d879b..bbb1a57 100644
--- a/src/libsysprof-ui/meson.build
+++ b/src/libsysprof-ui/meson.build
@@ -1,49 +1,49 @@
libsysprof_ui_public_sources = [
- 'sp-callgraph-view.c',
- 'sp-color-cycle.c',
- 'sp-cpu-visualizer-row.c',
- 'sp-empty-state-view.c',
- 'sp-failed-state-view.c',
- 'sp-line-visualizer-row.c',
- 'sp-mark-visualizer-row.c',
- 'sp-model-filter.c',
- 'sp-multi-paned.c',
- 'sp-process-model-row.c',
- 'sp-profiler-menu-button.c',
- 'sp-recording-state-view.c',
- 'sp-visualizer-list.c',
- 'sp-visualizer-row.c',
- 'sp-visualizer-ticks.c',
- 'sp-visualizer-view.c',
- 'sp-zoom-manager.c',
+ 'sysprof-callgraph-view.c',
+ 'sysprof-color-cycle.c',
+ 'sysprof-cpu-visualizer-row.c',
+ 'sysprof-empty-state-view.c',
+ 'sysprof-failed-state-view.c',
+ 'sysprof-line-visualizer-row.c',
+ 'sysprof-mark-visualizer-row.c',
+ 'sysprof-model-filter.c',
+ 'sysprof-multi-paned.c',
+ 'sysprof-process-model-row.c',
+ 'sysprof-profiler-menu-button.c',
+ 'sysprof-recording-state-view.c',
+ 'sysprof-visualizer-list.c',
+ 'sysprof-visualizer-row.c',
+ 'sysprof-visualizer-ticks.c',
+ 'sysprof-visualizer-view.c',
+ 'sysprof-zoom-manager.c',
]
libsysprof_ui_private_sources = [
'pointcache.c',
'rectangles.c',
- 'sp-cell-renderer-percent.c',
- 'sp-theme-manager.c',
+ 'sysprof-cell-renderer-percent.c',
+ 'sysprof-theme-manager.c',
'../stackstash.c',
]
libsysprof_ui_public_headers = [
- 'sp-callgraph-view.h',
- 'sp-cell-renderer-percent.h',
- 'sp-cpu-visualizer-row.h',
- 'sp-empty-state-view.h',
- 'sp-failed-state-view.h',
- 'sp-line-visualizer-row.h',
- 'sp-mark-visualizer-row.h',
- 'sp-model-filter.h',
- 'sp-multi-paned.h',
- 'sp-process-model-row.h',
- 'sp-profiler-menu-button.h',
- 'sp-recording-state-view.h',
- 'sp-visualizer-list.h',
- 'sp-visualizer-row.h',
- 'sp-visualizer-ticks.h',
- 'sp-visualizer-view.h',
- 'sp-zoom-manager.h',
+ 'sysprof-callgraph-view.h',
+ 'sysprof-cell-renderer-percent.h',
+ 'sysprof-cpu-visualizer-row.h',
+ 'sysprof-empty-state-view.h',
+ 'sysprof-failed-state-view.h',
+ 'sysprof-line-visualizer-row.h',
+ 'sysprof-mark-visualizer-row.h',
+ 'sysprof-model-filter.h',
+ 'sysprof-multi-paned.h',
+ 'sysprof-process-model-row.h',
+ 'sysprof-profiler-menu-button.h',
+ 'sysprof-recording-state-view.h',
+ 'sysprof-visualizer-list.h',
+ 'sysprof-visualizer-row.h',
+ 'sysprof-visualizer-ticks.h',
+ 'sysprof-visualizer-view.h',
+ 'sysprof-zoom-manager.h',
'sysprof-ui.h',
]
diff --git a/src/libsysprof-ui/rectangles.c b/src/libsysprof-ui/rectangles.c
index 7dc6ff8..1623502 100644
--- a/src/libsysprof-ui/rectangles.c
+++ b/src/libsysprof-ui/rectangles.c
@@ -19,8 +19,8 @@
*/
#include "rectangles.h"
-#include "sp-color-cycle.h"
-#include "sp-visualizer-row.h"
+#include "sysprof-color-cycle.h"
+#include "sysprof-visualizer-row.h"
typedef struct
{
@@ -37,7 +37,7 @@ struct _Rectangles
GArray *rectangles;
GHashTable *y_indexes;
GHashTable *colors;
- SpColorCycle *cycle;
+ SysprofColorCycle *cycle;
gint64 begin_time;
gint64 end_time;
guint sorted : 1;
@@ -54,7 +54,7 @@ rectangles_new (gint64 begin_time,
self->rectangles = g_array_new (FALSE, FALSE, sizeof (Rectangle));
self->y_indexes = g_hash_table_new (g_str_hash, g_str_equal);
self->colors = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
- self->cycle = sp_color_cycle_new ();
+ self->cycle = sysprof_color_cycle_new ();
self->begin_time = begin_time;
self->end_time = end_time;
self->sorted = FALSE;
@@ -97,7 +97,7 @@ rectangles_free (Rectangles *self)
g_array_unref (self->rectangles);
g_hash_table_unref (self->colors);
g_hash_table_unref (self->y_indexes);
- sp_color_cycle_unref (self->cycle);
+ sysprof_color_cycle_unref (self->cycle);
g_slice_free (Rectangles, self);
}
@@ -137,7 +137,7 @@ rectangles_sort (Rectangles *self)
{
GdkRGBA rgba;
- sp_color_cycle_next (self->cycle, &rgba);
+ sysprof_color_cycle_next (self->cycle, &rgba);
g_hash_table_insert (self->y_indexes, (gchar *)rect->name, GUINT_TO_POINTER (++sequence));
g_hash_table_insert (self->colors, (gchar *)rect->name, g_memdup (&rgba, sizeof rgba));
}
@@ -156,7 +156,7 @@ rectangles_draw (Rectangles *self,
guint n_rows;
g_assert (self != NULL);
- g_assert (SP_IS_VISUALIZER_ROW (row));
+ g_assert (SYSPROF_IS_VISUALIZER_ROW (row));
g_assert (cr != NULL);
if (!self->sorted)
@@ -173,8 +173,8 @@ rectangles_draw (Rectangles *self,
{
Rectangle *rect = &g_array_index (self->rectangles, Rectangle, i);
guint y_index = GPOINTER_TO_UINT (g_hash_table_lookup (self->y_indexes, rect->name));
- SpVisualizerRowRelativePoint in_points[2];
- SpVisualizerRowAbsolutePoint out_points[2];
+ SysprofVisualizerRowRelativePoint in_points[2];
+ SysprofVisualizerRowAbsolutePoint out_points[2];
GdkRectangle r;
GdkRGBA *rgba;
@@ -186,9 +186,9 @@ rectangles_draw (Rectangles *self,
in_points[1].x = (rect->end - self->begin_time) / range;
in_points[1].y = 0;
- sp_visualizer_row_translate_points (SP_VISUALIZER_ROW (row),
- in_points, G_N_ELEMENTS (in_points),
- out_points, G_N_ELEMENTS (out_points));
+ sysprof_visualizer_row_translate_points (SYSPROF_VISUALIZER_ROW (row),
+ in_points, G_N_ELEMENTS (in_points),
+ out_points, G_N_ELEMENTS (out_points));
r.height = alloc.height / (gdouble)n_rows;
r.x = out_points[0].x;
diff --git a/src/libsysprof-ui/sp-callgraph-view.c b/src/libsysprof-ui/sysprof-callgraph-view.c
similarity index 78%
rename from src/libsysprof-ui/sp-callgraph-view.c
rename to src/libsysprof-ui/sysprof-callgraph-view.c
index b9e0bd7..de9b55b 100644
--- a/src/libsysprof-ui/sp-callgraph-view.c
+++ b/src/libsysprof-ui/sysprof-callgraph-view.c
@@ -1,4 +1,4 @@
-/* sp-callgraph-view.c
+/* sysprof-callgraph-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -43,12 +43,12 @@
#include "../stackstash.h"
-#include "sp-callgraph-view.h"
-#include "sp-cell-renderer-percent.h"
+#include "sysprof-callgraph-view.h"
+#include "sysprof-cell-renderer-percent.h"
typedef struct
{
- SpCallgraphProfile *profile;
+ SysprofCallgraphProfile *profile;
GtkTreeView *callers_view;
GtkTreeView *functions_view;
@@ -58,9 +58,9 @@ typedef struct
GQueue *history;
guint profile_size;
-} SpCallgraphViewPrivate;
+} SysprofCallgraphViewPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (SpCallgraphView, sp_callgraph_view, GTK_TYPE_BIN)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofCallgraphView, sysprof_callgraph_view, GTK_TYPE_BIN)
enum {
PROP_0,
@@ -81,21 +81,21 @@ enum {
};
-static void sp_callgraph_view_update_descendants (SpCallgraphView *self,
+static void sysprof_callgraph_view_update_descendants (SysprofCallgraphView *self,
StackNode *node);
static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
static guint
-sp_callgraph_view_get_profile_size (SpCallgraphView *self)
+sysprof_callgraph_view_get_profile_size (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
StackStash *stash;
StackNode *node;
guint size = 0;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
if (priv->profile_size != 0)
return priv->profile_size;
@@ -103,7 +103,7 @@ sp_callgraph_view_get_profile_size (SpCallgraphView *self)
if (priv->profile == NULL)
return 0;
- if (NULL == (stash = sp_callgraph_profile_get_stash (priv->profile)))
+ if (NULL == (stash = sysprof_callgraph_profile_get_stash (priv->profile)))
return 0;
for (node = stack_stash_get_root (stash); node != NULL; node = node->siblings)
@@ -148,10 +148,10 @@ build_functions_store (StackNode *node,
}
static void
-sp_callgraph_view_load (SpCallgraphView *self,
- SpCallgraphProfile *profile)
+sysprof_callgraph_view_load (SysprofCallgraphView *self,
+ SysprofCallgraphProfile *profile)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkListStore *functions;
StackStash *stash;
StackNode *n;
@@ -161,8 +161,8 @@ sp_callgraph_view_load (SpCallgraphView *self,
gdouble profile_size;
} state = { 0 };
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
- g_assert (SP_IS_CALLGRAPH_PROFILE (profile));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (profile));
/*
* TODO: This is probably the type of thing we want to do off the main
@@ -175,7 +175,7 @@ sp_callgraph_view_load (SpCallgraphView *self,
g_set_object (&priv->profile, profile);
- if (NULL == (stash = sp_callgraph_profile_get_stash (profile)))
+ if (NULL == (stash = sysprof_callgraph_profile_get_stash (profile)))
return;
for (n = stack_stash_get_root (stash); n; n = n->siblings)
@@ -206,12 +206,12 @@ sp_callgraph_view_load (SpCallgraphView *self,
}
static void
-sp_callgraph_view_unload (SpCallgraphView *self)
+sysprof_callgraph_view_unload (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
- g_assert (SP_IS_CALLGRAPH_PROFILE (priv->profile));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (priv->profile));
g_queue_clear (priv->history);
g_clear_object (&priv->profile);
@@ -223,45 +223,45 @@ sp_callgraph_view_unload (SpCallgraphView *self)
}
/**
- * sp_callgraph_view_get_profile:
+ * sysprof_callgraph_view_get_profile:
*
- * Returns: (transfer none): An #SpCallgraphProfile.
+ * Returns: (transfer none): An #SysprofCallgraphProfile.
*/
-SpCallgraphProfile *
-sp_callgraph_view_get_profile (SpCallgraphView *self)
+SysprofCallgraphProfile *
+sysprof_callgraph_view_get_profile (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
- g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), NULL);
return priv->profile;
}
void
-sp_callgraph_view_set_profile (SpCallgraphView *self,
- SpCallgraphProfile *profile)
+sysprof_callgraph_view_set_profile (SysprofCallgraphView *self,
+ SysprofCallgraphProfile *profile)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
- g_return_if_fail (SP_IS_CALLGRAPH_VIEW (self));
- g_return_if_fail (!profile || SP_IS_CALLGRAPH_PROFILE (profile));
+ g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
+ g_return_if_fail (!profile || SYSPROF_IS_CALLGRAPH_PROFILE (profile));
if (profile != priv->profile)
{
if (priv->profile)
- sp_callgraph_view_unload (self);
+ sysprof_callgraph_view_unload (self);
if (profile)
- sp_callgraph_view_load (self, profile);
+ sysprof_callgraph_view_load (self, profile);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PROFILE]);
}
}
static void
-sp_callgraph_view_expand_descendants (SpCallgraphView *self)
+sysprof_callgraph_view_expand_descendants (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model;
GList *all_paths = NULL;
GtkTreePath *first_path;
@@ -270,7 +270,7 @@ sp_callgraph_view_expand_descendants (SpCallgraphView *self)
gint max_rows = 40; /* FIXME */
gint n_rows;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
model = gtk_tree_view_get_model (priv->descendants_view);
first_path = gtk_tree_path_new_first ();
@@ -384,10 +384,10 @@ caller_free (gpointer data)
}
static void
-sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
+sysprof_callgraph_view_function_selection_changed (SysprofCallgraphView *self,
GtkTreeSelection *selection)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model = NULL;
GtkTreeIter iter;
GtkListStore *callers_store;
@@ -396,7 +396,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
StackNode *callees = NULL;
StackNode *node;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (GTK_IS_TREE_SELECTION (selection));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -410,7 +410,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
COLUMN_POINTER, &callees,
-1);
- sp_callgraph_view_update_descendants (self, callees);
+ sysprof_callgraph_view_update_descendants (self, callees);
callers_store = gtk_list_store_new (4,
G_TYPE_STRING,
@@ -479,7 +479,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
gpointer key, value;
guint size = 0;
- size = MAX (1, sp_callgraph_view_get_profile_size (self));
+ size = MAX (1, sysprof_callgraph_view_get_profile_size (self));
g_hash_table_iter_init (&hiter, callers);
@@ -506,14 +506,14 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView *self,
}
static void
-sp_callgraph_view_set_node (SpCallgraphView *self,
+sysprof_callgraph_view_set_node (SysprofCallgraphView *self,
StackNode *node)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model;
GtkTreeIter iter;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (node != NULL);
if (priv->profile == NULL)
@@ -546,7 +546,7 @@ sp_callgraph_view_set_node (SpCallgraphView *self,
}
static void
-sp_callgraph_view_descendant_activated (SpCallgraphView *self,
+sysprof_callgraph_view_descendant_activated (SysprofCallgraphView *self,
GtkTreePath *path,
GtkTreeViewColumn *column,
GtkTreeView *tree_view)
@@ -555,7 +555,7 @@ sp_callgraph_view_descendant_activated (SpCallgraphView *self,
StackNode *node = NULL;
GtkTreeIter iter;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (GTK_IS_TREE_VIEW (tree_view));
g_assert (path != NULL);
g_assert (GTK_IS_TREE_VIEW_COLUMN (column));
@@ -570,11 +570,11 @@ sp_callgraph_view_descendant_activated (SpCallgraphView *self,
-1);
if (node != NULL)
- sp_callgraph_view_set_node (self, node);
+ sysprof_callgraph_view_set_node (self, node);
}
static void
-sp_callgraph_view_caller_activated (SpCallgraphView *self,
+sysprof_callgraph_view_caller_activated (SysprofCallgraphView *self,
GtkTreePath *path,
GtkTreeViewColumn *column,
GtkTreeView *tree_view)
@@ -583,7 +583,7 @@ sp_callgraph_view_caller_activated (SpCallgraphView *self,
StackNode *node = NULL;
GtkTreeIter iter;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
g_assert (GTK_IS_TREE_VIEW (tree_view));
g_assert (path != NULL);
g_assert (GTK_IS_TREE_VIEW_COLUMN (column));
@@ -598,18 +598,18 @@ sp_callgraph_view_caller_activated (SpCallgraphView *self,
-1);
if (node != NULL)
- sp_callgraph_view_set_node (self, node);
+ sysprof_callgraph_view_set_node (self, node);
}
static void
-sp_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
+sysprof_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
- SpCallgraphView *self = data;
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphView *self = data;
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
StackNode *node = NULL;
const gchar *str = NULL;
@@ -622,7 +622,7 @@ sp_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
{
GQuark tag;
- tag = sp_callgraph_profile_get_tag (priv->profile, GSIZE_TO_POINTER (node->data));
+ tag = sysprof_callgraph_profile_get_tag (priv->profile, GSIZE_TO_POINTER (node->data));
if (tag != 0)
str = g_quark_to_string (tag);
}
@@ -631,39 +631,39 @@ sp_callgraph_view_tag_data_func (GtkTreeViewColumn *column,
}
static void
-sp_callgraph_view_real_go_previous (SpCallgraphView *self)
+sysprof_callgraph_view_real_go_previous (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
StackNode *node;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
node = g_queue_pop_head (priv->history);
if (NULL != (node = g_queue_peek_head (priv->history)))
- sp_callgraph_view_set_node (self, node);
+ sysprof_callgraph_view_set_node (self, node);
}
static void
-sp_callgraph_view_finalize (GObject *object)
+sysprof_callgraph_view_finalize (GObject *object)
{
- SpCallgraphView *self = (SpCallgraphView *)object;
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphView *self = (SysprofCallgraphView *)object;
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
g_clear_pointer (&priv->history, g_queue_free);
g_clear_object (&priv->profile);
- G_OBJECT_CLASS (sp_callgraph_view_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_callgraph_view_parent_class)->finalize (object);
}
static void
-sp_callgraph_view_get_property (GObject *object,
+sysprof_callgraph_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpCallgraphView *self = SP_CALLGRAPH_VIEW (object);
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphView *self = SYSPROF_CALLGRAPH_VIEW (object);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
switch (prop_id)
{
@@ -677,17 +677,17 @@ sp_callgraph_view_get_property (GObject *object,
}
static void
-sp_callgraph_view_set_property (GObject *object,
+sysprof_callgraph_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpCallgraphView *self = SP_CALLGRAPH_VIEW (object);
+ SysprofCallgraphView *self = SYSPROF_CALLGRAPH_VIEW (object);
switch (prop_id)
{
case PROP_PROFILE:
- sp_callgraph_view_set_profile (self, g_value_get_object (value));
+ sysprof_callgraph_view_set_profile (self, g_value_get_object (value));
break;
default:
@@ -723,23 +723,23 @@ descendants_view_move_cursor_cb (GtkTreeView *descendants_view,
}
static void
-sp_callgraph_view_class_init (SpCallgraphViewClass *klass)
+sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkBindingSet *bindings;
- object_class->finalize = sp_callgraph_view_finalize;
- object_class->get_property = sp_callgraph_view_get_property;
- object_class->set_property = sp_callgraph_view_set_property;
+ object_class->finalize = sysprof_callgraph_view_finalize;
+ object_class->get_property = sysprof_callgraph_view_get_property;
+ object_class->set_property = sysprof_callgraph_view_set_property;
- klass->go_previous = sp_callgraph_view_real_go_previous;
+ klass->go_previous = sysprof_callgraph_view_real_go_previous;
properties [PROP_PROFILE] =
g_param_spec_object ("profile",
"Profile",
"The callgraph profile to view",
- SP_TYPE_CALLGRAPH_PROFILE,
+ SYSPROF_TYPE_CALLGRAPH_PROFILE,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
@@ -748,27 +748,27 @@ sp_callgraph_view_class_init (SpCallgraphViewClass *klass)
g_signal_new ("go-previous",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (SpCallgraphViewClass, go_previous),
+ G_STRUCT_OFFSET (SysprofCallgraphViewClass, go_previous),
NULL, NULL, NULL, G_TYPE_NONE, 0);
gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gnome/sysprof/ui/sp-callgraph-view.ui");
+ "/org/gnome/sysprof/ui/sysprof-callgraph-view.ui");
- gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, callers_view);
- gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, functions_view);
- gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, descendants_view);
- gtk_widget_class_bind_template_child_private (widget_class, SpCallgraphView, descendants_name_column);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, callers_view);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, functions_view);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, descendants_view);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofCallgraphView, descendants_name_column);
bindings = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (bindings, GDK_KEY_Left, GDK_MOD1_MASK, "go-previous", 0);
- g_type_ensure (SP_TYPE_CELL_RENDERER_PERCENT);
+ g_type_ensure (SYSPROF_TYPE_CELL_RENDERER_PERCENT);
}
static void
-sp_callgraph_view_init (SpCallgraphView *self)
+sysprof_callgraph_view_init (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeSelection *selection;
GtkCellRenderer *cell;
@@ -780,19 +780,19 @@ sp_callgraph_view_init (SpCallgraphView *self)
g_signal_connect_object (selection,
"changed",
- G_CALLBACK (sp_callgraph_view_function_selection_changed),
+ G_CALLBACK (sysprof_callgraph_view_function_selection_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->descendants_view,
"row-activated",
- G_CALLBACK (sp_callgraph_view_descendant_activated),
+ G_CALLBACK (sysprof_callgraph_view_descendant_activated),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->callers_view,
"row-activated",
- G_CALLBACK (sp_callgraph_view_caller_activated),
+ G_CALLBACK (sysprof_callgraph_view_caller_activated),
self,
G_CONNECT_SWAPPED);
@@ -815,7 +815,7 @@ sp_callgraph_view_init (SpCallgraphView *self)
NULL);
gtk_tree_view_column_pack_start (priv->descendants_name_column, cell, FALSE);
gtk_tree_view_column_set_cell_data_func (priv->descendants_name_column, cell,
- sp_callgraph_view_tag_data_func,
+ sysprof_callgraph_view_tag_data_func,
self, NULL);
}
@@ -916,7 +916,7 @@ build_tree (StackNode *node)
}
static void
-append_to_tree_and_free (SpCallgraphView *self,
+append_to_tree_and_free (SysprofCallgraphView *self,
StackStash *stash,
GtkTreeStore *store,
Descendant *item,
@@ -929,7 +929,7 @@ append_to_tree_and_free (SpCallgraphView *self,
g_assert (GTK_IS_TREE_STORE (store));
g_assert (item != NULL);
- profile_size = MAX (1, sp_callgraph_view_get_profile_size (self));
+ profile_size = MAX (1, sysprof_callgraph_view_get_profile_size (self));
gtk_tree_store_append (store, &iter, parent);
@@ -952,13 +952,13 @@ append_to_tree_and_free (SpCallgraphView *self,
}
static void
-sp_callgraph_view_update_descendants (SpCallgraphView *self,
+sysprof_callgraph_view_update_descendants (SysprofCallgraphView *self,
StackNode *node)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeStore *store;
- g_assert (SP_IS_CALLGRAPH_VIEW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
if (g_queue_peek_head (priv->history) != node)
g_queue_push_head (priv->history, node);
@@ -973,7 +973,7 @@ sp_callgraph_view_update_descendants (SpCallgraphView *self,
{
StackStash *stash;
- stash = sp_callgraph_profile_get_stash (priv->profile);
+ stash = sysprof_callgraph_profile_get_stash (priv->profile);
if (stash != NULL)
{
Descendant *tree;
@@ -987,14 +987,14 @@ sp_callgraph_view_update_descendants (SpCallgraphView *self,
gtk_tree_view_set_model (priv->descendants_view, GTK_TREE_MODEL (store));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
COLUMN_TOTAL, GTK_SORT_DESCENDING);
- sp_callgraph_view_expand_descendants (self);
+ sysprof_callgraph_view_expand_descendants (self);
g_clear_object (&store);
}
/**
- * sp_callgraph_view_screenshot:
- * @self: A #SpCallgraphView.
+ * sysprof_callgraph_view_screenshot:
+ * @self: A #SysprofCallgraphView.
*
* This function will generate a text representation of the descendants tree.
* This is useful if you want to include various profiling information in a
@@ -1006,16 +1006,16 @@ sp_callgraph_view_update_descendants (SpCallgraphView *self,
* with g_free().
*/
gchar *
-sp_callgraph_view_screenshot (SpCallgraphView *self)
+sysprof_callgraph_view_screenshot (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeView *tree_view;
GtkTreeModel *model;
GtkTreePath *tree_path;
GString *str;
GtkTreeIter iter;
- g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), NULL);
tree_view = priv->descendants_view;
@@ -1073,13 +1073,13 @@ sp_callgraph_view_screenshot (SpCallgraphView *self)
}
guint
-sp_callgraph_view_get_n_functions (SpCallgraphView *self)
+sysprof_callgraph_view_get_n_functions (SysprofCallgraphView *self)
{
- SpCallgraphViewPrivate *priv = sp_callgraph_view_get_instance_private (self);
+ SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
GtkTreeModel *model;
guint ret = 0;
- g_return_val_if_fail (SP_IS_CALLGRAPH_VIEW (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), 0);
if (NULL != (model = gtk_tree_view_get_model (priv->functions_view)))
ret = gtk_tree_model_iter_n_children (model, NULL);
diff --git a/src/libsysprof-ui/sp-callgraph-view.h b/src/libsysprof-ui/sysprof-callgraph-view.h
similarity index 55%
rename from src/libsysprof-ui/sp-callgraph-view.h
rename to src/libsysprof-ui/sysprof-callgraph-view.h
index b735943..068af87 100644
--- a/src/libsysprof-ui/sp-callgraph-view.h
+++ b/src/libsysprof-ui/sysprof-callgraph-view.h
@@ -1,4 +1,4 @@
-/* sp-callgraph-view.h
+/* sysprof-callgraph-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,36 +22,36 @@
#include <gtk/gtk.h>
-#include "sp-callgraph-profile.h"
+#include "sysprof-callgraph-profile.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_CALLGRAPH_VIEW (sp_callgraph_view_get_type())
+#define SYSPROF_TYPE_CALLGRAPH_VIEW (sysprof_callgraph_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpCallgraphView, sp_callgraph_view, SP, CALLGRAPH_VIEW, GtkBin)
+G_DECLARE_DERIVABLE_TYPE (SysprofCallgraphView, sysprof_callgraph_view, SYSPROF, CALLGRAPH_VIEW, GtkBin)
-struct _SpCallgraphViewClass
+struct _SysprofCallgraphViewClass
{
GtkBinClass parent_class;
- void (*go_previous) (SpCallgraphView *self);
+ void (*go_previous) (SysprofCallgraphView *self);
gpointer padding[8];
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_callgraph_view_new (void);
+GtkWidget *sysprof_callgraph_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
-SpCallgraphProfile *sp_callgraph_view_get_profile (SpCallgraphView *self);
+SysprofCallgraphProfile *sysprof_callgraph_view_get_profile (SysprofCallgraphView *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_callgraph_view_set_profile (SpCallgraphView *self,
- SpCallgraphProfile *profile);
+void sysprof_callgraph_view_set_profile (SysprofCallgraphView *self,
+ SysprofCallgraphProfile *profile);
SYSPROF_AVAILABLE_IN_ALL
-gchar *sp_callgraph_view_screenshot (SpCallgraphView *self);
+gchar *sysprof_callgraph_view_screenshot (SysprofCallgraphView *self);
SYSPROF_AVAILABLE_IN_ALL
-guint sp_callgraph_view_get_n_functions (SpCallgraphView *self);
+guint sysprof_callgraph_view_get_n_functions (SysprofCallgraphView *self);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-cell-renderer-percent.c b/src/libsysprof-ui/sysprof-cell-renderer-percent.c
similarity index 65%
rename from src/libsysprof-ui/sp-cell-renderer-percent.c
rename to src/libsysprof-ui/sysprof-cell-renderer-percent.c
index ddd50f0..acfad04 100644
--- a/src/libsysprof-ui/sp-cell-renderer-percent.c
+++ b/src/libsysprof-ui/sysprof-cell-renderer-percent.c
@@ -1,4 +1,4 @@
-/* sp-cell-renderer-percent.c
+/* sysprof-cell-renderer-percent.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,12 +22,12 @@
#include <glib/gi18n.h>
-#include "sp-cell-renderer-percent.h"
+#include "sysprof-cell-renderer-percent.h"
typedef struct
{
gdouble percent;
-} SpCellRendererPercentPrivate;
+} SysprofCellRendererPercentPrivate;
enum {
PROP_0,
@@ -35,22 +35,22 @@ enum {
N_PROPS
};
-G_DEFINE_TYPE_WITH_PRIVATE (SpCellRendererPercent, sp_cell_renderer_percent, GTK_TYPE_CELL_RENDERER_TEXT)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofCellRendererPercent, sysprof_cell_renderer_percent,
GTK_TYPE_CELL_RENDERER_TEXT)
static GParamSpec *properties [N_PROPS];
static void
-sp_cell_renderer_percent_get_property (GObject *object,
+sysprof_cell_renderer_percent_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpCellRendererPercent *self = SP_CELL_RENDERER_PERCENT (object);
+ SysprofCellRendererPercent *self = SYSPROF_CELL_RENDERER_PERCENT (object);
switch (prop_id)
{
case PROP_PERCENT:
- g_value_set_double (value, sp_cell_renderer_percent_get_percent (self));
+ g_value_set_double (value, sysprof_cell_renderer_percent_get_percent (self));
break;
default:
@@ -59,17 +59,17 @@ sp_cell_renderer_percent_get_property (GObject *object,
}
static void
-sp_cell_renderer_percent_set_property (GObject *object,
+sysprof_cell_renderer_percent_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpCellRendererPercent *self = SP_CELL_RENDERER_PERCENT (object);
+ SysprofCellRendererPercent *self = SYSPROF_CELL_RENDERER_PERCENT (object);
switch (prop_id)
{
case PROP_PERCENT:
- sp_cell_renderer_percent_set_percent (self, g_value_get_double (value));
+ sysprof_cell_renderer_percent_set_percent (self, g_value_get_double (value));
break;
default:
@@ -78,12 +78,12 @@ sp_cell_renderer_percent_set_property (GObject *object,
}
static void
-sp_cell_renderer_percent_class_init (SpCellRendererPercentClass *klass)
+sysprof_cell_renderer_percent_class_init (SysprofCellRendererPercentClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = sp_cell_renderer_percent_get_property;
- object_class->set_property = sp_cell_renderer_percent_set_property;
+ object_class->get_property = sysprof_cell_renderer_percent_get_property;
+ object_class->set_property = sysprof_cell_renderer_percent_set_property;
properties [PROP_PERCENT] =
g_param_spec_double ("percent",
@@ -98,28 +98,28 @@ sp_cell_renderer_percent_class_init (SpCellRendererPercentClass *klass)
}
static void
-sp_cell_renderer_percent_init (SpCellRendererPercent *self)
+sysprof_cell_renderer_percent_init (SysprofCellRendererPercent *self)
{
g_object_set (self, "xalign", 1.0f, NULL);
}
gdouble
-sp_cell_renderer_percent_get_percent (SpCellRendererPercent *self)
+sysprof_cell_renderer_percent_get_percent (SysprofCellRendererPercent *self)
{
- SpCellRendererPercentPrivate *priv = sp_cell_renderer_percent_get_instance_private (self);
+ SysprofCellRendererPercentPrivate *priv = sysprof_cell_renderer_percent_get_instance_private (self);
- g_return_val_if_fail (SP_IS_CELL_RENDERER_PERCENT (self), 0.0);
+ g_return_val_if_fail (SYSPROF_IS_CELL_RENDERER_PERCENT (self), 0.0);
return priv->percent;
}
void
-sp_cell_renderer_percent_set_percent (SpCellRendererPercent *self,
+sysprof_cell_renderer_percent_set_percent (SysprofCellRendererPercent *self,
gdouble percent)
{
- SpCellRendererPercentPrivate *priv = sp_cell_renderer_percent_get_instance_private (self);
+ SysprofCellRendererPercentPrivate *priv = sysprof_cell_renderer_percent_get_instance_private (self);
- g_return_if_fail (SP_IS_CELL_RENDERER_PERCENT (self));
+ g_return_if_fail (SYSPROF_IS_CELL_RENDERER_PERCENT (self));
g_return_if_fail (percent >= 0.0);
g_return_if_fail (percent <= 100.0);
diff --git a/src/libsysprof-ui/sysprof-cell-renderer-percent.h
b/src/libsysprof-ui/sysprof-cell-renderer-percent.h
new file mode 100644
index 0000000..0605a24
--- /dev/null
+++ b/src/libsysprof-ui/sysprof-cell-renderer-percent.h
@@ -0,0 +1,62 @@
+/* sysprof-cell-renderer-percent.h
+ *
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "sysprof-version-macros.h"
+
+G_BEGIN_DECLS
+
+#define SYSPROF_TYPE_CELL_RENDERER_PERCENT (sysprof_cell_renderer_percent_get_type())
+#define SYSPROF_CELL_RENDERER_PERCENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercent))
+#define SYSPROF_CELL_RENDERER_PERCENT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercent const))
+#define SYSPROF_CELL_RENDERER_PERCENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercentClass))
+#define SYSPROF_IS_CELL_RENDERER_PERCENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
SYSPROF_TYPE_CELL_RENDERER_PERCENT))
+#define SYSPROF_IS_CELL_RENDERER_PERCENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
SYSPROF_TYPE_CELL_RENDERER_PERCENT))
+#define SYSPROF_CELL_RENDERER_PERCENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
SYSPROF_TYPE_CELL_RENDERER_PERCENT, SysprofCellRendererPercentClass))
+
+typedef struct _SysprofCellRendererPercent SysprofCellRendererPercent;
+typedef struct _SysprofCellRendererPercentClass SysprofCellRendererPercentClass;
+
+struct _SysprofCellRendererPercent
+{
+ GtkCellRendererText parent;
+};
+
+struct _SysprofCellRendererPercentClass
+{
+ GtkCellRendererTextClass parent_class;
+
+ gpointer padding[4];
+};
+
+SYSPROF_AVAILABLE_IN_ALL
+GType sysprof_cell_renderer_percent_get_type (void);
+SYSPROF_AVAILABLE_IN_ALL
+GtkCellRenderer *sysprof_cell_renderer_percent_new (void);
+SYSPROF_AVAILABLE_IN_ALL
+gdouble sysprof_cell_renderer_percent_get_percent (SysprofCellRendererPercent *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_cell_renderer_percent_set_percent (SysprofCellRendererPercent *self,
+ gdouble percent);
+
+G_END_DECLS
diff --git a/src/libsysprof-ui/sp-color-cycle.c b/src/libsysprof-ui/sysprof-color-cycle.c
similarity index 78%
rename from src/libsysprof-ui/sp-color-cycle.c
rename to src/libsysprof-ui/sysprof-color-cycle.c
index 01503ed..cbbea90 100644
--- a/src/libsysprof-ui/sp-color-cycle.c
+++ b/src/libsysprof-ui/sysprof-color-cycle.c
@@ -1,4 +1,4 @@
-/* sp-color-cycle.c
+/* sysprof-color-cycle.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,13 +18,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-color-cycle"
+#define G_LOG_DOMAIN "sysprof-color-cycle"
#include "config.h"
-#include "sp-color-cycle.h"
+#include "sysprof-color-cycle.h"
-G_DEFINE_BOXED_TYPE (SpColorCycle, sp_color_cycle, sp_color_cycle_ref, sp_color_cycle_unref)
+G_DEFINE_BOXED_TYPE (SysprofColorCycle, sysprof_color_cycle, sysprof_color_cycle_ref,
sysprof_color_cycle_unref)
static const gchar *default_colors[] = {
"#73d216",
@@ -54,7 +54,7 @@ static const gchar *default_colors[] = {
NULL
};
-struct _SpColorCycle
+struct _SysprofColorCycle
{
volatile gint ref_count;
GdkRGBA *colors;
@@ -63,18 +63,18 @@ struct _SpColorCycle
};
static void
-sp_color_cycle_destroy (SpColorCycle *self)
+sysprof_color_cycle_destroy (SysprofColorCycle *self)
{
g_free (self->colors);
- g_slice_free (SpColorCycle, self);
+ g_slice_free (SysprofColorCycle, self);
}
-SpColorCycle *
-sp_color_cycle_new (void)
+SysprofColorCycle *
+sysprof_color_cycle_new (void)
{
- SpColorCycle *self;
+ SysprofColorCycle *self;
- self = g_slice_new0 (SpColorCycle);
+ self = g_slice_new0 (SysprofColorCycle);
self->ref_count = 1;
self->n_colors = g_strv_length ((gchar **)default_colors);
self->colors = g_new0 (GdkRGBA, self->n_colors);
@@ -88,8 +88,8 @@ sp_color_cycle_new (void)
return self;
}
-SpColorCycle *
-sp_color_cycle_ref (SpColorCycle *self)
+SysprofColorCycle *
+sysprof_color_cycle_ref (SysprofColorCycle *self)
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count > 0, NULL);
@@ -98,16 +98,16 @@ sp_color_cycle_ref (SpColorCycle *self)
}
void
-sp_color_cycle_unref (SpColorCycle *self)
+sysprof_color_cycle_unref (SysprofColorCycle *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
- sp_color_cycle_destroy (self);
+ sysprof_color_cycle_destroy (self);
}
void
-sp_color_cycle_next (SpColorCycle *self,
+sysprof_color_cycle_next (SysprofColorCycle *self,
GdkRGBA *rgba)
{
g_return_if_fail (self != NULL);
@@ -126,7 +126,7 @@ sp_color_cycle_next (SpColorCycle *self,
}
void
-sp_color_cycle_reset (SpColorCycle *self)
+sysprof_color_cycle_reset (SysprofColorCycle *self)
{
g_return_if_fail (self != NULL);
diff --git a/src/libsysprof-ui/sp-color-cycle.h b/src/libsysprof-ui/sysprof-color-cycle.h
similarity index 66%
rename from src/libsysprof-ui/sp-color-cycle.h
rename to src/libsysprof-ui/sysprof-color-cycle.h
index 8e7f7a4..6482dd3 100644
--- a/src/libsysprof-ui/sp-color-cycle.h
+++ b/src/libsysprof-ui/sysprof-color-cycle.h
@@ -1,4 +1,4 @@
-/* sp-color-cycle.h
+/* sysprof-color-cycle.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -26,22 +26,22 @@
G_BEGIN_DECLS
-#define SP_TYPE_COLOR_CYCLE (sp_color_cycle_get_type())
+#define SYSPROF_TYPE_COLOR_CYCLE (sysprof_color_cycle_get_type())
-typedef struct _SpColorCycle SpColorCycle;
+typedef struct _SysprofColorCycle SysprofColorCycle;
SYSPROF_AVAILABLE_IN_ALL
-GType sp_color_cycle_get_type (void);
+GType sysprof_color_cycle_get_type (void);
SYSPROF_AVAILABLE_IN_ALL
-SpColorCycle *sp_color_cycle_ref (SpColorCycle *self);
+SysprofColorCycle *sysprof_color_cycle_ref (SysprofColorCycle *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_color_cycle_unref (SpColorCycle *self);
+void sysprof_color_cycle_unref (SysprofColorCycle *self);
SYSPROF_AVAILABLE_IN_ALL
-SpColorCycle *sp_color_cycle_new (void);
+SysprofColorCycle *sysprof_color_cycle_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_color_cycle_reset (SpColorCycle *self);
+void sysprof_color_cycle_reset (SysprofColorCycle *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_color_cycle_next (SpColorCycle *self,
+void sysprof_color_cycle_next (SysprofColorCycle *self,
GdkRGBA *rgba);
G_END_DECLS
diff --git a/src/libsysprof-ui/sysprof-cpu-visualizer-row.c b/src/libsysprof-ui/sysprof-cpu-visualizer-row.c
new file mode 100644
index 0000000..43f8d80
--- /dev/null
+++ b/src/libsysprof-ui/sysprof-cpu-visualizer-row.c
@@ -0,0 +1,173 @@
+/* sysprof-cpu-visualizer-row.c
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "sysprof-cpu-visualizer-row"
+
+#include "config.h"
+
+#include "sysprof-capture-condition.h"
+#include "sysprof-capture-cursor.h"
+#include "sysprof-color-cycle.h"
+#include "sysprof-cpu-visualizer-row.h"
+
+struct _SysprofCpuVisualizerRow
+{
+ SysprofLineVisualizerRow parent_instance;
+ SysprofColorCycle *colors;
+};
+
+G_DEFINE_TYPE (SysprofCpuVisualizerRow, sysprof_cpu_visualizer_row, SYSPROF_TYPE_LINE_VISUALIZER_ROW)
+
+static gboolean
+sysprof_cpu_visualizer_counter_found (const SysprofCaptureFrame *frame,
+ gpointer user_data)
+{
+ const SysprofCaptureFrameCounterDefine *def = (SysprofCaptureFrameCounterDefine *)frame;
+ GArray *counters = user_data;
+ gboolean found = FALSE;
+
+ g_assert (frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
+
+ /*
+ * In practice, all the CPU counters are defined at once, so we can avoid
+ * walking the rest of the capture by returning after we find our CTRDEF.
+ */
+
+ for (guint i = 0; i < def->n_counters; i++)
+ {
+ if (g_str_equal (def->counters[i].category, "CPU Percent"))
+ {
+ guint id = def->counters[i].id;
+ g_array_append_val (counters, id);
+ found = TRUE;
+ }
+ }
+
+ return !found;
+}
+
+static void
+sysprof_cpu_visualizer_row_discover_counters (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *canellable)
+{
+ const SysprofCaptureFrameType types[] = { SYSPROF_CAPTURE_FRAME_CTRDEF };
+ SysprofCaptureReader *reader = task_data;
+ g_autoptr(SysprofCaptureCursor) cursor = NULL;
+ g_autoptr(GArray) counters = NULL;
+
+ g_assert (G_IS_TASK (task));
+ g_assert (SYSPROF_IS_CPU_VISUALIZER_ROW (source_object));
+ g_assert (reader != NULL);
+
+ counters = g_array_new (FALSE, FALSE, sizeof (guint));
+ cursor = sysprof_capture_cursor_new (reader);
+ sysprof_capture_cursor_add_condition (cursor, sysprof_capture_condition_new_where_type_in (G_N_ELEMENTS
(types), types));
+ sysprof_capture_cursor_foreach (cursor, sysprof_cpu_visualizer_counter_found, counters);
+ g_task_return_pointer (task, g_steal_pointer (&counters), (GDestroyNotify)g_array_unref);
+}
+
+static void
+complete_counters (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ SysprofCpuVisualizerRow *self = (SysprofCpuVisualizerRow *)object;
+ g_autoptr(GArray) counters = NULL;
+
+ g_assert (SYSPROF_IS_CPU_VISUALIZER_ROW (self));
+ g_assert (G_IS_TASK (result));
+
+ counters = g_task_propagate_pointer (G_TASK (result), NULL);
+
+ if (counters != NULL)
+ {
+ for (guint i = 0; i < counters->len; i++)
+ {
+ guint counter_id = g_array_index (counters, guint, i);
+ GdkRGBA color;
+
+ sysprof_color_cycle_next (self->colors, &color);
+ sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (self), counter_id, &color);
+ }
+ }
+
+ /* Hide ourself if we failed to locate counters */
+ gtk_widget_set_visible (GTK_WIDGET (self), counters != NULL && counters->len > 0);
+}
+
+static void
+sysprof_cpu_visualizer_row_set_reader (SysprofVisualizerRow *row,
+ SysprofCaptureReader *reader)
+{
+ SysprofCpuVisualizerRow *self = (SysprofCpuVisualizerRow *)row;
+ g_autoptr(GTask) task = NULL;
+
+ g_assert (SYSPROF_IS_CPU_VISUALIZER_ROW (row));
+
+ sysprof_color_cycle_reset (self->colors);
+
+ sysprof_line_visualizer_row_clear (SYSPROF_LINE_VISUALIZER_ROW (row));
+
+ SYSPROF_VISUALIZER_ROW_CLASS (sysprof_cpu_visualizer_row_parent_class)->set_reader (row, reader);
+
+ if (reader != NULL)
+ {
+ task = g_task_new (self, NULL, complete_counters, NULL);
+ g_task_set_source_tag (task, sysprof_cpu_visualizer_row_set_reader);
+ g_task_set_task_data (task, sysprof_capture_reader_copy (reader),
+ (GDestroyNotify)sysprof_capture_reader_unref);
+ g_task_run_in_thread (task, sysprof_cpu_visualizer_row_discover_counters);
+ }
+}
+
+static void
+sysprof_cpu_visualizer_row_finalize (GObject *object)
+{
+ SysprofCpuVisualizerRow *self = (SysprofCpuVisualizerRow *)object;
+
+ g_clear_pointer (&self->colors, sysprof_color_cycle_unref);
+
+ G_OBJECT_CLASS (sysprof_cpu_visualizer_row_parent_class)->finalize (object);
+}
+
+static void
+sysprof_cpu_visualizer_row_class_init (SysprofCpuVisualizerRowClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ SysprofVisualizerRowClass *row_class = SYSPROF_VISUALIZER_ROW_CLASS (klass);
+
+ object_class->finalize = sysprof_cpu_visualizer_row_finalize;
+
+ row_class->set_reader = sysprof_cpu_visualizer_row_set_reader;
+}
+
+static void
+sysprof_cpu_visualizer_row_init (SysprofCpuVisualizerRow *self)
+{
+ self->colors = sysprof_color_cycle_new ();
+}
+
+GtkWidget *
+sysprof_cpu_visualizer_row_new (void)
+{
+ return g_object_new (SYSPROF_TYPE_CPU_VISUALIZER_ROW, NULL);
+}
diff --git a/src/libsysprof-ui/sp-cpu-visualizer-row.h b/src/libsysprof-ui/sysprof-cpu-visualizer-row.h
similarity index 72%
rename from src/libsysprof-ui/sp-cpu-visualizer-row.h
rename to src/libsysprof-ui/sysprof-cpu-visualizer-row.h
index d25399f..e329d3f 100644
--- a/src/libsysprof-ui/sp-cpu-visualizer-row.h
+++ b/src/libsysprof-ui/sysprof-cpu-visualizer-row.h
@@ -1,4 +1,4 @@
-/* sp-cpu-visualizer-row.h
+/* sysprof-cpu-visualizer-row.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,18 +20,18 @@
#pragma once
-#include "sp-line-visualizer-row.h"
+#include "sysprof-line-visualizer-row.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_CPU_VISUALIZER_ROW (sp_cpu_visualizer_row_get_type())
+#define SYSPROF_TYPE_CPU_VISUALIZER_ROW (sysprof_cpu_visualizer_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpCpuVisualizerRow, sp_cpu_visualizer_row, SP, CPU_VISUALIZER_ROW, SpLineVisualizerRow)
+G_DECLARE_FINAL_TYPE (SysprofCpuVisualizerRow, sysprof_cpu_visualizer_row, SYSPROF, CPU_VISUALIZER_ROW,
SysprofLineVisualizerRow)
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_cpu_visualizer_row_new (void);
+GtkWidget *sysprof_cpu_visualizer_row_new (void);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-empty-state-view.c b/src/libsysprof-ui/sysprof-empty-state-view.c
similarity index 77%
rename from src/libsysprof-ui/sp-empty-state-view.c
rename to src/libsysprof-ui/sysprof-empty-state-view.c
index dc29d59..484b93c 100644
--- a/src/libsysprof-ui/sp-empty-state-view.c
+++ b/src/libsysprof-ui/sysprof-empty-state-view.c
@@ -1,4 +1,4 @@
-/* sp-empty-state-view.c
+/* sysprof-empty-state-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,21 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-empty-state-view"
+#define G_LOG_DOMAIN "sysprof-empty-state-view"
#include "config.h"
#include <string.h>
-#include "sp-empty-state-view.h"
+#include "sysprof-empty-state-view.h"
typedef struct
{
GtkLabel *title;
GtkLabel *subtitle;
-} SpEmptyStateViewPrivate;
+} SysprofEmptyStateViewPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (SpEmptyStateView, sp_empty_state_view, GTK_TYPE_BIN)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofEmptyStateView, sysprof_empty_state_view, GTK_TYPE_BIN)
enum {
PROP_0,
@@ -44,13 +44,13 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
-sp_empty_state_view_new (void)
+sysprof_empty_state_view_new (void)
{
- return g_object_new (SP_TYPE_EMPTY_STATE_VIEW, NULL);
+ return g_object_new (SYSPROF_TYPE_EMPTY_STATE_VIEW, NULL);
}
static gboolean
-sp_empty_state_view_action (GtkWidget *widget,
+sysprof_empty_state_view_action (GtkWidget *widget,
const gchar *prefix,
const gchar *action_name,
GVariant *parameter)
@@ -96,11 +96,11 @@ sp_empty_state_view_action (GtkWidget *widget,
}
static gboolean
-sp_empty_state_view_activate_link (SpEmptyStateView *self,
+sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
const gchar *uri,
GtkLabel *label)
{
- g_assert (SP_IS_EMPTY_STATE_VIEW (self));
+ g_assert (SYSPROF_IS_EMPTY_STATE_VIEW (self));
g_assert (uri != NULL);
g_assert (GTK_IS_LABEL (label));
@@ -127,7 +127,7 @@ sp_empty_state_view_activate_link (SpEmptyStateView *self,
group_name = g_strndup (full_name, dot - full_name);
action_name = g_strdup (++dot);
- sp_empty_state_view_action (GTK_WIDGET (self),
+ sysprof_empty_state_view_action (GTK_WIDGET (self),
group_name,
action_name,
param);
@@ -142,13 +142,13 @@ sp_empty_state_view_activate_link (SpEmptyStateView *self,
}
static void
-sp_empty_state_view_set_property (GObject *object,
+sysprof_empty_state_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpEmptyStateView *self = SP_EMPTY_STATE_VIEW (object);
- SpEmptyStateViewPrivate *priv = sp_empty_state_view_get_instance_private (self);
+ SysprofEmptyStateView *self = SYSPROF_EMPTY_STATE_VIEW (object);
+ SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
switch (prop_id)
{
@@ -166,12 +166,12 @@ sp_empty_state_view_set_property (GObject *object,
}
static void
-sp_empty_state_view_class_init (SpEmptyStateViewClass *klass)
+sysprof_empty_state_view_class_init (SysprofEmptyStateViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->set_property = sp_empty_state_view_set_property;
+ object_class->set_property = sysprof_empty_state_view_set_property;
properties [PROP_TITLE] =
g_param_spec_string ("title",
@@ -189,21 +189,21 @@ sp_empty_state_view_class_init (SpEmptyStateViewClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
- gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sp-empty-state-view.ui");
- gtk_widget_class_bind_template_child_private (widget_class, SpEmptyStateView, subtitle);
- gtk_widget_class_bind_template_child_private (widget_class, SpEmptyStateView, title);
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sysprof-empty-state-view.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, subtitle);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, title);
}
static void
-sp_empty_state_view_init (SpEmptyStateView *self)
+sysprof_empty_state_view_init (SysprofEmptyStateView *self)
{
- SpEmptyStateViewPrivate *priv = sp_empty_state_view_get_instance_private (self);
+ SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
gtk_widget_init_template (GTK_WIDGET (self));
g_signal_connect_object (priv->subtitle,
"activate-link",
- G_CALLBACK (sp_empty_state_view_activate_link),
+ G_CALLBACK (sysprof_empty_state_view_activate_link),
self,
G_CONNECT_SWAPPED);
}
diff --git a/src/libsysprof-ui/sp-empty-state-view.h b/src/libsysprof-ui/sysprof-empty-state-view.h
similarity index 76%
rename from src/libsysprof-ui/sp-empty-state-view.h
rename to src/libsysprof-ui/sysprof-empty-state-view.h
index e2667cf..41711b4 100644
--- a/src/libsysprof-ui/sp-empty-state-view.h
+++ b/src/libsysprof-ui/sysprof-empty-state-view.h
@@ -1,4 +1,4 @@
-/* sp-empty-state-view.h
+/* sysprof-empty-state-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -26,12 +26,12 @@
G_BEGIN_DECLS
-#define SP_TYPE_EMPTY_STATE_VIEW (sp_empty_state_view_get_type())
+#define SYSPROF_TYPE_EMPTY_STATE_VIEW (sysprof_empty_state_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpEmptyStateView, sp_empty_state_view, SP, EMPTY_STATE_VIEW, GtkBin)
+G_DECLARE_DERIVABLE_TYPE (SysprofEmptyStateView, sysprof_empty_state_view, SYSPROF, EMPTY_STATE_VIEW, GtkBin)
-struct _SpEmptyStateViewClass
+struct _SysprofEmptyStateViewClass
{
GtkBinClass parent;
@@ -39,6 +39,6 @@ struct _SpEmptyStateViewClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_empty_state_view_new (void);
+GtkWidget *sysprof_empty_state_view_new (void);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-failed-state-view.c b/src/libsysprof-ui/sysprof-failed-state-view.c
similarity index 71%
rename from src/libsysprof-ui/sp-failed-state-view.c
rename to src/libsysprof-ui/sysprof-failed-state-view.c
index cef7cc3..239eb42 100644
--- a/src/libsysprof-ui/sp-failed-state-view.c
+++ b/src/libsysprof-ui/sysprof-failed-state-view.c
@@ -1,4 +1,4 @@
-/* sp-failed-state-view.c
+/* sysprof-failed-state-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,27 +20,27 @@
#include "config.h"
-#include "sp-failed-state-view.h"
+#include "sysprof-failed-state-view.h"
-G_DEFINE_TYPE (SpFailedStateView, sp_failed_state_view, GTK_TYPE_BIN)
+G_DEFINE_TYPE (SysprofFailedStateView, sysprof_failed_state_view, GTK_TYPE_BIN)
GtkWidget *
-sp_failed_state_view_new (void)
+sysprof_failed_state_view_new (void)
{
- return g_object_new (SP_TYPE_FAILED_STATE_VIEW, NULL);
+ return g_object_new (SYSPROF_TYPE_FAILED_STATE_VIEW, NULL);
}
static void
-sp_failed_state_view_class_init (SpFailedStateViewClass *klass)
+sysprof_failed_state_view_class_init (SysprofFailedStateViewClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gnome/sysprof/ui/sp-failed-state-view.ui");
+ "/org/gnome/sysprof/ui/sysprof-failed-state-view.ui");
}
static void
-sp_failed_state_view_init (SpFailedStateView *self)
+sysprof_failed_state_view_init (SysprofFailedStateView *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
diff --git a/src/libsysprof-ui/sp-recording-state-view.h b/src/libsysprof-ui/sysprof-failed-state-view.h
similarity index 66%
rename from src/libsysprof-ui/sp-recording-state-view.h
rename to src/libsysprof-ui/sysprof-failed-state-view.h
index d05e4b6..252f449 100644
--- a/src/libsysprof-ui/sp-recording-state-view.h
+++ b/src/libsysprof-ui/sysprof-failed-state-view.h
@@ -1,4 +1,4 @@
-/* sp-recording-state-view.h
+/* sysprof-failed-state-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,17 +22,17 @@
#include <gtk/gtk.h>
-#include "sp-profiler.h"
+#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_RECORDING_STATE_VIEW (sp_recording_state_view_get_type())
+#define SYSPROF_TYPE_FAILED_STATE_VIEW (sysprof_failed_state_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpRecordingStateView, sp_recording_state_view, SP, RECORDING_STATE_VIEW, GtkBin)
+G_DECLARE_DERIVABLE_TYPE (SysprofFailedStateView, sysprof_failed_state_view, SYSPROF, FAILED_STATE_VIEW,
GtkBin)
-struct _SpRecordingStateViewClass
+struct _SysprofFailedStateViewClass
{
GtkBinClass parent;
@@ -40,9 +40,9 @@ struct _SpRecordingStateViewClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_recording_state_view_new (void);
+GtkWidget *sysprof_failed_state_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_recording_state_view_set_profiler (SpRecordingStateView *self,
- SpProfiler *profiler);
+void sysprof_failed_state_view_set_profiler (SysprofFailedStateView *self,
+ SysprofProfiler *profiler);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-line-visualizer-row.c b/src/libsysprof-ui/sysprof-line-visualizer-row.c
similarity index 68%
rename from src/libsysprof-ui/sp-line-visualizer-row.c
rename to src/libsysprof-ui/sysprof-line-visualizer-row.c
index 358e544..3f82ef0 100644
--- a/src/libsysprof-ui/sp-line-visualizer-row.c
+++ b/src/libsysprof-ui/sysprof-line-visualizer-row.c
@@ -1,4 +1,4 @@
-/* sp-line-visualizer-row.c
+/* sysprof-line-visualizer-row.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-line-visualizer-row"
+#define G_LOG_DOMAIN "sysprof-line-visualizer-row"
#include "config.h"
@@ -26,16 +26,16 @@
#include <string.h>
#include "pointcache.h"
-#include "sp-capture-condition.h"
-#include "sp-capture-cursor.h"
-#include "sp-line-visualizer-row.h"
+#include "sysprof-capture-condition.h"
+#include "sysprof-capture-cursor.h"
+#include "sysprof-line-visualizer-row.h"
typedef struct
{
/*
* Our reader as assigned by the visualizer system.
*/
- SpCaptureReader *reader;
+ SysprofCaptureReader *reader;
/*
* An array of LineInfo which contains information about the counters
@@ -70,7 +70,7 @@ typedef struct
guint y_lower_set : 1;
guint y_upper_set : 1;
-} SpLineVisualizerRowPrivate;
+} SysprofLineVisualizerRowPrivate;
typedef struct
{
@@ -84,7 +84,7 @@ typedef struct
typedef struct
{
- SpCaptureCursor *cursor;
+ SysprofCaptureCursor *cursor;
GArray *lines;
PointCache *cache;
gint64 begin_time;
@@ -95,13 +95,13 @@ typedef struct
guint y_upper_set : 1;
} LoadData;
-G_DEFINE_TYPE_WITH_PRIVATE (SpLineVisualizerRow, sp_line_visualizer_row, SP_TYPE_VISUALIZER_ROW)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofLineVisualizerRow, sysprof_line_visualizer_row,
SYSPROF_TYPE_VISUALIZER_ROW)
-static void sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
+static void sysprof_line_visualizer_row_load_data_async (SysprofLineVisualizerRow *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-static PointCache *sp_line_visualizer_row_load_data_finish (SpLineVisualizerRow *self,
+static PointCache *sysprof_line_visualizer_row_load_data_finish (SysprofLineVisualizerRow *self,
GAsyncResult *result,
GError **error);
@@ -123,7 +123,7 @@ load_data_free (gpointer data)
if (load != NULL)
{
g_clear_pointer (&load->lines, g_array_unref);
- g_clear_pointer (&load->cursor, sp_capture_cursor_unref);
+ g_clear_pointer (&load->cursor, sysprof_capture_cursor_unref);
g_clear_pointer (&load->cache, point_cache_unref);
g_slice_free (LoadData, load);
}
@@ -142,23 +142,23 @@ copy_array (GArray *ar)
}
static gboolean
-sp_line_visualizer_row_draw (GtkWidget *widget,
+sysprof_line_visualizer_row_draw (GtkWidget *widget,
cairo_t *cr)
{
- SpLineVisualizerRow *self = (SpLineVisualizerRow *)widget;
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)widget;
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
GtkStyleContext *style_context;
GtkStateFlags flags;
GtkAllocation alloc;
GdkRGBA foreground;
gboolean ret;
- g_assert (SP_IS_LINE_VISUALIZER_ROW (widget));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (widget));
g_assert (cr != NULL);
gtk_widget_get_allocation (widget, &alloc);
- ret = GTK_WIDGET_CLASS (sp_line_visualizer_row_parent_class)->draw (widget, cr);
+ ret = GTK_WIDGET_CLASS (sysprof_line_visualizer_row_parent_class)->draw (widget, cr);
if (priv->cache == NULL)
return ret;
@@ -169,7 +169,7 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
for (guint line = 0; line < priv->lines->len; line++)
{
- g_autofree SpVisualizerRowAbsolutePoint *points = NULL;
+ g_autofree SysprofVisualizerRowAbsolutePoint *points = NULL;
const LineInfo *line_info = &g_array_index (priv->lines, LineInfo, line);
const Point *fpoints;
guint n_fpoints = 0;
@@ -182,10 +182,10 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
gdouble last_x;
gdouble last_y;
- points = g_new0 (SpVisualizerRowAbsolutePoint, n_fpoints);
+ points = g_new0 (SysprofVisualizerRowAbsolutePoint, n_fpoints);
- sp_visualizer_row_translate_points (SP_VISUALIZER_ROW (self),
- (const SpVisualizerRowRelativePoint *)fpoints,
+ sysprof_visualizer_row_translate_points (SYSPROF_VISUALIZER_ROW (self),
+ (const SysprofVisualizerRowRelativePoint *)fpoints,
n_fpoints,
points,
n_fpoints);
@@ -244,18 +244,18 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
}
static void
-sp_line_visualizer_row_load_data_cb (GObject *object,
+sysprof_line_visualizer_row_load_data_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- SpLineVisualizerRow *self = (SpLineVisualizerRow *)object;
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)object;
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_autoptr(GError) error = NULL;
g_autoptr(PointCache) cache = NULL;
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
- cache = sp_line_visualizer_row_load_data_finish (self, result, &error);
+ cache = sysprof_line_visualizer_row_load_data_finish (self, result, &error);
if (cache == NULL)
{
@@ -270,20 +270,20 @@ sp_line_visualizer_row_load_data_cb (GObject *object,
}
static gboolean
-sp_line_visualizer_row_do_reload (gpointer data)
+sysprof_line_visualizer_row_do_reload (gpointer data)
{
- SpLineVisualizerRow *self = data;
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = data;
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
priv->queued_load = 0;
if (priv->reader != NULL)
{
- sp_line_visualizer_row_load_data_async (self,
+ sysprof_line_visualizer_row_load_data_async (self,
NULL,
- sp_line_visualizer_row_load_data_cb,
+ sysprof_line_visualizer_row_load_data_cb,
NULL);
}
@@ -291,54 +291,54 @@ sp_line_visualizer_row_do_reload (gpointer data)
}
static void
-sp_line_visualizer_row_queue_reload (SpLineVisualizerRow *self)
+sysprof_line_visualizer_row_queue_reload (SysprofLineVisualizerRow *self)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
if (priv->queued_load == 0)
{
priv->queued_load = gdk_threads_add_idle_full (G_PRIORITY_LOW,
- sp_line_visualizer_row_do_reload,
+ sysprof_line_visualizer_row_do_reload,
self,
NULL);
}
}
static void
-sp_line_visualizer_row_set_reader (SpVisualizerRow *row,
- SpCaptureReader *reader)
+sysprof_line_visualizer_row_set_reader (SysprofVisualizerRow *row,
+ SysprofCaptureReader *reader)
{
- SpLineVisualizerRow *self = (SpLineVisualizerRow *)row;
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)row;
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
if (priv->reader != reader)
{
if (priv->reader != NULL)
{
- sp_capture_reader_unref (priv->reader);
+ sysprof_capture_reader_unref (priv->reader);
priv->reader = NULL;
}
if (reader != NULL)
- priv->reader = sp_capture_reader_ref (reader);
+ priv->reader = sysprof_capture_reader_ref (reader);
- sp_line_visualizer_row_queue_reload (self);
+ sysprof_line_visualizer_row_queue_reload (self);
}
}
static void
-sp_line_visualizer_row_finalize (GObject *object)
+sysprof_line_visualizer_row_finalize (GObject *object)
{
- SpLineVisualizerRow *self = (SpLineVisualizerRow *)object;
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = (SysprofLineVisualizerRow *)object;
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_clear_pointer (&priv->lines, g_array_unref);
g_clear_pointer (&priv->cache, point_cache_unref);
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (priv->queued_load != 0)
{
@@ -346,17 +346,17 @@ sp_line_visualizer_row_finalize (GObject *object)
priv->queued_load = 0;
}
- G_OBJECT_CLASS (sp_line_visualizer_row_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_line_visualizer_row_parent_class)->finalize (object);
}
static void
-sp_line_visualizer_row_get_property (GObject *object,
+sysprof_line_visualizer_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpLineVisualizerRow *self = SP_LINE_VISUALIZER_ROW (object);
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = SYSPROF_LINE_VISUALIZER_ROW (object);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
switch (prop_id)
{
@@ -378,13 +378,13 @@ sp_line_visualizer_row_get_property (GObject *object,
}
static void
-sp_line_visualizer_row_set_property (GObject *object,
+sysprof_line_visualizer_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpLineVisualizerRow *self = SP_LINE_VISUALIZER_ROW (object);
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRow *self = SYSPROF_LINE_VISUALIZER_ROW (object);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
switch (prop_id)
{
@@ -410,19 +410,19 @@ sp_line_visualizer_row_set_property (GObject *object,
}
static void
-sp_line_visualizer_row_class_init (SpLineVisualizerRowClass *klass)
+sysprof_line_visualizer_row_class_init (SysprofLineVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- SpVisualizerRowClass *visualizer_class = SP_VISUALIZER_ROW_CLASS (klass);
+ SysprofVisualizerRowClass *visualizer_class = SYSPROF_VISUALIZER_ROW_CLASS (klass);
- object_class->finalize = sp_line_visualizer_row_finalize;
- object_class->get_property = sp_line_visualizer_row_get_property;
- object_class->set_property = sp_line_visualizer_row_set_property;
+ object_class->finalize = sysprof_line_visualizer_row_finalize;
+ object_class->get_property = sysprof_line_visualizer_row_get_property;
+ object_class->set_property = sysprof_line_visualizer_row_set_property;
- widget_class->draw = sp_line_visualizer_row_draw;
+ widget_class->draw = sysprof_line_visualizer_row_draw;
- visualizer_class->set_reader = sp_line_visualizer_row_set_reader;
+ visualizer_class->set_reader = sysprof_line_visualizer_row_set_reader;
properties [PROP_TITLE] =
g_param_spec_string ("title",
@@ -453,9 +453,9 @@ sp_line_visualizer_row_class_init (SpLineVisualizerRowClass *klass)
}
static void
-sp_line_visualizer_row_init (SpLineVisualizerRow *self)
+sysprof_line_visualizer_row_init (SysprofLineVisualizerRow *self)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
PangoAttrList *attrs = pango_attr_list_new ();
priv->lines = g_array_new (FALSE, FALSE, sizeof (LineInfo));
@@ -474,14 +474,14 @@ sp_line_visualizer_row_init (SpLineVisualizerRow *self)
}
void
-sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
+sysprof_line_visualizer_row_add_counter (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
LineInfo line_info = { 0 };
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
g_assert (priv->lines != NULL);
line_info.id = counter_id;
@@ -500,18 +500,18 @@ sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
g_array_append_val (priv->lines, line_info);
- if (SP_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added)
- SP_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added (self, counter_id);
+ if (SYSPROF_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added)
+ SYSPROF_LINE_VISUALIZER_ROW_GET_CLASS (self)->counter_added (self, counter_id);
- sp_line_visualizer_row_queue_reload (self);
+ sysprof_line_visualizer_row_queue_reload (self);
}
void
-sp_line_visualizer_row_clear (SpLineVisualizerRow *self)
+sysprof_line_visualizer_row_clear (SysprofLineVisualizerRow *self)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
- g_return_if_fail (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
if (priv->lines->len > 0)
g_array_remove_range (priv->lines, 0, priv->lines->len);
@@ -542,7 +542,7 @@ counter_type (LoadData *load,
* We need to keep some information on the counter (by id) so that we
* can track the counters type (which is a 1-byte type id).
*/
- return SP_CAPTURE_COUNTER_DOUBLE;
+ return SYSPROF_CAPTURE_COUNTER_DOUBLE;
}
static inline gdouble
@@ -570,24 +570,24 @@ calc_y_int64 (gint64 lower,
}
static gboolean
-sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
+sysprof_line_visualizer_row_load_data_frame_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
LoadData *load = user_data;
g_assert (frame != NULL);
- g_assert (frame->type == SP_CAPTURE_FRAME_CTRSET ||
- frame->type == SP_CAPTURE_FRAME_CTRDEF);
+ g_assert (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET ||
+ frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
g_assert (load != NULL);
- if (frame->type == SP_CAPTURE_FRAME_CTRSET)
+ if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET)
{
- const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
+ const SysprofCaptureFrameCounterSet *set = (SysprofCaptureFrameCounterSet *)frame;
gdouble x = calc_x (load->begin_time, load->end_time, frame->time);
for (guint i = 0; i < set->n_values; i++)
{
- const SpCaptureCounterValues *group = &set->values[i];
+ const SysprofCaptureCounterValues *group = &set->values[i];
for (guint j = 0; j < G_N_ELEMENTS (group->ids); j++)
{
@@ -597,7 +597,7 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
{
gdouble y;
- if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE)
+ if (counter_type (load, counter_id) == SYSPROF_CAPTURE_COUNTER_DOUBLE)
y = calc_y_double (load->y_lower, load->y_upper, group->values[j].vdbl);
else
y = calc_y_int64 (load->y_lower, load->y_upper, group->values[j].v64);
@@ -612,25 +612,25 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
}
static gboolean
-sp_line_visualizer_row_load_data_range_cb (const SpCaptureFrame *frame,
+sysprof_line_visualizer_row_load_data_range_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
LoadData *load = user_data;
g_assert (frame != NULL);
- g_assert (frame->type == SP_CAPTURE_FRAME_CTRSET ||
- frame->type == SP_CAPTURE_FRAME_CTRDEF);
+ g_assert (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET ||
+ frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF);
g_assert (load != NULL);
g_assert (load->y_upper_set == FALSE ||
load->y_lower_set == FALSE);
- if (frame->type == SP_CAPTURE_FRAME_CTRSET)
+ if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET)
{
- const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
+ const SysprofCaptureFrameCounterSet *set = (SysprofCaptureFrameCounterSet *)frame;
for (guint i = 0; i < set->n_values; i++)
{
- const SpCaptureCounterValues *group = &set->values[i];
+ const SysprofCaptureCounterValues *group = &set->values[i];
for (guint j = 0; j < G_N_ELEMENTS (group->ids); j++)
{
@@ -640,7 +640,7 @@ sp_line_visualizer_row_load_data_range_cb (const SpCaptureFrame *frame,
{
gdouble y;
- if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE)
+ if (counter_type (load, counter_id) == SYSPROF_CAPTURE_COUNTER_DOUBLE)
y = group->values[j].vdbl;
else
y = group->values[j].v64;
@@ -659,7 +659,7 @@ sp_line_visualizer_row_load_data_range_cb (const SpCaptureFrame *frame,
}
static void
-sp_line_visualizer_row_load_data_worker (GTask *task,
+sysprof_line_visualizer_row_load_data_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
@@ -668,7 +668,7 @@ sp_line_visualizer_row_load_data_worker (GTask *task,
g_autoptr(GArray) counter_ids = NULL;
g_assert (G_IS_TASK (task));
- g_assert (SP_IS_LINE_VISUALIZER_ROW (source_object));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (source_object));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
counter_ids = g_array_new (FALSE, FALSE, sizeof (guint));
@@ -679,41 +679,41 @@ sp_line_visualizer_row_load_data_worker (GTask *task,
g_array_append_val (counter_ids, line_info->id);
}
- sp_capture_cursor_add_condition (load->cursor,
- sp_capture_condition_new_where_counter_in (counter_ids->len,
+ sysprof_capture_cursor_add_condition (load->cursor,
+ sysprof_capture_condition_new_where_counter_in (counter_ids->len,
(guint
*)(gpointer)counter_ids->data));
/* If y boundaries are not set, we need to discover them by scaning the data. */
if (!load->y_lower_set || !load->y_upper_set)
{
- sp_capture_cursor_foreach (load->cursor, sp_line_visualizer_row_load_data_range_cb, load);
- sp_capture_cursor_reset (load->cursor);
+ sysprof_capture_cursor_foreach (load->cursor, sysprof_line_visualizer_row_load_data_range_cb, load);
+ sysprof_capture_cursor_reset (load->cursor);
/* Add extra boundary for some space above the graph line */
if (G_MAXDOUBLE - load->y_upper > (load->y_upper * .25))
load->y_upper *= 1.25;
}
- sp_capture_cursor_foreach (load->cursor, sp_line_visualizer_row_load_data_frame_cb, load);
+ sysprof_capture_cursor_foreach (load->cursor, sysprof_line_visualizer_row_load_data_frame_cb, load);
g_task_return_pointer (task, g_steal_pointer (&load->cache), (GDestroyNotify)point_cache_unref);
}
static void
-sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
+sysprof_line_visualizer_row_load_data_async (SysprofLineVisualizerRow *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
g_autoptr(GTask) task = NULL;
LoadData *load;
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_priority (task, G_PRIORITY_LOW);
- g_task_set_source_tag (task, sp_line_visualizer_row_load_data_async);
+ g_task_set_source_tag (task, sysprof_line_visualizer_row_load_data_async);
if (priv->reader == NULL)
{
@@ -730,9 +730,9 @@ sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
load->y_upper = priv->y_upper;
load->y_lower_set = priv->y_lower_set;
load->y_upper_set = priv->y_upper_set;
- load->begin_time = sp_capture_reader_get_start_time (priv->reader);
- load->end_time = sp_capture_reader_get_end_time (priv->reader);
- load->cursor = sp_capture_cursor_new (priv->reader);
+ load->begin_time = sysprof_capture_reader_get_start_time (priv->reader);
+ load->end_time = sysprof_capture_reader_get_end_time (priv->reader);
+ load->cursor = sysprof_capture_cursor_new (priv->reader);
load->lines = copy_array (priv->lines);
for (guint i = 0; i < load->lines->len; i++)
@@ -743,18 +743,18 @@ sp_line_visualizer_row_load_data_async (SpLineVisualizerRow *self,
}
g_task_set_task_data (task, load, load_data_free);
- g_task_run_in_thread (task, sp_line_visualizer_row_load_data_worker);
+ g_task_run_in_thread (task, sysprof_line_visualizer_row_load_data_worker);
}
static PointCache *
-sp_line_visualizer_row_load_data_finish (SpLineVisualizerRow *self,
+sysprof_line_visualizer_row_load_data_finish (SysprofLineVisualizerRow *self,
GAsyncResult *result,
GError **error)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
LoadData *state;
- g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
g_assert (G_IS_TASK (result));
state = g_task_get_task_data (G_TASK (result));
@@ -775,13 +775,13 @@ sp_line_visualizer_row_load_data_finish (SpLineVisualizerRow *self,
}
void
-sp_line_visualizer_row_set_line_width (SpLineVisualizerRow *self,
+sysprof_line_visualizer_row_set_line_width (SysprofLineVisualizerRow *self,
guint counter_id,
gdouble width)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
- g_return_if_fail (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
for (guint i = 0; i < priv->lines->len; i++)
{
@@ -790,20 +790,20 @@ sp_line_visualizer_row_set_line_width (SpLineVisualizerRow *self,
if (info->id == counter_id)
{
info->line_width = width;
- sp_line_visualizer_row_queue_reload (self);
+ sysprof_line_visualizer_row_queue_reload (self);
break;
}
}
}
void
-sp_line_visualizer_row_set_fill (SpLineVisualizerRow *self,
+sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color)
{
- SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
+ SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
- g_return_if_fail (SP_IS_LINE_VISUALIZER_ROW (self));
+ g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
for (guint i = 0; i < priv->lines->len; i++)
{
@@ -814,7 +814,7 @@ sp_line_visualizer_row_set_fill (SpLineVisualizerRow *self,
info->fill = !!color;
if (color != NULL)
info->background = *color;
- sp_line_visualizer_row_queue_reload (self);
+ sysprof_line_visualizer_row_queue_reload (self);
break;
}
}
diff --git a/src/libsysprof-ui/sp-line-visualizer-row.h b/src/libsysprof-ui/sysprof-line-visualizer-row.h
similarity index 65%
rename from src/libsysprof-ui/sp-line-visualizer-row.h
rename to src/libsysprof-ui/sysprof-line-visualizer-row.h
index fff8f11..d9ced27 100644
--- a/src/libsysprof-ui/sp-line-visualizer-row.h
+++ b/src/libsysprof-ui/sysprof-line-visualizer-row.h
@@ -1,4 +1,4 @@
-/* sp-line-visualizer-row.h
+/* sysprof-line-visualizer-row.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -20,21 +20,21 @@
#pragma once
-#include "sp-visualizer-row.h"
+#include "sysprof-visualizer-row.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_LINE_VISUALIZER_ROW (sp_line_visualizer_row_get_type())
+#define SYSPROF_TYPE_LINE_VISUALIZER_ROW (sysprof_line_visualizer_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpLineVisualizerRow, sp_line_visualizer_row, SP, LINE_VISUALIZER_ROW,
SpVisualizerRow)
+G_DECLARE_DERIVABLE_TYPE (SysprofLineVisualizerRow, sysprof_line_visualizer_row, SYSPROF,
LINE_VISUALIZER_ROW, SysprofVisualizerRow)
-struct _SpLineVisualizerRowClass
+struct _SysprofLineVisualizerRowClass
{
- SpVisualizerRowClass parent_class;
+ SysprofVisualizerRowClass parent_class;
- void (*counter_added) (SpLineVisualizerRow *self,
+ void (*counter_added) (SysprofLineVisualizerRow *self,
guint counter_id);
/*< private >*/
@@ -42,19 +42,19 @@ struct _SpLineVisualizerRowClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_line_visualizer_row_new (void);
+GtkWidget *sysprof_line_visualizer_row_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_line_visualizer_row_clear (SpLineVisualizerRow *self);
+void sysprof_line_visualizer_row_clear (SysprofLineVisualizerRow *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_line_visualizer_row_add_counter (SpLineVisualizerRow *self,
+void sysprof_line_visualizer_row_add_counter (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color);
SYSPROF_AVAILABLE_IN_ALL
-void sp_line_visualizer_row_set_line_width (SpLineVisualizerRow *self,
+void sysprof_line_visualizer_row_set_line_width (SysprofLineVisualizerRow *self,
guint counter_id,
gdouble width);
SYSPROF_AVAILABLE_IN_ALL
-void sp_line_visualizer_row_set_fill (SpLineVisualizerRow *self,
+void sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
guint counter_id,
const GdkRGBA *color);
diff --git a/src/libsysprof-ui/sp-mark-visualizer-row.c b/src/libsysprof-ui/sysprof-mark-visualizer-row.c
similarity index 65%
rename from src/libsysprof-ui/sp-mark-visualizer-row.c
rename to src/libsysprof-ui/sysprof-mark-visualizer-row.c
index 9aa68e7..d773657 100644
--- a/src/libsysprof-ui/sp-mark-visualizer-row.c
+++ b/src/libsysprof-ui/sysprof-mark-visualizer-row.c
@@ -1,4 +1,4 @@
-/* sp-mark-visualizer-row.c
+/* sysprof-mark-visualizer-row.c
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -18,21 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-mark-visualizer-row"
+#define G_LOG_DOMAIN "sysprof-mark-visualizer-row"
#include "config.h"
-#include "sp-capture-condition.h"
-#include "sp-capture-cursor.h"
+#include "sysprof-capture-condition.h"
+#include "sysprof-capture-cursor.h"
#include "rectangles.h"
-#include "sp-mark-visualizer-row.h"
+#include "sysprof-mark-visualizer-row.h"
typedef struct
{
/*
* Our reader as assigned by the visualizer system.
*/
- SpCaptureReader *reader;
+ SysprofCaptureReader *reader;
/*
* The group we care about for displaying marks. The idea is that we only
@@ -51,12 +51,12 @@ typedef struct
* Child widget to display the label in the upper corner.
*/
GtkLabel *label;
-} SpMarkVisualizerRowPrivate;
+} SysprofMarkVisualizerRowPrivate;
typedef struct
{
gchar *group;
- SpCaptureCursor *cursor;
+ SysprofCaptureCursor *cursor;
Rectangles *rects;
GHashTable *inferred_rects;
} BuildState;
@@ -74,7 +74,7 @@ enum {
N_PROPS
};
-G_DEFINE_TYPE_WITH_PRIVATE (SpMarkVisualizerRow, sp_mark_visualizer_row, SP_TYPE_VISUALIZER_ROW)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofMarkVisualizerRow, sysprof_mark_visualizer_row,
SYSPROF_TYPE_VISUALIZER_ROW)
static GParamSpec *properties [N_PROPS];
@@ -116,7 +116,7 @@ build_state_free (BuildState *state)
*/
static gboolean
process_gpu_mark (BuildState *state,
- const SpCaptureMark *mark)
+ const SysprofCaptureMark *mark)
{
InferredRect *rect = g_hash_table_lookup (state->inferred_rects,
mark->message);
@@ -167,14 +167,14 @@ process_gpu_mark (BuildState *state,
static gboolean
-sp_mark_visualizer_row_add_rect (const SpCaptureFrame *frame,
+sysprof_mark_visualizer_row_add_rect (const SysprofCaptureFrame *frame,
gpointer user_data)
{
BuildState *state = user_data;
- const SpCaptureMark *mark = (const SpCaptureMark *)frame;
+ const SysprofCaptureMark *mark = (const SysprofCaptureMark *)frame;
g_assert (frame != NULL);
- g_assert (frame->type == SP_CAPTURE_FRAME_MARK);
+ g_assert (frame->type == SYSPROF_CAPTURE_FRAME_MARK);
g_assert (state != NULL);
g_assert (state->rects != NULL);
@@ -195,7 +195,7 @@ sp_mark_visualizer_row_add_rect (const SpCaptureFrame *frame,
}
static void
-sp_mark_visualizer_row_worker (GTask *task,
+sysprof_mark_visualizer_row_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
@@ -206,11 +206,11 @@ sp_mark_visualizer_row_worker (GTask *task,
gint64 end_time;
g_assert (G_IS_TASK (task));
- g_assert (SP_IS_MARK_VISUALIZER_ROW (source_object));
+ g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (source_object));
g_assert (state != NULL);
g_assert (state->cursor != NULL);
- sp_capture_cursor_foreach (state->cursor, sp_mark_visualizer_row_add_rect, state);
+ sysprof_capture_cursor_foreach (state->cursor, sysprof_mark_visualizer_row_add_rect, state);
/* If any inferred rects are left incomplete, just drop them in as
* point events for now.
@@ -224,22 +224,22 @@ sp_mark_visualizer_row_worker (GTask *task,
}
g_hash_table_remove_all (state->inferred_rects);
- end_time = sp_capture_reader_get_end_time (sp_capture_cursor_get_reader (state->cursor));
+ end_time = sysprof_capture_reader_get_end_time (sysprof_capture_cursor_get_reader (state->cursor));
rectangles_set_end_time (state->rects, end_time);
g_task_return_pointer (task, g_steal_pointer (&state->rects), (GDestroyNotify)rectangles_free);
}
static gboolean
-sp_mark_visualizer_row_query_tooltip (GtkWidget *widget,
+sysprof_mark_visualizer_row_query_tooltip (GtkWidget *widget,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip *tooltip)
{
- SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)widget;
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)widget;
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
- g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
if (priv->rectangles == NULL)
return FALSE;
@@ -248,23 +248,23 @@ sp_mark_visualizer_row_query_tooltip (GtkWidget *widget,
}
static gboolean
-sp_mark_visualizer_row_draw (GtkWidget *widget,
+sysprof_mark_visualizer_row_draw (GtkWidget *widget,
cairo_t *cr)
{
- SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)widget;
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)widget;
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
GtkStyleContext *style_context;
GtkStateFlags flags;
GdkRGBA foreground;
GtkAllocation alloc;
gboolean ret;
- g_assert (SP_IS_MARK_VISUALIZER_ROW (widget));
+ g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (widget));
g_assert (cr != NULL);
gtk_widget_get_allocation (widget, &alloc);
- ret = GTK_WIDGET_CLASS (sp_mark_visualizer_row_parent_class)->draw (widget, cr);
+ ret = GTK_WIDGET_CLASS (sysprof_mark_visualizer_row_parent_class)->draw (widget, cr);
if (priv->rectangles == NULL)
return ret;
@@ -283,10 +283,10 @@ data_load_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)object;
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)object;
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
- g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
g_assert (G_IS_TASK (result));
g_clear_pointer (&priv->rectangles, rectangles_free);
@@ -295,21 +295,21 @@ data_load_cb (GObject *object,
}
static void
-sp_mark_visualizer_row_reload (SpMarkVisualizerRow *self)
+sysprof_mark_visualizer_row_reload (SysprofMarkVisualizerRow *self)
{
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
- g_autoptr(SpCaptureCursor) cursor = NULL;
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
+ g_autoptr(SysprofCaptureCursor) cursor = NULL;
g_autoptr(GTask) task = NULL;
- SpCaptureCondition *condition;
+ SysprofCaptureCondition *condition;
BuildState *state;
- g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
g_clear_pointer (&priv->rectangles, rectangles_free);
- condition = sp_capture_condition_new_where_type_in (1, (SpCaptureFrameType[]) { SP_CAPTURE_FRAME_MARK });
- cursor = sp_capture_cursor_new (priv->reader);
- sp_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
+ condition = sysprof_capture_condition_new_where_type_in (1, (SysprofCaptureFrameType[]) {
SYSPROF_CAPTURE_FRAME_MARK });
+ cursor = sysprof_capture_cursor_new (priv->reader);
+ sysprof_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
state = g_slice_new0 (BuildState);
state->inferred_rects = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -317,57 +317,57 @@ sp_mark_visualizer_row_reload (SpMarkVisualizerRow *self)
(GDestroyNotify)free_inferred_rect);
state->group = g_strdup (priv->group);
state->cursor = g_steal_pointer (&cursor);
- state->rects = rectangles_new (sp_capture_reader_get_start_time (priv->reader),
- sp_capture_reader_get_end_time (priv->reader));
+ state->rects = rectangles_new (sysprof_capture_reader_get_start_time (priv->reader),
+ sysprof_capture_reader_get_end_time (priv->reader));
task = g_task_new (self, NULL, data_load_cb, NULL);
g_task_set_task_data (task, state, (GDestroyNotify)build_state_free);
- g_task_run_in_thread (task, sp_mark_visualizer_row_worker);
+ g_task_run_in_thread (task, sysprof_mark_visualizer_row_worker);
}
static void
-sp_mark_visualizer_row_set_reader (SpVisualizerRow *row,
- SpCaptureReader *reader)
+sysprof_mark_visualizer_row_set_reader (SysprofVisualizerRow *row,
+ SysprofCaptureReader *reader)
{
- SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)row;
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)row;
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
- g_assert (SP_IS_MARK_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
if (reader != priv->reader)
{
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
- priv->reader = sp_capture_reader_ref (reader);
- sp_mark_visualizer_row_reload (self);
+ priv->reader = sysprof_capture_reader_ref (reader);
+ sysprof_mark_visualizer_row_reload (self);
}
}
static void
-sp_mark_visualizer_row_finalize (GObject *object)
+sysprof_mark_visualizer_row_finalize (GObject *object)
{
- SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)object;
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = (SysprofMarkVisualizerRow *)object;
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
g_clear_pointer (&priv->group, g_free);
g_clear_pointer (&priv->rectangles, rectangles_free);
- G_OBJECT_CLASS (sp_mark_visualizer_row_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_mark_visualizer_row_parent_class)->finalize (object);
}
static void
-sp_mark_visualizer_row_get_property (GObject *object,
+sysprof_mark_visualizer_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpMarkVisualizerRow *self = SP_MARK_VISUALIZER_ROW (object);
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = SYSPROF_MARK_VISUALIZER_ROW (object);
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
switch (prop_id)
{
case PROP_GROUP:
- g_value_set_string (value, sp_mark_visualizer_row_get_group (self));
+ g_value_set_string (value, sysprof_mark_visualizer_row_get_group (self));
break;
case PROP_TITLE:
@@ -380,18 +380,18 @@ sp_mark_visualizer_row_get_property (GObject *object,
}
static void
-sp_mark_visualizer_row_set_property (GObject *object,
+sysprof_mark_visualizer_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpMarkVisualizerRow *self = SP_MARK_VISUALIZER_ROW (object);
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRow *self = SYSPROF_MARK_VISUALIZER_ROW (object);
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
switch (prop_id)
{
case PROP_GROUP:
- sp_mark_visualizer_row_set_group (self, g_value_get_string (value));
+ sysprof_mark_visualizer_row_set_group (self, g_value_get_string (value));
break;
case PROP_TITLE:
@@ -404,20 +404,20 @@ sp_mark_visualizer_row_set_property (GObject *object,
}
static void
-sp_mark_visualizer_row_class_init (SpMarkVisualizerRowClass *klass)
+sysprof_mark_visualizer_row_class_init (SysprofMarkVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- SpVisualizerRowClass *visualizer_class = SP_VISUALIZER_ROW_CLASS (klass);
+ SysprofVisualizerRowClass *visualizer_class = SYSPROF_VISUALIZER_ROW_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = sp_mark_visualizer_row_finalize;
- object_class->get_property = sp_mark_visualizer_row_get_property;
- object_class->set_property = sp_mark_visualizer_row_set_property;
+ object_class->finalize = sysprof_mark_visualizer_row_finalize;
+ object_class->get_property = sysprof_mark_visualizer_row_get_property;
+ object_class->set_property = sysprof_mark_visualizer_row_set_property;
- widget_class->draw = sp_mark_visualizer_row_draw;
- widget_class->query_tooltip = sp_mark_visualizer_row_query_tooltip;
+ widget_class->draw = sysprof_mark_visualizer_row_draw;
+ widget_class->query_tooltip = sysprof_mark_visualizer_row_query_tooltip;
- visualizer_class->set_reader = sp_mark_visualizer_row_set_reader;
+ visualizer_class->set_reader = sysprof_mark_visualizer_row_set_reader;
properties [PROP_GROUP] =
g_param_spec_string ("group",
@@ -437,9 +437,9 @@ sp_mark_visualizer_row_class_init (SpMarkVisualizerRowClass *klass)
}
static void
-sp_mark_visualizer_row_init (SpMarkVisualizerRow *self)
+sysprof_mark_visualizer_row_init (SysprofMarkVisualizerRow *self)
{
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
PangoAttrList *attrs = pango_attr_list_new ();
gtk_widget_set_has_tooltip (GTK_WIDGET (self), TRUE);
@@ -458,28 +458,28 @@ sp_mark_visualizer_row_init (SpMarkVisualizerRow *self)
}
GtkWidget *
-sp_mark_visualizer_row_new (void)
+sysprof_mark_visualizer_row_new (void)
{
- return g_object_new (SP_TYPE_MARK_VISUALIZER_ROW, NULL);
+ return g_object_new (SYSPROF_TYPE_MARK_VISUALIZER_ROW, NULL);
}
const gchar *
-sp_mark_visualizer_row_get_group (SpMarkVisualizerRow *self)
+sysprof_mark_visualizer_row_get_group (SysprofMarkVisualizerRow *self)
{
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
- g_return_val_if_fail (SP_IS_MARK_VISUALIZER_ROW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_MARK_VISUALIZER_ROW (self), NULL);
return priv->group;
}
void
-sp_mark_visualizer_row_set_group (SpMarkVisualizerRow *self,
+sysprof_mark_visualizer_row_set_group (SysprofMarkVisualizerRow *self,
const gchar *group)
{
- SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
+ SysprofMarkVisualizerRowPrivate *priv = sysprof_mark_visualizer_row_get_instance_private (self);
- g_return_if_fail (SP_IS_MARK_VISUALIZER_ROW (self));
+ g_return_if_fail (SYSPROF_IS_MARK_VISUALIZER_ROW (self));
if (g_strcmp0 (priv->group, group) != 0)
{
diff --git a/src/libsysprof-ui/sp-mark-visualizer-row.h b/src/libsysprof-ui/sysprof-mark-visualizer-row.h
similarity index 64%
rename from src/libsysprof-ui/sp-mark-visualizer-row.h
rename to src/libsysprof-ui/sysprof-mark-visualizer-row.h
index 6c504ee..9069e2d 100644
--- a/src/libsysprof-ui/sp-mark-visualizer-row.h
+++ b/src/libsysprof-ui/sysprof-mark-visualizer-row.h
@@ -1,4 +1,4 @@
-/* sp-mark-visualizer-row.h
+/* sysprof-mark-visualizer-row.h
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -20,30 +20,30 @@
#pragma once
-#include "sp-visualizer-row.h"
+#include "sysprof-visualizer-row.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_MARK_VISUALIZER_ROW (sp_mark_visualizer_row_get_type())
+#define SYSPROF_TYPE_MARK_VISUALIZER_ROW (sysprof_mark_visualizer_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpMarkVisualizerRow, sp_mark_visualizer_row, SP, MARK_VISUALIZER_ROW,
SpVisualizerRow)
+G_DECLARE_DERIVABLE_TYPE (SysprofMarkVisualizerRow, sysprof_mark_visualizer_row, SYSPROF,
MARK_VISUALIZER_ROW, SysprofVisualizerRow)
-struct _SpMarkVisualizerRowClass
+struct _SysprofMarkVisualizerRowClass
{
- SpVisualizerRowClass parent_class;
+ SysprofVisualizerRowClass parent_class;
/*< private >*/
gpointer _reserved[16];
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_mark_visualizer_row_new (void);
+GtkWidget *sysprof_mark_visualizer_row_new (void);
SYSPROF_AVAILABLE_IN_ALL
-const gchar *sp_mark_visualizer_row_get_group (SpMarkVisualizerRow *self);
+const gchar *sysprof_mark_visualizer_row_get_group (SysprofMarkVisualizerRow *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_mark_visualizer_row_set_group (SpMarkVisualizerRow *self,
+void sysprof_mark_visualizer_row_set_group (SysprofMarkVisualizerRow *self,
const gchar *group);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-model-filter.c b/src/libsysprof-ui/sysprof-model-filter.c
similarity index 72%
rename from src/libsysprof-ui/sp-model-filter.c
rename to src/libsysprof-ui/sysprof-model-filter.c
index 0e183ce..48c9386 100644
--- a/src/libsysprof-ui/sp-model-filter.c
+++ b/src/libsysprof-ui/sysprof-model-filter.c
@@ -1,4 +1,4 @@
-/* sp-model-filter.c
+/* sysprof-model-filter.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -20,13 +20,13 @@
#include "config.h"
-#include "sp-model-filter.h"
+#include "sysprof-model-filter.h"
typedef struct
{
GSequenceIter *child_iter;
GSequenceIter *filter_iter;
-} SpModelFilterItem;
+} SysprofModelFilterItem;
typedef struct
{
@@ -34,7 +34,7 @@ typedef struct
GListModel *child_model;
/*
- * Both sequences point to the same SpModelFilterItem which
+ * Both sequences point to the same SysprofModelFilterItem which
* contains cross-referencing stable GSequenceIter pointers.
* The child_seq is considered the "owner" and used to release
* allocated resources.
@@ -46,7 +46,7 @@ typedef struct
* Typical set of callback/closure/free function pointers and data.
* Called for child items to determine visibility state.
*/
- SpModelFilterFunc filter_func;
+ SysprofModelFilterFunc filter_func;
gpointer filter_func_data;
GDestroyNotify filter_func_data_destroy;
@@ -56,12 +56,12 @@ typedef struct
* that have changed.
*/
guint supress_items_changed : 1;
-} SpModelFilterPrivate;
+} SysprofModelFilterPrivate;
static void list_model_iface_init (GListModelInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpModelFilter, sp_model_filter, G_TYPE_OBJECT, 0,
- G_ADD_PRIVATE (SpModelFilter)
+G_DEFINE_TYPE_EXTENDED (SysprofModelFilter, sysprof_model_filter, G_TYPE_OBJECT, 0,
+ G_ADD_PRIVATE (SysprofModelFilter)
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
list_model_iface_init))
@@ -75,17 +75,17 @@ static GParamSpec *properties [N_PROPS];
static guint signal_id;
static void
-sp_model_filter_item_free (gpointer data)
+sysprof_model_filter_item_free (gpointer data)
{
- SpModelFilterItem *item = data;
+ SysprofModelFilterItem *item = data;
g_clear_pointer (&item->filter_iter, g_sequence_remove);
item->child_iter = NULL;
- g_slice_free (SpModelFilterItem, item);
+ g_slice_free (SysprofModelFilterItem, item);
}
static gboolean
-sp_model_filter_default_filter_func (GObject *item,
+sysprof_model_filter_default_filter_func (GObject *item,
gpointer user_data)
{
return TRUE;
@@ -101,17 +101,17 @@ sp_model_filter_default_filter_func (GObject *item,
* Returns: a #GSequenceIter from the filter sequence.
*/
static GSequenceIter *
-find_next_visible_filter_iter (SpModelFilter *self,
+find_next_visible_filter_iter (SysprofModelFilter *self,
GSequenceIter *iter)
{
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
- g_assert (SP_IS_MODEL_FILTER (self));
+ g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (iter != NULL);
for (; !g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
{
- SpModelFilterItem *item = g_sequence_get (iter);
+ SysprofModelFilterItem *item = g_sequence_get (iter);
g_assert (item->child_iter == iter);
g_assert (item->filter_iter == NULL ||
@@ -125,16 +125,16 @@ find_next_visible_filter_iter (SpModelFilter *self,
}
static void
-sp_model_filter_child_model_items_changed (SpModelFilter *self,
+sysprof_model_filter_child_model_items_changed (SysprofModelFilter *self,
guint position,
guint n_removed,
guint n_added,
GListModel *child_model)
{
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
gboolean unblocked;
- g_assert (SP_IS_MODEL_FILTER (self));
+ g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (G_IS_LIST_MODEL (child_model));
g_assert (priv->child_model == child_model);
g_assert (position <= (guint)g_sequence_get_length (priv->child_seq));
@@ -164,7 +164,7 @@ sp_model_filter_child_model_items_changed (SpModelFilter *self,
for (guint i = 0; i < n_removed; i++)
{
GSequenceIter *to_remove = iter;
- SpModelFilterItem *item = g_sequence_get (iter);
+ SysprofModelFilterItem *item = g_sequence_get (iter);
g_assert (item != NULL);
g_assert (item->child_iter == iter);
@@ -207,9 +207,9 @@ add_new_items:
for (guint i = position + n_added; i > position; i--)
{
g_autoptr(GObject) instance = NULL;
- SpModelFilterItem *item;
+ SysprofModelFilterItem *item;
- item = g_slice_new0 (SpModelFilterItem);
+ item = g_slice_new0 (SysprofModelFilterItem);
item->filter_iter = NULL;
item->child_iter = g_sequence_insert_before (iter, item);
@@ -240,10 +240,10 @@ add_new_items:
}
static void
-sp_model_filter_finalize (GObject *object)
+sysprof_model_filter_finalize (GObject *object)
{
- SpModelFilter *self = (SpModelFilter *)object;
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilter *self = (SysprofModelFilter *)object;
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
g_clear_pointer (&priv->child_seq, g_sequence_free);
g_clear_pointer (&priv->filter_seq, g_sequence_free);
@@ -256,21 +256,21 @@ sp_model_filter_finalize (GObject *object)
g_clear_object (&priv->child_model);
- G_OBJECT_CLASS (sp_model_filter_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_model_filter_parent_class)->finalize (object);
}
static void
-sp_model_filter_get_property (GObject *object,
+sysprof_model_filter_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpModelFilter *self = SP_MODEL_FILTER (object);
+ SysprofModelFilter *self = SYSPROF_MODEL_FILTER (object);
switch (prop_id)
{
case PROP_CHILD_MODEL:
- g_value_set_object (value, sp_model_filter_get_child_model (self));
+ g_value_set_object (value, sysprof_model_filter_get_child_model (self));
break;
default:
@@ -279,12 +279,12 @@ sp_model_filter_get_property (GObject *object,
}
static void
-sp_model_filter_class_init (SpModelFilterClass *klass)
+sysprof_model_filter_class_init (SysprofModelFilterClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_model_filter_finalize;
- object_class->get_property = sp_model_filter_get_property;
+ object_class->finalize = sysprof_model_filter_finalize;
+ object_class->get_property = sysprof_model_filter_get_property;
properties [PROP_CHILD_MODEL] =
g_param_spec_object ("child-model",
@@ -295,53 +295,53 @@ sp_model_filter_class_init (SpModelFilterClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
- signal_id = g_signal_lookup ("items-changed", SP_TYPE_MODEL_FILTER);
+ signal_id = g_signal_lookup ("items-changed", SYSPROF_TYPE_MODEL_FILTER);
}
static void
-sp_model_filter_init (SpModelFilter *self)
+sysprof_model_filter_init (SysprofModelFilter *self)
{
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
- priv->filter_func = sp_model_filter_default_filter_func;
- priv->child_seq = g_sequence_new (sp_model_filter_item_free);
+ priv->filter_func = sysprof_model_filter_default_filter_func;
+ priv->child_seq = g_sequence_new (sysprof_model_filter_item_free);
priv->filter_seq = g_sequence_new (NULL);
}
static GType
-sp_model_filter_get_item_type (GListModel *model)
+sysprof_model_filter_get_item_type (GListModel *model)
{
- SpModelFilter *self = (SpModelFilter *)model;
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilter *self = (SysprofModelFilter *)model;
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
- g_assert (SP_IS_MODEL_FILTER (self));
+ g_assert (SYSPROF_IS_MODEL_FILTER (self));
return g_list_model_get_item_type (priv->child_model);
}
static guint
-sp_model_filter_get_n_items (GListModel *model)
+sysprof_model_filter_get_n_items (GListModel *model)
{
- SpModelFilter *self = (SpModelFilter *)model;
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilter *self = (SysprofModelFilter *)model;
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
- g_assert (SP_IS_MODEL_FILTER (self));
+ g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (priv->filter_seq != NULL);
return g_sequence_get_length (priv->filter_seq);
}
static gpointer
-sp_model_filter_get_item (GListModel *model,
+sysprof_model_filter_get_item (GListModel *model,
guint position)
{
- SpModelFilter *self = (SpModelFilter *)model;
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
- SpModelFilterItem *item;
+ SysprofModelFilter *self = (SysprofModelFilter *)model;
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
+ SysprofModelFilterItem *item;
GSequenceIter *iter;
guint child_position;
- g_assert (SP_IS_MODEL_FILTER (self));
+ g_assert (SYSPROF_IS_MODEL_FILTER (self));
g_assert (position < (guint)g_sequence_get_length (priv->filter_seq));
iter = g_sequence_get_iter_at_pos (priv->filter_seq, position);
@@ -361,59 +361,59 @@ sp_model_filter_get_item (GListModel *model,
static void
list_model_iface_init (GListModelInterface *iface)
{
- iface->get_item_type = sp_model_filter_get_item_type;
- iface->get_n_items = sp_model_filter_get_n_items;
- iface->get_item = sp_model_filter_get_item;
+ iface->get_item_type = sysprof_model_filter_get_item_type;
+ iface->get_n_items = sysprof_model_filter_get_n_items;
+ iface->get_item = sysprof_model_filter_get_item;
}
-SpModelFilter *
-sp_model_filter_new (GListModel *child_model)
+SysprofModelFilter *
+sysprof_model_filter_new (GListModel *child_model)
{
- SpModelFilter *ret;
- SpModelFilterPrivate *priv;
+ SysprofModelFilter *ret;
+ SysprofModelFilterPrivate *priv;
g_return_val_if_fail (G_IS_LIST_MODEL (child_model), NULL);
- ret = g_object_new (SP_TYPE_MODEL_FILTER, NULL);
- priv = sp_model_filter_get_instance_private (ret);
+ ret = g_object_new (SYSPROF_TYPE_MODEL_FILTER, NULL);
+ priv = sysprof_model_filter_get_instance_private (ret);
priv->child_model = g_object_ref (child_model);
g_signal_connect_object (child_model,
"items-changed",
- G_CALLBACK (sp_model_filter_child_model_items_changed),
+ G_CALLBACK (sysprof_model_filter_child_model_items_changed),
ret,
G_CONNECT_SWAPPED);
- sp_model_filter_invalidate (ret);
+ sysprof_model_filter_invalidate (ret);
return ret;
}
/**
- * sp_model_filter_get_child_model:
- * @self: A #SpModelFilter
+ * sysprof_model_filter_get_child_model:
+ * @self: A #SysprofModelFilter
*
* Gets the child model that is being filtered.
*
* Returns: (transfer none): A #GListModel.
*/
GListModel *
-sp_model_filter_get_child_model (SpModelFilter *self)
+sysprof_model_filter_get_child_model (SysprofModelFilter *self)
{
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
- g_return_val_if_fail (SP_IS_MODEL_FILTER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_MODEL_FILTER (self), NULL);
return priv->child_model;
}
void
-sp_model_filter_invalidate (SpModelFilter *self)
+sysprof_model_filter_invalidate (SysprofModelFilter *self)
{
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
guint n_items;
- g_return_if_fail (SP_IS_MODEL_FILTER (self));
+ g_return_if_fail (SYSPROF_IS_MODEL_FILTER (self));
/* We block emission while in invalidate so that we can use
* a single larger items-changed rather lots of small emissions.
@@ -448,7 +448,7 @@ sp_model_filter_invalidate (SpModelFilter *self)
* we get populate our sequence and filter sequence.
*/
child_n_items = g_list_model_get_n_items (priv->child_model);
- sp_model_filter_child_model_items_changed (self, 0, 0, child_n_items, priv->child_model);
+ sysprof_model_filter_child_model_items_changed (self, 0, 0, child_n_items, priv->child_model);
g_assert ((guint)g_sequence_get_length (priv->child_seq) == child_n_items);
g_assert ((guint)g_sequence_get_length (priv->filter_seq) <= child_n_items);
@@ -467,14 +467,14 @@ sp_model_filter_invalidate (SpModelFilter *self)
}
void
-sp_model_filter_set_filter_func (SpModelFilter *self,
- SpModelFilterFunc filter_func,
+sysprof_model_filter_set_filter_func (SysprofModelFilter *self,
+ SysprofModelFilterFunc filter_func,
gpointer filter_func_data,
GDestroyNotify filter_func_data_destroy)
{
- SpModelFilterPrivate *priv = sp_model_filter_get_instance_private (self);
+ SysprofModelFilterPrivate *priv = sysprof_model_filter_get_instance_private (self);
- g_return_if_fail (SP_IS_MODEL_FILTER (self));
+ g_return_if_fail (SYSPROF_IS_MODEL_FILTER (self));
g_return_if_fail (filter_func || (!filter_func_data && !filter_func_data_destroy));
if (priv->filter_func_data_destroy != NULL)
@@ -488,10 +488,10 @@ sp_model_filter_set_filter_func (SpModelFilter *self,
}
else
{
- priv->filter_func = sp_model_filter_default_filter_func;
+ priv->filter_func = sysprof_model_filter_default_filter_func;
priv->filter_func_data = NULL;
priv->filter_func_data_destroy = NULL;
}
- sp_model_filter_invalidate (self);
+ sysprof_model_filter_invalidate (self);
}
diff --git a/src/libsysprof-ui/sp-model-filter.h b/src/libsysprof-ui/sysprof-model-filter.h
similarity index 64%
rename from src/libsysprof-ui/sp-model-filter.h
rename to src/libsysprof-ui/sysprof-model-filter.h
index 08f6e37..1b2b8ed 100644
--- a/src/libsysprof-ui/sp-model-filter.h
+++ b/src/libsysprof-ui/sysprof-model-filter.h
@@ -1,4 +1,4 @@
-/* sp-model-filter.h
+/* sysprof-model-filter.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -26,15 +26,15 @@
G_BEGIN_DECLS
-#define SP_TYPE_MODEL_FILTER (sp_model_filter_get_type())
+#define SYSPROF_TYPE_MODEL_FILTER (sysprof_model_filter_get_type())
-typedef gboolean (*SpModelFilterFunc) (GObject *object,
+typedef gboolean (*SysprofModelFilterFunc) (GObject *object,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpModelFilter, sp_model_filter, SP, MODEL_FILTER, GObject)
+G_DECLARE_DERIVABLE_TYPE (SysprofModelFilter, sysprof_model_filter, SYSPROF, MODEL_FILTER, GObject)
-struct _SpModelFilterClass
+struct _SysprofModelFilterClass
{
GObjectClass parent_class;
@@ -42,14 +42,14 @@ struct _SpModelFilterClass
};
SYSPROF_AVAILABLE_IN_ALL
-SpModelFilter *sp_model_filter_new (GListModel *child_model);
+SysprofModelFilter *sysprof_model_filter_new (GListModel *child_model);
SYSPROF_AVAILABLE_IN_ALL
-GListModel *sp_model_filter_get_child_model (SpModelFilter *self);
+GListModel *sysprof_model_filter_get_child_model (SysprofModelFilter *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_model_filter_invalidate (SpModelFilter *self);
+void sysprof_model_filter_invalidate (SysprofModelFilter *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_model_filter_set_filter_func (SpModelFilter *self,
- SpModelFilterFunc filter_func,
+void sysprof_model_filter_set_filter_func (SysprofModelFilter *self,
+ SysprofModelFilterFunc filter_func,
gpointer filter_func_data,
GDestroyNotify filter_func_data_destroy);
diff --git a/src/libsysprof-ui/sp-multi-paned.c b/src/libsysprof-ui/sysprof-multi-paned.c
similarity index 70%
rename from src/libsysprof-ui/sp-multi-paned.c
rename to src/libsysprof-ui/sysprof-multi-paned.c
index 499f244..cd7a023 100644
--- a/src/libsysprof-ui/sp-multi-paned.c
+++ b/src/libsysprof-ui/sysprof-multi-paned.c
@@ -1,4 +1,4 @@
-/* sp-multi-paned.c
+/* sysprof-multi-paned.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -21,7 +21,7 @@
#include "config.h"
-#include "sp-multi-paned.h"
+#include "sysprof-multi-paned.h"
#define HANDLE_WIDTH 10
#define HANDLE_HEIGHT 10
@@ -29,13 +29,13 @@
#define IS_HORIZONTAL(o) (o == GTK_ORIENTATION_HORIZONTAL)
/**
- * SECTION:sp-multi-paned
- * @title: SpMultiPaned
+ * SECTION:sysprof-multi-paned
+ * @title: SysprofMultiPaned
* @short_description: A widget with multiple adjustable panes
*
* This widget is similar to #GtkPaned except that it allows adding more than
* two children to the widget. For each additional child added to the
- * #SpMultiPaned, an additional resize grip is added.
+ * #SysprofMultiPaned, an additional resize grip is added.
*/
typedef struct
@@ -76,12 +76,12 @@ typedef struct
* If the position field has been set.
*/
guint position_set : 1;
-} SpMultiPanedChild;
+} SysprofMultiPanedChild;
typedef struct
{
/*
- * A GArray of SpMultiPanedChild containing everything we need to
+ * A GArray of SysprofMultiPanedChild containing everything we need to
* do size requests, drag operations, resize handles, and temporary
* space needed in such operations.
*/
@@ -105,7 +105,7 @@ typedef struct
* the drag handle is immediately after the child. So the final visible
* child has the handle input-only window hidden.
*/
- SpMultiPanedChild *drag_begin;
+ SysprofMultiPanedChild *drag_begin;
/*
* The position (width or height) of the child when the drag began.
@@ -121,11 +121,11 @@ typedef struct
* in allocation_stage_drag_overflow() to adjust the neighbors.
*/
gint drag_extra_offset;
-} SpMultiPanedPrivate;
+} SysprofMultiPanedPrivate;
typedef struct
{
- SpMultiPanedChild **children;
+ SysprofMultiPanedChild **children;
guint n_children;
GtkOrientation orientation;
GtkAllocation top_alloc;
@@ -134,30 +134,30 @@ typedef struct
gint handle_size;
} AllocationState;
-typedef void (*AllocationStage) (SpMultiPaned *self,
+typedef void (*AllocationStage) (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_allocate (SpMultiPaned *self,
+static void allocation_stage_allocate (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_borders (SpMultiPaned *self,
+static void allocation_stage_borders (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_cache_request (SpMultiPaned *self,
+static void allocation_stage_cache_request (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_drag_overflow (SpMultiPaned *self,
+static void allocation_stage_drag_overflow (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_expand (SpMultiPaned *self,
+static void allocation_stage_expand (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_handles (SpMultiPaned *self,
+static void allocation_stage_handles (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_minimums (SpMultiPaned *self,
+static void allocation_stage_minimums (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_naturals (SpMultiPaned *self,
+static void allocation_stage_naturals (SysprofMultiPaned *self,
AllocationState *state);
-static void allocation_stage_positions (SpMultiPaned *self,
+static void allocation_stage_positions (SysprofMultiPaned *self,
AllocationState *state);
-G_DEFINE_TYPE_EXTENDED (SpMultiPaned, sp_multi_paned, GTK_TYPE_CONTAINER, 0,
- G_ADD_PRIVATE (SpMultiPaned)
+G_DEFINE_TYPE_EXTENDED (SysprofMultiPaned, sysprof_multi_paned, GTK_TYPE_CONTAINER, 0,
+ G_ADD_PRIVATE (SysprofMultiPaned)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
enum {
@@ -206,16 +206,16 @@ static AllocationStage allocation_stages[] = {
};
static void
-sp_multi_paned_reset_positions (SpMultiPaned *self)
+sysprof_multi_paned_reset_positions (SysprofMultiPaned *self)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
child->position = -1;
child->position_set = FALSE;
@@ -228,23 +228,23 @@ sp_multi_paned_reset_positions (SpMultiPaned *self)
gtk_widget_queue_resize (GTK_WIDGET (self));
}
-static SpMultiPanedChild *
-sp_multi_paned_get_next_visible_child (SpMultiPaned *self,
- SpMultiPanedChild *child)
+static SysprofMultiPanedChild *
+sysprof_multi_paned_get_next_visible_child (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *child)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (child != NULL);
g_assert (priv->children != NULL);
g_assert (priv->children->len > 0);
- i = child - ((SpMultiPanedChild *)(gpointer)priv->children->data);
+ i = child - ((SysprofMultiPanedChild *)(gpointer)priv->children->data);
for (++i; i < priv->children->len; i++)
{
- SpMultiPanedChild *next = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *next = &g_array_index (priv->children, SysprofMultiPanedChild, i);
if (gtk_widget_get_visible (next->widget))
return next;
@@ -254,24 +254,24 @@ sp_multi_paned_get_next_visible_child (SpMultiPaned *self,
}
static gboolean
-sp_multi_paned_is_last_visible_child (SpMultiPaned *self,
- SpMultiPanedChild *child)
+sysprof_multi_paned_is_last_visible_child (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *child)
{
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (child != NULL);
- return !sp_multi_paned_get_next_visible_child (self, child);
+ return !sysprof_multi_paned_get_next_visible_child (self, child);
}
static void
-sp_multi_paned_get_handle_rect (SpMultiPaned *self,
- SpMultiPanedChild *child,
+sysprof_multi_paned_get_handle_rect (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *child,
GdkRectangle *handle_rect)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GtkAllocation alloc;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (child != NULL);
g_assert (handle_rect != NULL);
@@ -284,7 +284,7 @@ sp_multi_paned_get_handle_rect (SpMultiPaned *self,
!gtk_widget_get_realized (child->widget))
return;
- if (sp_multi_paned_is_last_visible_child (self, child))
+ if (sysprof_multi_paned_is_last_visible_child (self, child))
return;
gtk_widget_get_allocation (child->widget, &alloc);
@@ -306,17 +306,17 @@ sp_multi_paned_get_handle_rect (SpMultiPaned *self,
}
static void
-sp_multi_paned_create_child_handle (SpMultiPaned *self,
- SpMultiPanedChild *child)
+sysprof_multi_paned_create_child_handle (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *child)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GdkWindowAttr attributes = { 0 };
GdkDisplay *display;
GdkWindow *parent;
const char *cursor_name;
GdkRectangle handle_rect;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (child != NULL);
g_assert (child->handle == NULL);
@@ -327,7 +327,7 @@ sp_multi_paned_create_child_handle (SpMultiPaned *self,
? "col-resize"
: "row-resize";
- sp_multi_paned_get_handle_rect (self, child, &handle_rect);
+ sysprof_multi_paned_get_handle_rect (self, child, &handle_rect);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_ONLY;
@@ -350,20 +350,20 @@ sp_multi_paned_create_child_handle (SpMultiPaned *self,
}
static gint
-sp_multi_paned_calc_handle_size (SpMultiPaned *self)
+sysprof_multi_paned_calc_handle_size (SysprofMultiPaned *self)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
gint visible_children = 0;
gint handle_size = 1;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
gtk_widget_style_get (GTK_WIDGET (self), "handle-size", &handle_size, NULL);
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
if (gtk_widget_get_visible (child->widget))
visible_children++;
@@ -373,10 +373,10 @@ sp_multi_paned_calc_handle_size (SpMultiPaned *self)
}
static void
-sp_multi_paned_destroy_child_handle (SpMultiPaned *self,
- SpMultiPanedChild *child)
+sysprof_multi_paned_destroy_child_handle (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *child)
{
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (child != NULL);
if (child->handle != NULL)
@@ -387,9 +387,9 @@ sp_multi_paned_destroy_child_handle (SpMultiPaned *self,
}
static void
-sp_multi_paned_update_child_handles (SpMultiPaned *self)
+sysprof_multi_paned_update_child_handles (SysprofMultiPaned *self)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GtkWidget *widget = GTK_WIDGET (self);
if (gtk_widget_get_realized (widget))
@@ -407,7 +407,7 @@ sp_multi_paned_update_child_handles (SpMultiPaned *self)
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
gdk_window_set_cursor (child->handle, cursor);
}
@@ -417,19 +417,19 @@ sp_multi_paned_update_child_handles (SpMultiPaned *self)
}
}
-static SpMultiPanedChild *
-sp_multi_paned_get_child (SpMultiPaned *self,
+static SysprofMultiPanedChild *
+sysprof_multi_paned_get_child (SysprofMultiPaned *self,
GtkWidget *widget)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (widget));
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
if (child->widget == widget)
return child;
@@ -441,31 +441,31 @@ sp_multi_paned_get_child (SpMultiPaned *self,
}
static gint
-sp_multi_paned_get_child_position (SpMultiPaned *self,
+sysprof_multi_paned_get_child_position (SysprofMultiPaned *self,
GtkWidget *widget)
{
- SpMultiPanedChild *child;
+ SysprofMultiPanedChild *child;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (widget));
- child = sp_multi_paned_get_child (self, widget);
+ child = sysprof_multi_paned_get_child (self, widget);
return child->position;
}
static void
-sp_multi_paned_set_child_position (SpMultiPaned *self,
+sysprof_multi_paned_set_child_position (SysprofMultiPaned *self,
GtkWidget *widget,
gint position)
{
- SpMultiPanedChild *child;
+ SysprofMultiPanedChild *child;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (widget));
g_assert (position >= -1);
- child = sp_multi_paned_get_child (self, widget);
+ child = sysprof_multi_paned_get_child (self, widget);
if (child->position != position)
{
@@ -478,49 +478,49 @@ sp_multi_paned_set_child_position (SpMultiPaned *self,
}
static void
-sp_multi_paned_add (GtkContainer *container,
+sysprof_multi_paned_add (GtkContainer *container,
GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)container;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
- SpMultiPanedChild child = { 0 };
+ SysprofMultiPaned *self = (SysprofMultiPaned *)container;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
+ SysprofMultiPanedChild child = { 0 };
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (widget));
child.widget = g_object_ref_sink (widget);
child.position = -1;
if (gtk_widget_get_realized (GTK_WIDGET (self)))
- sp_multi_paned_create_child_handle (self, &child);
+ sysprof_multi_paned_create_child_handle (self, &child);
gtk_widget_set_parent (widget, GTK_WIDGET (self));
g_array_append_val (priv->children, child);
- sp_multi_paned_reset_positions (self);
+ sysprof_multi_paned_reset_positions (self);
gtk_gesture_set_state (GTK_GESTURE (priv->gesture), GTK_EVENT_SEQUENCE_DENIED);
}
static void
-sp_multi_paned_remove (GtkContainer *container,
+sysprof_multi_paned_remove (GtkContainer *container,
GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)container;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)container;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (widget));
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
if (child->widget == widget)
{
- sp_multi_paned_destroy_child_handle (self, child);
+ sysprof_multi_paned_destroy_child_handle (self, child);
g_array_remove_index (priv->children, i);
child = NULL;
@@ -532,62 +532,62 @@ sp_multi_paned_remove (GtkContainer *container,
}
}
- sp_multi_paned_reset_positions (self);
+ sysprof_multi_paned_reset_positions (self);
gtk_gesture_set_state (GTK_GESTURE (priv->gesture), GTK_EVENT_SEQUENCE_DENIED);
}
static void
-sp_multi_paned_forall (GtkContainer *container,
+sysprof_multi_paned_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer user_data)
{
- SpMultiPaned *self = (SpMultiPaned *)container;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)container;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
gint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (callback != NULL);
for (i = priv->children->len; i > 0; i--)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i - 1);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i - 1);
callback (child->widget, user_data);
}
}
static GtkSizeRequestMode
-sp_multi_paned_get_request_mode (GtkWidget *widget)
+sysprof_multi_paned_get_request_mode (GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
return (priv->orientation == GTK_ORIENTATION_HORIZONTAL) ? GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT
: GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
static void
-sp_multi_paned_get_preferred_height (GtkWidget *widget,
+sysprof_multi_paned_get_preferred_height (GtkWidget *widget,
gint *min_height,
gint *nat_height)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
gint real_min_height = 0;
gint real_nat_height = 0;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (min_height != NULL);
g_assert (nat_height != NULL);
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
gint child_min_height = 0;
gint child_nat_height = 0;
@@ -610,7 +610,7 @@ sp_multi_paned_get_preferred_height (GtkWidget *widget,
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- gint handle_size = sp_multi_paned_calc_handle_size (self);
+ gint handle_size = sysprof_multi_paned_calc_handle_size (self);
real_min_height += handle_size;
real_nat_height += handle_size;
@@ -621,21 +621,21 @@ sp_multi_paned_get_preferred_height (GtkWidget *widget,
}
static void
-sp_multi_paned_get_child_preferred_height_for_width (SpMultiPaned *self,
- SpMultiPanedChild *children,
+sysprof_multi_paned_get_child_preferred_height_for_width (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *children,
gint n_children,
gint width,
gint *min_height,
gint *nat_height)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
- SpMultiPanedChild *child = children;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
+ SysprofMultiPanedChild *child = children;
gint child_min_height = 0;
gint child_nat_height = 0;
gint neighbor_min_height = 0;
gint neighbor_nat_height = 0;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (n_children == 0 || children != NULL);
g_assert (min_height != NULL);
g_assert (nat_height != NULL);
@@ -652,7 +652,7 @@ sp_multi_paned_get_child_preferred_height_for_width (SpMultiPaned *self,
&child_min_height,
&child_nat_height);
- sp_multi_paned_get_child_preferred_height_for_width (self,
+ sysprof_multi_paned_get_child_preferred_height_for_width (self,
children + 1,
n_children - 1,
width,
@@ -672,23 +672,23 @@ sp_multi_paned_get_child_preferred_height_for_width (SpMultiPaned *self,
}
static void
-sp_multi_paned_get_preferred_height_for_width (GtkWidget *widget,
+sysprof_multi_paned_get_preferred_height_for_width (GtkWidget *widget,
gint width,
gint *min_height,
gint *nat_height)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (min_height != NULL);
g_assert (nat_height != NULL);
*min_height = 0;
*nat_height = 0;
- sp_multi_paned_get_child_preferred_height_for_width (self,
- (SpMultiPanedChild *)(gpointer)priv->children->data,
+ sysprof_multi_paned_get_child_preferred_height_for_width (self,
+ (SysprofMultiPanedChild
*)(gpointer)priv->children->data,
priv->children->len,
width,
min_height,
@@ -696,7 +696,7 @@ sp_multi_paned_get_preferred_height_for_width (GtkWidget *widget,
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- gint handle_size = sp_multi_paned_calc_handle_size (self);
+ gint handle_size = sysprof_multi_paned_calc_handle_size (self);
*min_height += handle_size;
*nat_height += handle_size;
@@ -704,23 +704,23 @@ sp_multi_paned_get_preferred_height_for_width (GtkWidget *widget,
}
static void
-sp_multi_paned_get_preferred_width (GtkWidget *widget,
+sysprof_multi_paned_get_preferred_width (GtkWidget *widget,
gint *min_width,
gint *nat_width)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
gint real_min_width = 0;
gint real_nat_width = 0;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (min_width != NULL);
g_assert (nat_width != NULL);
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
gint child_min_width = 0;
gint child_nat_width = 0;
@@ -743,7 +743,7 @@ sp_multi_paned_get_preferred_width (GtkWidget *widget,
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gint handle_size = sp_multi_paned_calc_handle_size (self);
+ gint handle_size = sysprof_multi_paned_calc_handle_size (self);
real_min_width += handle_size;
real_nat_width += handle_size;
@@ -754,21 +754,21 @@ sp_multi_paned_get_preferred_width (GtkWidget *widget,
}
static void
-sp_multi_paned_get_child_preferred_width_for_height (SpMultiPaned *self,
- SpMultiPanedChild *children,
+sysprof_multi_paned_get_child_preferred_width_for_height (SysprofMultiPaned *self,
+ SysprofMultiPanedChild *children,
gint n_children,
gint height,
gint *min_width,
gint *nat_width)
{
- SpMultiPanedChild *child = children;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedChild *child = children;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
gint child_min_width = 0;
gint child_nat_width = 0;
gint neighbor_min_width = 0;
gint neighbor_nat_width = 0;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (n_children == 0 || children != NULL);
g_assert (min_width != NULL);
g_assert (nat_width != NULL);
@@ -785,7 +785,7 @@ sp_multi_paned_get_child_preferred_width_for_height (SpMultiPaned *self,
&child_min_width,
&child_nat_width);
- sp_multi_paned_get_child_preferred_width_for_height (self,
+ sysprof_multi_paned_get_child_preferred_width_for_height (self,
children + 1,
n_children - 1,
height,
@@ -805,20 +805,20 @@ sp_multi_paned_get_child_preferred_width_for_height (SpMultiPaned *self,
}
static void
-sp_multi_paned_get_preferred_width_for_height (GtkWidget *widget,
+sysprof_multi_paned_get_preferred_width_for_height (GtkWidget *widget,
gint height,
gint *min_width,
gint *nat_width)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (min_width != NULL);
g_assert (nat_width != NULL);
- sp_multi_paned_get_child_preferred_width_for_height (self,
- (SpMultiPanedChild *)(gpointer)priv->children->data,
+ sysprof_multi_paned_get_child_preferred_width_for_height (self,
+ (SysprofMultiPanedChild
*)(gpointer)priv->children->data,
priv->children->len,
height,
min_width,
@@ -826,7 +826,7 @@ sp_multi_paned_get_preferred_width_for_height (GtkWidget *widget,
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gint handle_size = sp_multi_paned_calc_handle_size (self);
+ gint handle_size = sysprof_multi_paned_calc_handle_size (self);
*min_width += handle_size;
*nat_width += handle_size;
@@ -834,12 +834,12 @@ sp_multi_paned_get_preferred_width_for_height (GtkWidget *widget,
}
static void
-allocation_stage_handles (SpMultiPaned *self,
+allocation_stage_handles (SysprofMultiPaned *self,
AllocationState *state)
{
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
@@ -851,7 +851,7 @@ allocation_stage_handles (SpMultiPaned *self,
for (i = 1; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
if (IS_HORIZONTAL (state->orientation))
child->alloc.x += (i * state->handle_size);
@@ -866,14 +866,14 @@ allocation_stage_handles (SpMultiPaned *self,
}
static void
-allocation_stage_minimums (SpMultiPaned *self,
+allocation_stage_minimums (SysprofMultiPaned *self,
AllocationState *state)
{
gint next_x;
gint next_y;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
@@ -883,7 +883,7 @@ allocation_stage_minimums (SpMultiPaned *self,
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
if (IS_HORIZONTAL (state->orientation))
{
@@ -911,21 +911,21 @@ allocation_stage_minimums (SpMultiPaned *self,
}
static void
-allocation_stage_naturals (SpMultiPaned *self,
+allocation_stage_naturals (SysprofMultiPaned *self,
AllocationState *state)
{
gint x_adjust = 0;
gint y_adjust = 0;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
child->alloc.x += x_adjust;
child->alloc.y += y_adjust;
@@ -959,12 +959,12 @@ allocation_stage_naturals (SpMultiPaned *self,
}
static void
-allocation_stage_borders (SpMultiPaned *self,
+allocation_stage_borders (SysprofMultiPaned *self,
AllocationState *state)
{
gint border_width;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
@@ -987,19 +987,19 @@ allocation_stage_borders (SpMultiPaned *self,
}
static void
-allocation_stage_cache_request (SpMultiPaned *self,
+allocation_stage_cache_request (SysprofMultiPaned *self,
AllocationState *state)
{
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
if (IS_HORIZONTAL (state->orientation))
gtk_widget_get_preferred_width_for_height (child->widget,
@@ -1015,14 +1015,14 @@ allocation_stage_cache_request (SpMultiPaned *self,
}
static void
-allocation_stage_positions (SpMultiPaned *self,
+allocation_stage_positions (SysprofMultiPaned *self,
AllocationState *state)
{
gint x_adjust = 0;
gint y_adjust = 0;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
@@ -1035,7 +1035,7 @@ allocation_stage_positions (SpMultiPaned *self,
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
child->alloc.x += x_adjust;
child->alloc.y += y_adjust;
@@ -1069,15 +1069,15 @@ allocation_stage_positions (SpMultiPaned *self,
}
static void
-allocation_stage_drag_overflow (SpMultiPaned *self,
+allocation_stage_drag_overflow (SysprofMultiPaned *self,
AllocationState *state)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint drag_index;
gint j;
gint drag_overflow;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
@@ -1109,7 +1109,7 @@ allocation_stage_drag_overflow (SpMultiPaned *self,
for (j = (int)drag_index; j >= 0 && drag_overflow > 0; j--)
{
- SpMultiPanedChild *child = state->children [j];
+ SysprofMultiPanedChild *child = state->children [j];
guint k;
gint adjust = 0;
@@ -1147,7 +1147,7 @@ allocation_stage_drag_overflow (SpMultiPaned *self,
for (k = j + 1; k <= drag_index + 1; k++)
{
- SpMultiPanedChild *neighbor = state->children [k];
+ SysprofMultiPanedChild *neighbor = state->children [k];
if (IS_HORIZONTAL (state->orientation))
neighbor->alloc.x -= adjust;
@@ -1158,7 +1158,7 @@ allocation_stage_drag_overflow (SpMultiPaned *self,
}
static void
-allocation_stage_expand (SpMultiPaned *self,
+allocation_stage_expand (SysprofMultiPaned *self,
AllocationState *state)
{
gint x_adjust = 0;
@@ -1167,17 +1167,17 @@ allocation_stage_expand (SpMultiPaned *self,
gint adjust;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
if (state->n_children == 1)
{
- SpMultiPanedChild *child = state->children [0];
+ SysprofMultiPanedChild *child = state->children [0];
/*
- * Special case for single child, just expand to the
+ * Sysprofecial case for single child, just expand to the
* available space. Ideally we would have much shorter
* allocation stages in this case.
*/
@@ -1198,7 +1198,7 @@ allocation_stage_expand (SpMultiPaned *self,
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
if (!child->position_set)
{
@@ -1225,7 +1225,7 @@ allocation_stage_expand (SpMultiPaned *self,
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
child->alloc.x += x_adjust;
child->alloc.y += y_adjust;
@@ -1272,19 +1272,19 @@ allocation_stage_expand (SpMultiPaned *self,
}
static void
-allocation_stage_allocate (SpMultiPaned *self,
+allocation_stage_allocate (SysprofMultiPaned *self,
AllocationState *state)
{
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (state != NULL);
g_assert (state->children != NULL);
g_assert (state->n_children > 0);
for (i = 0; i < state->n_children; i++)
{
- SpMultiPanedChild *child = state->children [i];
+ SysprofMultiPanedChild *child = state->children [i];
gtk_widget_size_allocate (child->widget, &child->alloc);
@@ -1313,19 +1313,19 @@ allocation_stage_allocate (SpMultiPaned *self,
}
static void
-sp_multi_paned_size_allocate (GtkWidget *widget,
+sysprof_multi_paned_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
AllocationState state = { 0 };
GPtrArray *children;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (allocation != NULL);
- GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->size_allocate (widget, allocation);
if (priv->children->len == 0)
return;
@@ -1334,7 +1334,7 @@ sp_multi_paned_size_allocate (GtkWidget *widget,
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
child->alloc.x = 0;
child->alloc.y = 0;
@@ -1349,7 +1349,7 @@ sp_multi_paned_size_allocate (GtkWidget *widget,
gdk_window_hide (child->handle);
}
- state.children = (SpMultiPanedChild **)children->pdata;
+ state.children = (SysprofMultiPanedChild **)children->pdata;
state.n_children = children->len;
if (state.n_children == 0)
@@ -1374,93 +1374,93 @@ sp_multi_paned_size_allocate (GtkWidget *widget,
}
static void
-sp_multi_paned_realize (GtkWidget *widget)
+sysprof_multi_paned_realize (GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
- GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->realize (widget);
+ GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->realize (widget);
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
- sp_multi_paned_create_child_handle (self, child);
+ sysprof_multi_paned_create_child_handle (self, child);
}
}
static void
-sp_multi_paned_unrealize (GtkWidget *widget)
+sysprof_multi_paned_unrealize (GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
- sp_multi_paned_destroy_child_handle (self, child);
+ sysprof_multi_paned_destroy_child_handle (self, child);
}
- GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->unrealize (widget);
+ GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->unrealize (widget);
}
static void
-sp_multi_paned_map (GtkWidget *widget)
+sysprof_multi_paned_map (GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
- GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->map (widget);
+ GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->map (widget);
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
gdk_window_show (child->handle);
}
}
static void
-sp_multi_paned_unmap (GtkWidget *widget)
+sysprof_multi_paned_unmap (GtkWidget *widget)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
gdk_window_hide (child->handle);
}
- GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->unmap (widget);
+ GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->unmap (widget);
}
static gboolean
-sp_multi_paned_draw (GtkWidget *widget,
+sysprof_multi_paned_draw (GtkWidget *widget,
cairo_t *cr)
{
- SpMultiPaned *self = (SpMultiPaned *)widget;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)widget;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
gboolean ret;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (cr != NULL);
- ret = GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->draw (widget, cr);
+ ret = GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->draw (widget, cr);
if (ret != GDK_EVENT_STOP)
{
@@ -1474,7 +1474,7 @@ sp_multi_paned_draw (GtkWidget *widget,
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
GtkAllocation alloc;
if (!gtk_widget_get_realized (child->widget) ||
@@ -1483,7 +1483,7 @@ sp_multi_paned_draw (GtkWidget *widget,
gtk_widget_get_allocation (child->widget, &alloc);
- if (!sp_multi_paned_is_last_visible_child (self, child))
+ if (!sysprof_multi_paned_is_last_visible_child (self, child))
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_render_handle (style_context,
@@ -1507,17 +1507,17 @@ sp_multi_paned_draw (GtkWidget *widget,
}
static void
-sp_multi_paned_pan_gesture_drag_begin (SpMultiPaned *self,
+sysprof_multi_paned_pan_gesture_drag_begin (SysprofMultiPaned *self,
gdouble x,
gdouble y,
GtkGesturePan *gesture)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GdkEventSequence *sequence;
const GdkEvent *event;
guint i;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_GESTURE_PAN (gesture));
g_assert (gesture == priv->gesture);
@@ -1530,7 +1530,7 @@ sp_multi_paned_pan_gesture_drag_begin (SpMultiPaned *self,
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
if (child->handle == event->any.window)
{
@@ -1547,7 +1547,7 @@ sp_multi_paned_pan_gesture_drag_begin (SpMultiPaned *self,
for (i = 0; i < priv->children->len; i++)
{
- SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+ SysprofMultiPanedChild *child = &g_array_index (priv->children, SysprofMultiPanedChild, i);
if (child->handle == event->any.window)
break;
@@ -1579,16 +1579,16 @@ sp_multi_paned_pan_gesture_drag_begin (SpMultiPaned *self,
}
static void
-sp_multi_paned_pan_gesture_drag_end (SpMultiPaned *self,
+sysprof_multi_paned_pan_gesture_drag_end (SysprofMultiPaned *self,
gdouble x,
gdouble y,
GtkGesturePan *gesture)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GdkEventSequence *sequence;
GtkEventSequenceState state;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_GESTURE_PAN (gesture));
g_assert (gesture == priv->gesture);
@@ -1609,15 +1609,15 @@ cleanup:
}
static void
-sp_multi_paned_pan_gesture_pan (SpMultiPaned *self,
+sysprof_multi_paned_pan_gesture_pan (SysprofMultiPaned *self,
GtkPanDirection direction,
gdouble offset,
GtkGesturePan *gesture)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GtkAllocation alloc;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_GESTURE_PAN (gesture));
g_assert (gesture == priv->gesture);
g_assert (priv->drag_begin != NULL);
@@ -1649,12 +1649,12 @@ sp_multi_paned_pan_gesture_pan (SpMultiPaned *self,
}
static void
-sp_multi_paned_create_pan_gesture (SpMultiPaned *self)
+sysprof_multi_paned_create_pan_gesture (SysprofMultiPaned *self)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
GtkGesture *gesture;
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (priv->gesture == NULL);
gesture = gtk_gesture_pan_new (GTK_WIDGET (self), GTK_ORIENTATION_HORIZONTAL);
@@ -1663,19 +1663,19 @@ sp_multi_paned_create_pan_gesture (SpMultiPaned *self)
g_signal_connect_object (gesture,
"drag-begin",
- G_CALLBACK (sp_multi_paned_pan_gesture_drag_begin),
+ G_CALLBACK (sysprof_multi_paned_pan_gesture_drag_begin),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (gesture,
"drag-end",
- G_CALLBACK (sp_multi_paned_pan_gesture_drag_end),
+ G_CALLBACK (sysprof_multi_paned_pan_gesture_drag_end),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (gesture,
"pan",
- G_CALLBACK (sp_multi_paned_pan_gesture_pan),
+ G_CALLBACK (sysprof_multi_paned_pan_gesture_pan),
self,
G_CONNECT_SWAPPED);
@@ -1683,36 +1683,36 @@ sp_multi_paned_create_pan_gesture (SpMultiPaned *self)
}
static void
-sp_multi_paned_resize_drag_begin (SpMultiPaned *self,
+sysprof_multi_paned_resize_drag_begin (SysprofMultiPaned *self,
GtkWidget *child)
{
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (child));
}
static void
-sp_multi_paned_resize_drag_end (SpMultiPaned *self,
+sysprof_multi_paned_resize_drag_end (SysprofMultiPaned *self,
GtkWidget *child)
{
- g_assert (SP_IS_MULTI_PANED (self));
+ g_assert (SYSPROF_IS_MULTI_PANED (self));
g_assert (GTK_IS_WIDGET (child));
}
static void
-sp_multi_paned_get_child_property (GtkContainer *container,
+sysprof_multi_paned_get_child_property (GtkContainer *container,
GtkWidget *widget,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpMultiPaned *self = SP_MULTI_PANED (container);
+ SysprofMultiPaned *self = SYSPROF_MULTI_PANED (container);
switch (prop_id)
{
case CHILD_PROP_POSITION:
- g_value_set_int (value, sp_multi_paned_get_child_position (self, widget));
+ g_value_set_int (value, sysprof_multi_paned_get_child_position (self, widget));
break;
default:
@@ -1721,18 +1721,18 @@ sp_multi_paned_get_child_property (GtkContainer *container,
}
static void
-sp_multi_paned_set_child_property (GtkContainer *container,
+sysprof_multi_paned_set_child_property (GtkContainer *container,
GtkWidget *widget,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpMultiPaned *self = SP_MULTI_PANED (container);
+ SysprofMultiPaned *self = SYSPROF_MULTI_PANED (container);
switch (prop_id)
{
case CHILD_PROP_POSITION:
- sp_multi_paned_set_child_position (self, widget, g_value_get_int (value));
+ sysprof_multi_paned_set_child_position (self, widget, g_value_get_int (value));
break;
default:
@@ -1741,27 +1741,27 @@ sp_multi_paned_set_child_property (GtkContainer *container,
}
static void
-sp_multi_paned_finalize (GObject *object)
+sysprof_multi_paned_finalize (GObject *object)
{
- SpMultiPaned *self = (SpMultiPaned *)object;
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = (SysprofMultiPaned *)object;
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
g_assert (priv->children->len == 0);
g_clear_pointer (&priv->children, g_array_unref);
g_clear_object (&priv->gesture);
- G_OBJECT_CLASS (sp_multi_paned_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_multi_paned_parent_class)->finalize (object);
}
static void
-sp_multi_paned_get_property (GObject *object,
+sysprof_multi_paned_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpMultiPaned *self = SP_MULTI_PANED (object);
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = SYSPROF_MULTI_PANED (object);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
switch (prop_id)
{
@@ -1775,19 +1775,19 @@ sp_multi_paned_get_property (GObject *object,
}
static void
-sp_multi_paned_set_property (GObject *object,
+sysprof_multi_paned_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpMultiPaned *self = SP_MULTI_PANED (object);
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPaned *self = SYSPROF_MULTI_PANED (object);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
switch (prop_id)
{
case PROP_ORIENTATION:
priv->orientation = g_value_get_enum (value);
- sp_multi_paned_update_child_handles (self);
+ sysprof_multi_paned_update_child_handles (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
break;
@@ -1797,46 +1797,46 @@ sp_multi_paned_set_property (GObject *object,
}
static void
-sp_multi_paned_state_flags_changed (GtkWidget *widget,
+sysprof_multi_paned_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
- sp_multi_paned_update_child_handles (SP_MULTI_PANED (widget));
+ sysprof_multi_paned_update_child_handles (SYSPROF_MULTI_PANED (widget));
- GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->state_flags_changed (widget, previous_state);
+ GTK_WIDGET_CLASS (sysprof_multi_paned_parent_class)->state_flags_changed (widget, previous_state);
}
static void
-sp_multi_paned_class_init (SpMultiPanedClass *klass)
+sysprof_multi_paned_class_init (SysprofMultiPanedClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- object_class->get_property = sp_multi_paned_get_property;
- object_class->set_property = sp_multi_paned_set_property;
- object_class->finalize = sp_multi_paned_finalize;
-
- widget_class->get_request_mode = sp_multi_paned_get_request_mode;
- widget_class->get_preferred_width = sp_multi_paned_get_preferred_width;
- widget_class->get_preferred_height = sp_multi_paned_get_preferred_height;
- widget_class->get_preferred_width_for_height = sp_multi_paned_get_preferred_width_for_height;
- widget_class->get_preferred_height_for_width = sp_multi_paned_get_preferred_height_for_width;
- widget_class->size_allocate = sp_multi_paned_size_allocate;
- widget_class->realize = sp_multi_paned_realize;
- widget_class->unrealize = sp_multi_paned_unrealize;
- widget_class->map = sp_multi_paned_map;
- widget_class->unmap = sp_multi_paned_unmap;
- widget_class->draw = sp_multi_paned_draw;
- widget_class->state_flags_changed = sp_multi_paned_state_flags_changed;
-
- container_class->add = sp_multi_paned_add;
- container_class->remove = sp_multi_paned_remove;
- container_class->get_child_property = sp_multi_paned_get_child_property;
- container_class->set_child_property = sp_multi_paned_set_child_property;
- container_class->forall = sp_multi_paned_forall;
-
- klass->resize_drag_begin = sp_multi_paned_resize_drag_begin;
- klass->resize_drag_end = sp_multi_paned_resize_drag_end;
+ object_class->get_property = sysprof_multi_paned_get_property;
+ object_class->set_property = sysprof_multi_paned_set_property;
+ object_class->finalize = sysprof_multi_paned_finalize;
+
+ widget_class->get_request_mode = sysprof_multi_paned_get_request_mode;
+ widget_class->get_preferred_width = sysprof_multi_paned_get_preferred_width;
+ widget_class->get_preferred_height = sysprof_multi_paned_get_preferred_height;
+ widget_class->get_preferred_width_for_height = sysprof_multi_paned_get_preferred_width_for_height;
+ widget_class->get_preferred_height_for_width = sysprof_multi_paned_get_preferred_height_for_width;
+ widget_class->size_allocate = sysprof_multi_paned_size_allocate;
+ widget_class->realize = sysprof_multi_paned_realize;
+ widget_class->unrealize = sysprof_multi_paned_unrealize;
+ widget_class->map = sysprof_multi_paned_map;
+ widget_class->unmap = sysprof_multi_paned_unmap;
+ widget_class->draw = sysprof_multi_paned_draw;
+ widget_class->state_flags_changed = sysprof_multi_paned_state_flags_changed;
+
+ container_class->add = sysprof_multi_paned_add;
+ container_class->remove = sysprof_multi_paned_remove;
+ container_class->get_child_property = sysprof_multi_paned_get_child_property;
+ container_class->set_child_property = sysprof_multi_paned_set_child_property;
+ container_class->forall = sysprof_multi_paned_forall;
+
+ klass->resize_drag_begin = sysprof_multi_paned_resize_drag_begin;
+ klass->resize_drag_end = sysprof_multi_paned_resize_drag_end;
gtk_widget_class_set_css_name (widget_class, "multipaned");
@@ -1875,7 +1875,7 @@ sp_multi_paned_class_init (SpMultiPanedClass *klass)
g_signal_new ("resize-drag-begin",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (SpMultiPanedClass, resize_drag_begin),
+ G_STRUCT_OFFSET (SysprofMultiPanedClass, resize_drag_begin),
NULL, NULL, NULL,
G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
@@ -1883,35 +1883,35 @@ sp_multi_paned_class_init (SpMultiPanedClass *klass)
g_signal_new ("resize-drag-end",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (SpMultiPanedClass, resize_drag_end),
+ G_STRUCT_OFFSET (SysprofMultiPanedClass, resize_drag_end),
NULL, NULL, NULL,
G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
}
static void
-sp_multi_paned_init (SpMultiPaned *self)
+sysprof_multi_paned_init (SysprofMultiPaned *self)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
- priv->children = g_array_new (FALSE, TRUE, sizeof (SpMultiPanedChild));
+ priv->children = g_array_new (FALSE, TRUE, sizeof (SysprofMultiPanedChild));
- sp_multi_paned_create_pan_gesture (self);
+ sysprof_multi_paned_create_pan_gesture (self);
}
GtkWidget *
-sp_multi_paned_new (void)
+sysprof_multi_paned_new (void)
{
- return g_object_new (SP_TYPE_MULTI_PANED, NULL);
+ return g_object_new (SYSPROF_TYPE_MULTI_PANED, NULL);
}
guint
-sp_multi_paned_get_n_children (SpMultiPaned *self)
+sysprof_multi_paned_get_n_children (SysprofMultiPaned *self)
{
- SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+ SysprofMultiPanedPrivate *priv = sysprof_multi_paned_get_instance_private (self);
- g_return_val_if_fail (SP_IS_MULTI_PANED (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_MULTI_PANED (self), 0);
return priv->children ? priv->children->len : 0;
}
diff --git a/src/libsysprof-ui/sp-multi-paned.h b/src/libsysprof-ui/sysprof-multi-paned.h
similarity index 74%
rename from src/libsysprof-ui/sp-multi-paned.h
rename to src/libsysprof-ui/sysprof-multi-paned.h
index c7ae7b0..2b0e6f1 100644
--- a/src/libsysprof-ui/sp-multi-paned.h
+++ b/src/libsysprof-ui/sysprof-multi-paned.h
@@ -1,4 +1,4 @@
-/* sp-multi-paned.h
+/* sysprof-multi-paned.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -27,18 +27,18 @@
G_BEGIN_DECLS
-#define SP_TYPE_MULTI_PANED (sp_multi_paned_get_type())
+#define SYSPROF_TYPE_MULTI_PANED (sysprof_multi_paned_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpMultiPaned, sp_multi_paned, SP, MULTI_PANED, GtkContainer)
+G_DECLARE_DERIVABLE_TYPE (SysprofMultiPaned, sysprof_multi_paned, SYSPROF, MULTI_PANED, GtkContainer)
-struct _SpMultiPanedClass
+struct _SysprofMultiPanedClass
{
GtkContainerClass parent;
- void (*resize_drag_begin) (SpMultiPaned *self,
+ void (*resize_drag_begin) (SysprofMultiPaned *self,
GtkWidget *child);
- void (*resize_drag_end) (SpMultiPaned *self,
+ void (*resize_drag_end) (SysprofMultiPaned *self,
GtkWidget *child);
gpointer _reserved1;
@@ -52,8 +52,8 @@ struct _SpMultiPanedClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_multi_paned_new (void);
+GtkWidget *sysprof_multi_paned_new (void);
SYSPROF_AVAILABLE_IN_ALL
-guint sp_multi_paned_get_n_children (SpMultiPaned *self);
+guint sysprof_multi_paned_get_n_children (SysprofMultiPaned *self);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-process-model-row.c b/src/libsysprof-ui/sysprof-process-model-row.c
similarity index 53%
rename from src/libsysprof-ui/sp-process-model-row.c
rename to src/libsysprof-ui/sysprof-process-model-row.c
index e749659..55b404e 100644
--- a/src/libsysprof-ui/sp-process-model-row.c
+++ b/src/libsysprof-ui/sysprof-process-model-row.c
@@ -1,4 +1,4 @@
-/* sp-process-model-row.c
+/* sysprof-process-model-row.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -20,20 +20,20 @@
#include "config.h"
-#include "sp-process-model-row.h"
+#include "sysprof-process-model-row.h"
typedef struct
{
- SpProcessModelItem *item;
+ SysprofProcessModelItem *item;
GtkLabel *args_label;
GtkLabel *label;
GtkLabel *pid;
GtkImage *image;
GtkImage *check;
-} SpProcessModelRowPrivate;
+} SysprofProcessModelRowPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (SpProcessModelRow, sp_process_model_row, GTK_TYPE_LIST_BOX_ROW)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofProcessModelRow, sysprof_process_model_row, GTK_TYPE_LIST_BOX_ROW)
enum {
PROP_0,
@@ -45,31 +45,31 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
-sp_process_model_row_new (SpProcessModelItem *item)
+sysprof_process_model_row_new (SysprofProcessModelItem *item)
{
- return g_object_new (SP_TYPE_PROCESS_MODEL_ROW,
+ return g_object_new (SYSPROF_TYPE_PROCESS_MODEL_ROW,
"item", item,
NULL);
}
-SpProcessModelItem *
-sp_process_model_row_get_item (SpProcessModelRow *self)
+SysprofProcessModelItem *
+sysprof_process_model_row_get_item (SysprofProcessModelRow *self)
{
- SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
+ SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ROW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ROW (self), NULL);
return priv->item;
}
static void
-sp_process_model_row_set_item (SpProcessModelRow *self,
- SpProcessModelItem *item)
+sysprof_process_model_row_set_item (SysprofProcessModelRow *self,
+ SysprofProcessModelItem *item)
{
- SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
+ SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
- g_assert (SP_IS_PROCESS_MODEL_ROW (self));
- g_assert (SP_IS_PROCESS_MODEL_ITEM (item));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (self));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (item));
if (g_set_object (&priv->item, item))
{
@@ -79,11 +79,11 @@ sp_process_model_row_set_item (SpProcessModelRow *self,
const gchar * const *argv;
GPid pid;
- command_line = sp_process_model_item_get_command_line (item);
+ command_line = sysprof_process_model_item_get_command_line (item);
parts = g_strsplit (command_line ?: "", "\n", 0);
gtk_label_set_label (priv->label, parts [0]);
- if ((NULL != (argv = sp_process_model_item_get_argv (item))) && (argv[0] != NULL))
+ if ((NULL != (argv = sysprof_process_model_item_get_argv (item))) && (argv[0] != NULL))
{
g_autofree gchar *argvstr = g_strjoinv (" ", (gchar **)&argv[1]);
g_autofree gchar *escaped = g_markup_escape_text (argvstr, -1);
@@ -91,7 +91,7 @@ sp_process_model_row_set_item (SpProcessModelRow *self,
gtk_label_set_label (priv->args_label, escaped);
}
- pid = sp_process_model_item_get_pid (item);
+ pid = sysprof_process_model_item_get_pid (item);
pidstr = g_strdup_printf ("<small>%u</small>", pid);
gtk_label_set_label (priv->pid, pidstr);
gtk_label_set_use_markup (priv->pid, TRUE);
@@ -99,26 +99,26 @@ sp_process_model_row_set_item (SpProcessModelRow *self,
}
gboolean
-sp_process_model_row_get_selected (SpProcessModelRow *self)
+sysprof_process_model_row_get_selected (SysprofProcessModelRow *self)
{
- SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
+ SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ROW (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ROW (self), FALSE);
return gtk_widget_get_visible (GTK_WIDGET (priv->check));
}
void
-sp_process_model_row_set_selected (SpProcessModelRow *self,
+sysprof_process_model_row_set_selected (SysprofProcessModelRow *self,
gboolean selected)
{
- SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
+ SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
- g_return_if_fail (SP_IS_PROCESS_MODEL_ROW (self));
+ g_return_if_fail (SYSPROF_IS_PROCESS_MODEL_ROW (self));
selected = !!selected;
- if (selected != sp_process_model_row_get_selected (self))
+ if (selected != sysprof_process_model_row_get_selected (self))
{
gtk_widget_set_visible (GTK_WIDGET (priv->check), selected);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SELECTED]);
@@ -126,21 +126,21 @@ sp_process_model_row_set_selected (SpProcessModelRow *self,
}
static gboolean
-sp_process_model_row_query_tooltip (GtkWidget *widget,
+sysprof_process_model_row_query_tooltip (GtkWidget *widget,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip *tooltip)
{
- SpProcessModelRow *self = (SpProcessModelRow *)widget;
- SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
+ SysprofProcessModelRow *self = (SysprofProcessModelRow *)widget;
+ SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
- g_assert (SP_IS_PROCESS_MODEL_ROW (self));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (self));
g_assert (GTK_IS_TOOLTIP (tooltip));
if (priv->item != NULL)
{
- const gchar * const *argv = sp_process_model_item_get_argv (priv->item);
+ const gchar * const *argv = sysprof_process_model_item_get_argv (priv->item);
if (argv != NULL)
{
@@ -154,32 +154,32 @@ sp_process_model_row_query_tooltip (GtkWidget *widget,
}
static void
-sp_process_model_row_finalize (GObject *object)
+sysprof_process_model_row_finalize (GObject *object)
{
- SpProcessModelRow *self = (SpProcessModelRow *)object;
- SpProcessModelRowPrivate *priv = sp_process_model_row_get_instance_private (self);
+ SysprofProcessModelRow *self = (SysprofProcessModelRow *)object;
+ SysprofProcessModelRowPrivate *priv = sysprof_process_model_row_get_instance_private (self);
g_clear_object (&priv->item);
- G_OBJECT_CLASS (sp_process_model_row_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_process_model_row_parent_class)->finalize (object);
}
static void
-sp_process_model_row_get_property (GObject *object,
+sysprof_process_model_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpProcessModelRow *self = SP_PROCESS_MODEL_ROW (object);
+ SysprofProcessModelRow *self = SYSPROF_PROCESS_MODEL_ROW (object);
switch (prop_id)
{
case PROP_ITEM:
- g_value_set_object (value, sp_process_model_row_get_item (self));
+ g_value_set_object (value, sysprof_process_model_row_get_item (self));
break;
case PROP_SELECTED:
- g_value_set_boolean (value, sp_process_model_row_get_selected (self));
+ g_value_set_boolean (value, sysprof_process_model_row_get_selected (self));
break;
default:
@@ -188,21 +188,21 @@ sp_process_model_row_get_property (GObject *object,
}
static void
-sp_process_model_row_set_property (GObject *object,
+sysprof_process_model_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpProcessModelRow *self = SP_PROCESS_MODEL_ROW (object);
+ SysprofProcessModelRow *self = SYSPROF_PROCESS_MODEL_ROW (object);
switch (prop_id)
{
case PROP_ITEM:
- sp_process_model_row_set_item (self, g_value_get_object (value));
+ sysprof_process_model_row_set_item (self, g_value_get_object (value));
break;
case PROP_SELECTED:
- sp_process_model_row_set_selected (self, g_value_get_boolean (value));
+ sysprof_process_model_row_set_selected (self, g_value_get_boolean (value));
break;
default:
@@ -211,22 +211,22 @@ sp_process_model_row_set_property (GObject *object,
}
static void
-sp_process_model_row_class_init (SpProcessModelRowClass *klass)
+sysprof_process_model_row_class_init (SysprofProcessModelRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = sp_process_model_row_finalize;
- object_class->get_property = sp_process_model_row_get_property;
- object_class->set_property = sp_process_model_row_set_property;
+ object_class->finalize = sysprof_process_model_row_finalize;
+ object_class->get_property = sysprof_process_model_row_get_property;
+ object_class->set_property = sysprof_process_model_row_set_property;
- widget_class->query_tooltip = sp_process_model_row_query_tooltip;
+ widget_class->query_tooltip = sysprof_process_model_row_query_tooltip;
properties [PROP_ITEM] =
g_param_spec_object ("item",
"Item",
"Item",
- SP_TYPE_PROCESS_MODEL_ITEM,
+ SYSPROF_TYPE_PROCESS_MODEL_ITEM,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_SELECTED] =
@@ -239,16 +239,16 @@ sp_process_model_row_class_init (SpProcessModelRowClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gnome/sysprof/ui/sp-process-model-row.ui");
- gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, args_label);
- gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, image);
- gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, label);
- gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, pid);
- gtk_widget_class_bind_template_child_private (widget_class, SpProcessModelRow, check);
+ "/org/gnome/sysprof/ui/sysprof-process-model-row.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, args_label);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, image);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, label);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, pid);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProcessModelRow, check);
}
static void
-sp_process_model_row_init (SpProcessModelRow *self)
+sysprof_process_model_row_init (SysprofProcessModelRow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
diff --git a/src/libsysprof-ui/sp-process-model-row.h b/src/libsysprof-ui/sysprof-process-model-row.h
similarity index 62%
rename from src/libsysprof-ui/sp-process-model-row.h
rename to src/libsysprof-ui/sysprof-process-model-row.h
index ce23862..8f3858a 100644
--- a/src/libsysprof-ui/sp-process-model-row.h
+++ b/src/libsysprof-ui/sysprof-process-model-row.h
@@ -1,4 +1,4 @@
-/* sp-process-model-row.h
+/* sysprof-process-model-row.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,17 +22,17 @@
#include <gtk/gtk.h>
-#include "sp-process-model-item.h"
+#include "sysprof-process-model-item.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_PROCESS_MODEL_ROW (sp_process_model_row_get_type())
+#define SYSPROF_TYPE_PROCESS_MODEL_ROW (sysprof_process_model_row_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpProcessModelRow, sp_process_model_row, SP, PROCESS_MODEL_ROW, GtkListBoxRow)
+G_DECLARE_DERIVABLE_TYPE (SysprofProcessModelRow, sysprof_process_model_row, SYSPROF, PROCESS_MODEL_ROW,
GtkListBoxRow)
-struct _SpProcessModelRowClass
+struct _SysprofProcessModelRowClass
{
GtkListBoxRowClass parent;
@@ -40,13 +40,13 @@ struct _SpProcessModelRowClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_process_model_row_new (SpProcessModelItem *item);
+GtkWidget *sysprof_process_model_row_new (SysprofProcessModelItem *item);
SYSPROF_AVAILABLE_IN_ALL
-SpProcessModelItem *sp_process_model_row_get_item (SpProcessModelRow *self);
+SysprofProcessModelItem *sysprof_process_model_row_get_item (SysprofProcessModelRow *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_process_model_row_get_selected (SpProcessModelRow *self);
+gboolean sysprof_process_model_row_get_selected (SysprofProcessModelRow *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_process_model_row_set_selected (SpProcessModelRow *self,
+void sysprof_process_model_row_set_selected (SysprofProcessModelRow *self,
gboolean selected);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-profiler-menu-button.c b/src/libsysprof-ui/sysprof-profiler-menu-button.c
similarity index 62%
rename from src/libsysprof-ui/sp-profiler-menu-button.c
rename to src/libsysprof-ui/sysprof-profiler-menu-button.c
index 2db897b..38c01c0 100644
--- a/src/libsysprof-ui/sp-profiler-menu-button.c
+++ b/src/libsysprof-ui/sysprof-profiler-menu-button.c
@@ -1,4 +1,4 @@
-/* sp-profiler-menu-button.c
+/* sysprof-profiler-menu-button.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -23,16 +23,16 @@
#include <glib/gi18n.h>
#include <string.h>
-#include "sp-model-filter.h"
-#include "sp-process-model.h"
-#include "sp-process-model-item.h"
-#include "sp-process-model-row.h"
-#include "sp-profiler-menu-button.h"
+#include "sysprof-model-filter.h"
+#include "sysprof-process-model.h"
+#include "sysprof-process-model-item.h"
+#include "sysprof-process-model-row.h"
+#include "sysprof-profiler-menu-button.h"
typedef struct
{
- SpProfiler *profiler;
- SpModelFilter *process_filter;
+ SysprofProfiler *profiler;
+ SysprofModelFilter *process_filter;
/* Gtk template widgets */
GtkTreeModel *environment_model;
@@ -40,7 +40,7 @@ typedef struct
GtkPopover *popover;
GtkEntry *process_filter_entry;
GtkListBox *process_list_box;
- SpProcessModel *process_model;
+ SysprofProcessModel *process_model;
GtkBox *processes_box;
GtkEntry *spawn_entry;
GtkStack *stack;
@@ -63,9 +63,9 @@ typedef struct
/* GSources */
guint save_env_source;
-} SpProfilerMenuButtonPrivate;
+} SysprofProfilerMenuButtonPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (SpProfilerMenuButton, sp_profiler_menu_button, GTK_TYPE_MENU_BUTTON)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofProfilerMenuButton, sysprof_profiler_menu_button, GTK_TYPE_MENU_BUTTON)
enum {
PROP_0,
@@ -73,32 +73,32 @@ enum {
N_PROPS
};
-static void sp_profiler_menu_button_env_row_changed (SpProfilerMenuButton *self,
+static void sysprof_profiler_menu_button_env_row_changed (SysprofProfilerMenuButton *self,
GtkTreePath *tree_path,
GtkTreeIter *tree_iter,
gpointer user_data);
-static void sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
+static void sysprof_profiler_menu_button_validate_spawn (SysprofProfilerMenuButton *self,
GtkEntry *entry);
static gboolean save_environ_to_gsettings (gpointer data);
static GParamSpec *properties [N_PROPS];
GtkWidget *
-sp_profiler_menu_button_new (void)
+sysprof_profiler_menu_button_new (void)
{
- return g_object_new (SP_TYPE_PROFILER_MENU_BUTTON, NULL);
+ return g_object_new (SYSPROF_TYPE_PROFILER_MENU_BUTTON, NULL);
}
static void
-sp_profiler_menu_button_update_label (SpProfilerMenuButton *self)
+sysprof_profiler_menu_button_update_label (SysprofProfilerMenuButton *self)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autofree gchar *str = NULL;
const gchar *visible_child;
const GPid *pids;
guint n_pids = 0;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
if (priv->profiler == NULL)
{
@@ -116,21 +116,21 @@ sp_profiler_menu_button_update_label (SpProfilerMenuButton *self)
if (text && *text)
gtk_label_set_label (priv->label, text);
- else if (sp_profiler_get_whole_system (priv->profiler))
+ else if (sysprof_profiler_get_whole_system (priv->profiler))
gtk_label_set_label (priv->label, _("All Processes"));
else
gtk_label_set_label (priv->label, _("New Process"));
- sp_profiler_set_spawn (priv->profiler, text && *text);
+ sysprof_profiler_set_spawn (priv->profiler, text && *text);
return;
}
- sp_profiler_set_spawn (priv->profiler, FALSE);
+ sysprof_profiler_set_spawn (priv->profiler, FALSE);
- pids = sp_profiler_get_pids (priv->profiler, &n_pids);
+ pids = sysprof_profiler_get_pids (priv->profiler, &n_pids);
- if (n_pids == 0 || sp_profiler_get_whole_system (priv->profiler))
+ if (n_pids == 0 || sysprof_profiler_get_whole_system (priv->profiler))
{
gtk_label_set_label (priv->label, _("All Processes"));
return;
@@ -153,7 +153,7 @@ static void
clear_selected_flags (GtkWidget *widget,
gpointer user_data)
{
- sp_process_model_row_set_selected (SP_PROCESS_MODEL_ROW (widget), FALSE);
+ sysprof_process_model_row_set_selected (SYSPROF_PROCESS_MODEL_ROW (widget), FALSE);
}
static void
@@ -192,12 +192,12 @@ clear_binding (GBinding **binding)
}
static void
-sp_profiler_menu_button_connect (SpProfilerMenuButton *self)
+sysprof_profiler_menu_button_connect (SysprofProfilerMenuButton *self)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
- g_assert (SP_IS_PROFILER (priv->profiler));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER (priv->profiler));
add_binding (&priv->mutable_binding,
priv->profiler, "is-mutable",
@@ -222,23 +222,23 @@ sp_profiler_menu_button_connect (SpProfilerMenuButton *self)
priv->notify_whole_system_handler =
g_signal_connect_object (priv->profiler,
"notify::whole-system",
- G_CALLBACK (sp_profiler_menu_button_update_label),
+ G_CALLBACK (sysprof_profiler_menu_button_update_label),
self,
G_CONNECT_SWAPPED);
- sp_profiler_menu_button_update_label (self);
+ sysprof_profiler_menu_button_update_label (self);
- sp_profiler_menu_button_validate_spawn (self, priv->spawn_entry);
- sp_profiler_menu_button_env_row_changed (self, NULL, NULL, NULL);
+ sysprof_profiler_menu_button_validate_spawn (self, priv->spawn_entry);
+ sysprof_profiler_menu_button_env_row_changed (self, NULL, NULL, NULL);
}
static void
-sp_profiler_menu_button_disconnect (SpProfilerMenuButton *self)
+sysprof_profiler_menu_button_disconnect (SysprofProfilerMenuButton *self)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
- g_assert (SP_IS_PROFILER (priv->profiler));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER (priv->profiler));
clear_binding (&priv->mutable_binding);
clear_binding (&priv->whole_system_binding);
@@ -259,45 +259,45 @@ sp_profiler_menu_button_disconnect (SpProfilerMenuButton *self)
clear_selected_flags,
NULL);
- sp_profiler_menu_button_update_label (self);
+ sysprof_profiler_menu_button_update_label (self);
}
/**
- * sp_profiler_menu_button_get_profiler:
- * @self: An #SpProfilerMenuButton
+ * sysprof_profiler_menu_button_get_profiler:
+ * @self: An #SysprofProfilerMenuButton
*
* Gets the profiler instance that is being configured.
*
- * Returns: (nullable) (transfer none): An #SpProfiler or %NULL.
+ * Returns: (nullable) (transfer none): An #SysprofProfiler or %NULL.
*/
-SpProfiler *
-sp_profiler_menu_button_get_profiler (SpProfilerMenuButton *self)
+SysprofProfiler *
+sysprof_profiler_menu_button_get_profiler (SysprofProfilerMenuButton *self)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
- g_return_val_if_fail (SP_IS_PROFILER_MENU_BUTTON (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER_MENU_BUTTON (self), NULL);
return priv->profiler;
}
void
-sp_profiler_menu_button_set_profiler (SpProfilerMenuButton *self,
- SpProfiler *profiler)
+sysprof_profiler_menu_button_set_profiler (SysprofProfilerMenuButton *self,
+ SysprofProfiler *profiler)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
- g_return_if_fail (SP_IS_PROFILER_MENU_BUTTON (self));
- g_return_if_fail (!profiler || SP_IS_PROFILER (profiler));
+ g_return_if_fail (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
+ g_return_if_fail (!profiler || SYSPROF_IS_PROFILER (profiler));
if (priv->profiler != profiler)
{
if (priv->profiler != NULL)
- sp_profiler_menu_button_disconnect (self);
+ sysprof_profiler_menu_button_disconnect (self);
if (profiler != NULL)
{
priv->profiler = g_object_ref (profiler);
- sp_profiler_menu_button_connect (self);
+ sysprof_profiler_menu_button_connect (self);
}
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PROFILER]);
@@ -305,75 +305,75 @@ sp_profiler_menu_button_set_profiler (SpProfilerMenuButton *self,
}
static void
-sp_profiler_menu_button_row_activated (SpProfilerMenuButton *self,
- SpProcessModelRow *row,
+sysprof_profiler_menu_button_row_activated (SysprofProfilerMenuButton *self,
+ SysprofProcessModelRow *row,
GtkListBox *list_box)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
gboolean selected;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
- g_assert (SP_IS_PROCESS_MODEL_ROW (row));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ROW (row));
g_assert (GTK_IS_LIST_BOX (list_box));
- selected = !sp_process_model_row_get_selected (row);
- sp_process_model_row_set_selected (row, selected);
+ selected = !sysprof_process_model_row_get_selected (row);
+ sysprof_process_model_row_set_selected (row, selected);
if (priv->profiler != NULL)
{
- SpProcessModelItem *item = sp_process_model_row_get_item (row);
- GPid pid = sp_process_model_item_get_pid (item);
+ SysprofProcessModelItem *item = sysprof_process_model_row_get_item (row);
+ GPid pid = sysprof_process_model_item_get_pid (item);
if (selected)
- sp_profiler_add_pid (priv->profiler, pid);
+ sysprof_profiler_add_pid (priv->profiler, pid);
else
- sp_profiler_remove_pid (priv->profiler, pid);
+ sysprof_profiler_remove_pid (priv->profiler, pid);
}
- sp_profiler_menu_button_update_label (self);
+ sysprof_profiler_menu_button_update_label (self);
}
static GtkWidget *
-sp_profiler_menu_button_create_row (gpointer itemptr,
+sysprof_profiler_menu_button_create_row (gpointer itemptr,
gpointer user_data)
{
- SpProcessModelItem *item = itemptr;
+ SysprofProcessModelItem *item = itemptr;
- g_assert (SP_IS_PROCESS_MODEL_ITEM (item));
- g_assert (SP_IS_PROFILER_MENU_BUTTON (user_data));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (item));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (user_data));
- return g_object_new (SP_TYPE_PROCESS_MODEL_ROW,
+ return g_object_new (SYSPROF_TYPE_PROCESS_MODEL_ROW,
"item", item,
"visible", TRUE,
NULL);
}
static void
-sp_profiler_menu_button_clicked (GtkButton *button)
+sysprof_profiler_menu_button_clicked (GtkButton *button)
{
- SpProfilerMenuButton *self = (SpProfilerMenuButton *)button;
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)button;
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
- sp_process_model_queue_reload (priv->process_model);
+ sysprof_process_model_queue_reload (priv->process_model);
- GTK_BUTTON_CLASS (sp_profiler_menu_button_parent_class)->clicked (button);
+ GTK_BUTTON_CLASS (sysprof_profiler_menu_button_parent_class)->clicked (button);
}
static gboolean
-sp_profiler_menu_button_filter_func (GObject *object,
+sysprof_profiler_menu_button_filter_func (GObject *object,
gpointer user_data)
{
const gchar *needle = user_data;
const gchar *haystack;
- g_assert (SP_IS_PROCESS_MODEL_ITEM (object));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (object));
if (needle == NULL)
return TRUE;
- haystack = sp_process_model_item_get_command_line (SP_PROCESS_MODEL_ITEM (object));
+ haystack = sysprof_process_model_item_get_command_line (SYSPROF_PROCESS_MODEL_ITEM (object));
if (haystack == NULL)
return FALSE;
@@ -382,52 +382,52 @@ sp_profiler_menu_button_filter_func (GObject *object,
}
static void
-sp_profiler_menu_button_filter_changed (SpProfilerMenuButton *self,
+sysprof_profiler_menu_button_filter_changed (SysprofProfilerMenuButton *self,
GtkEntry *entry)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
const gchar *text;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (GTK_IS_ENTRY (entry));
text = gtk_entry_get_text (entry);
if (text && *text == 0)
text = NULL;
- sp_model_filter_set_filter_func (priv->process_filter,
- sp_profiler_menu_button_filter_func,
+ sysprof_model_filter_set_filter_func (priv->process_filter,
+ sysprof_profiler_menu_button_filter_func,
g_strdup (text),
g_free);
}
static void
-sp_profiler_menu_button_constructed (GObject *object)
+sysprof_profiler_menu_button_constructed (GObject *object)
{
- SpProfilerMenuButton *self = (SpProfilerMenuButton *)object;
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)object;
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
- priv->process_filter = sp_model_filter_new (G_LIST_MODEL (priv->process_model));
+ priv->process_filter = sysprof_model_filter_new (G_LIST_MODEL (priv->process_model));
gtk_list_box_bind_model (priv->process_list_box,
G_LIST_MODEL (priv->process_filter),
- sp_profiler_menu_button_create_row,
+ sysprof_profiler_menu_button_create_row,
self, NULL);
- G_OBJECT_CLASS (sp_profiler_menu_button_parent_class)->constructed (object);
+ G_OBJECT_CLASS (sysprof_profiler_menu_button_parent_class)->constructed (object);
}
static void
-sp_profiler_menu_button_realize (GtkWidget *widget)
+sysprof_profiler_menu_button_realize (GtkWidget *widget)
{
- SpProfilerMenuButton *self = (SpProfilerMenuButton *)widget;
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)widget;
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autoptr(GSettings) settings = NULL;
g_auto(GStrv) env = NULL;
- GTK_WIDGET_CLASS (sp_profiler_menu_button_parent_class)->realize (widget);
+ GTK_WIDGET_CLASS (sysprof_profiler_menu_button_parent_class)->realize (widget);
settings = g_settings_new ("org.gnome.sysprof2");
@@ -475,13 +475,13 @@ sp_profiler_menu_button_realize (GtkWidget *widget)
static gboolean
save_environ_to_gsettings (gpointer data)
{
- SpProfilerMenuButton *self = data;
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButton *self = data;
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autoptr(GPtrArray) ar = NULL;
g_autoptr(GSettings) settings = NULL;
GtkTreeIter iter;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
priv->save_env_source = 0;
@@ -521,14 +521,14 @@ save_environ_to_gsettings (gpointer data)
static void
-sp_profiler_menu_button_destroy (GtkWidget *widget)
+sysprof_profiler_menu_button_destroy (GtkWidget *widget)
{
- SpProfilerMenuButton *self = (SpProfilerMenuButton *)widget;
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButton *self = (SysprofProfilerMenuButton *)widget;
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
if (priv->profiler != NULL)
{
- sp_profiler_menu_button_disconnect (self);
+ sysprof_profiler_menu_button_disconnect (self);
g_clear_object (&priv->profiler);
}
@@ -540,21 +540,21 @@ sp_profiler_menu_button_destroy (GtkWidget *widget)
priv->save_env_source = 0;
}
- GTK_WIDGET_CLASS (sp_profiler_menu_button_parent_class)->destroy (widget);
+ GTK_WIDGET_CLASS (sysprof_profiler_menu_button_parent_class)->destroy (widget);
}
static void
-sp_profiler_menu_button_get_property (GObject *object,
+sysprof_profiler_menu_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpProfilerMenuButton *self = SP_PROFILER_MENU_BUTTON (object);
+ SysprofProfilerMenuButton *self = SYSPROF_PROFILER_MENU_BUTTON (object);
switch (prop_id)
{
case PROP_PROFILER:
- g_value_set_object (value, sp_profiler_menu_button_get_profiler (self));
+ g_value_set_object (value, sysprof_profiler_menu_button_get_profiler (self));
break;
default:
@@ -563,17 +563,17 @@ sp_profiler_menu_button_get_property (GObject *object,
}
static void
-sp_profiler_menu_button_set_property (GObject *object,
+sysprof_profiler_menu_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpProfilerMenuButton *self = SP_PROFILER_MENU_BUTTON (object);
+ SysprofProfilerMenuButton *self = SYSPROF_PROFILER_MENU_BUTTON (object);
switch (prop_id)
{
case PROP_PROFILER:
- sp_profiler_menu_button_set_profiler (self, g_value_get_object (value));
+ sysprof_profiler_menu_button_set_profiler (self, g_value_get_object (value));
break;
default:
@@ -582,61 +582,61 @@ sp_profiler_menu_button_set_property (GObject *object,
}
static void
-sp_profiler_menu_button_class_init (SpProfilerMenuButtonClass *klass)
+sysprof_profiler_menu_button_class_init (SysprofProfilerMenuButtonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
- object_class->constructed = sp_profiler_menu_button_constructed;
- object_class->get_property = sp_profiler_menu_button_get_property;
- object_class->set_property = sp_profiler_menu_button_set_property;
+ object_class->constructed = sysprof_profiler_menu_button_constructed;
+ object_class->get_property = sysprof_profiler_menu_button_get_property;
+ object_class->set_property = sysprof_profiler_menu_button_set_property;
- widget_class->destroy = sp_profiler_menu_button_destroy;
- widget_class->realize = sp_profiler_menu_button_realize;
+ widget_class->destroy = sysprof_profiler_menu_button_destroy;
+ widget_class->realize = sysprof_profiler_menu_button_realize;
- button_class->clicked = sp_profiler_menu_button_clicked;
+ button_class->clicked = sysprof_profiler_menu_button_clicked;
properties [PROP_PROFILER] =
g_param_spec_object ("profiler",
"Profiler",
"Profiler",
- SP_TYPE_PROFILER,
+ SYSPROF_TYPE_PROFILER,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
- gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sp-profiler-menu-button.ui");
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, env_key_column);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, env_tree_view);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, env_value_column);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, environment_model);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, inherit_environ);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, key_cell);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, label);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, popover);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, process_filter_entry);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, process_list_box);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, process_model);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, processes_box);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, spawn_entry);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, stack);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, value_cell);
- gtk_widget_class_bind_template_child_private (widget_class, SpProfilerMenuButton, whole_system_switch);
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sysprof-profiler-menu-button.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, env_key_column);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, env_tree_view);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, env_value_column);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, environment_model);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, inherit_environ);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, key_cell);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, label);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, popover);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton,
process_filter_entry);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, process_list_box);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, process_model);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, processes_box);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, spawn_entry);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, stack);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton, value_cell);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofProfilerMenuButton,
whole_system_switch);
}
static void
-sp_profiler_menu_button_env_row_changed (SpProfilerMenuButton *self,
+sysprof_profiler_menu_button_env_row_changed (SysprofProfilerMenuButton *self,
GtkTreePath *tree_path,
GtkTreeIter *tree_iter,
gpointer user_data)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_autoptr(GPtrArray) env = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (GTK_IS_TREE_MODEL (priv->environment_model));
/* queue saving settings to gsettings */
@@ -673,14 +673,14 @@ sp_profiler_menu_button_env_row_changed (SpProfilerMenuButton *self,
while (gtk_tree_model_iter_next (model, &iter));
}
g_ptr_array_add (env, NULL);
- sp_profiler_set_spawn_env (priv->profiler, (const gchar * const *)env->pdata);
+ sysprof_profiler_set_spawn_env (priv->profiler, (const gchar * const *)env->pdata);
}
static void
-on_backspace (SpProfilerMenuButton *self,
+on_backspace (SysprofProfilerMenuButton *self,
GtkEntry *entry)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
if (g_object_get_data (G_OBJECT (entry), "CELL_WAS_EMPTY"))
{
@@ -703,7 +703,7 @@ on_backspace (SpProfilerMenuButton *self,
}
static void
-sp_profiler_menu_button_env_key_editing_started (SpProfilerMenuButton *self,
+sysprof_profiler_menu_button_env_key_editing_started (SysprofProfilerMenuButton *self,
GtkCellEditable *editable,
const gchar *path,
GtkCellRenderer *cell)
@@ -716,17 +716,17 @@ sp_profiler_menu_button_env_key_editing_started (SpProfilerMenuButton *self,
}
static void
-sp_profiler_menu_button_env_key_edited (SpProfilerMenuButton *self,
+sysprof_profiler_menu_button_env_key_edited (SysprofProfilerMenuButton *self,
const gchar *path,
const gchar *new_text,
GtkCellRendererText *cell)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
GtkTreeModel *model;
GtkTreePath *tree_path;
GtkTreeIter iter;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (path != NULL);
g_assert (new_text != NULL);
g_assert (GTK_IS_CELL_RENDERER_TEXT (cell));
@@ -755,18 +755,18 @@ sp_profiler_menu_button_env_key_edited (SpProfilerMenuButton *self,
}
static void
-sp_profiler_menu_button_env_value_edited (SpProfilerMenuButton *self,
+sysprof_profiler_menu_button_env_value_edited (SysprofProfilerMenuButton *self,
const gchar *path,
const gchar *new_text,
GtkCellRendererText *cell)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
GtkTreeModel *model;
GtkTreePath *tree_path;
GtkTreeIter iter;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (path != NULL);
g_assert (new_text != NULL);
g_assert (GTK_IS_CELL_RENDERER_TEXT (cell));
@@ -797,23 +797,23 @@ sp_profiler_menu_button_env_value_edited (SpProfilerMenuButton *self,
}
static void
-sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
+sysprof_profiler_menu_button_validate_spawn (SysprofProfilerMenuButton *self,
GtkEntry *entry)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
g_auto(GStrv) argv = NULL;
g_autoptr(GError) error = NULL;
const gchar *text;
gint argc;
- g_assert (SP_IS_PROFILER_MENU_BUTTON (self));
+ g_assert (SYSPROF_IS_PROFILER_MENU_BUTTON (self));
g_assert (GTK_IS_ENTRY (entry));
text = gtk_entry_get_text (entry);
if (text && *text && !g_shell_parse_argv (text, &argc, &argv, &error))
{
- sp_profiler_set_spawn_argv (priv->profiler, NULL);
+ sysprof_profiler_set_spawn_argv (priv->profiler, NULL);
g_object_set (entry,
"secondary-icon-name", "dialog-warning-symbolic",
"secondary-icon-tooltip-text", _("The command line arguments provided are invalid"),
@@ -821,7 +821,7 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
}
else
{
- sp_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
+ sysprof_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
g_object_set (entry,
"secondary-icon-name", NULL,
"secondary-icon-tooltip-text", NULL,
@@ -830,63 +830,63 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
}
static void
-sp_profiler_menu_button_init (SpProfilerMenuButton *self)
+sysprof_profiler_menu_button_init (SysprofProfilerMenuButton *self)
{
- SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
+ SysprofProfilerMenuButtonPrivate *priv = sysprof_profiler_menu_button_get_instance_private (self);
gtk_widget_init_template (GTK_WIDGET (self));
g_signal_connect_object (priv->process_filter_entry,
"changed",
- G_CALLBACK (sp_profiler_menu_button_filter_changed),
+ G_CALLBACK (sysprof_profiler_menu_button_filter_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->spawn_entry,
"changed",
- G_CALLBACK (sp_profiler_menu_button_update_label),
+ G_CALLBACK (sysprof_profiler_menu_button_update_label),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->spawn_entry,
"changed",
- G_CALLBACK (sp_profiler_menu_button_validate_spawn),
+ G_CALLBACK (sysprof_profiler_menu_button_validate_spawn),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->stack,
"notify::visible-child",
- G_CALLBACK (sp_profiler_menu_button_update_label),
+ G_CALLBACK (sysprof_profiler_menu_button_update_label),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->process_list_box,
"row-activated",
- G_CALLBACK (sp_profiler_menu_button_row_activated),
+ G_CALLBACK (sysprof_profiler_menu_button_row_activated),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->key_cell,
"edited",
- G_CALLBACK (sp_profiler_menu_button_env_key_edited),
+ G_CALLBACK (sysprof_profiler_menu_button_env_key_edited),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->value_cell,
"edited",
- G_CALLBACK (sp_profiler_menu_button_env_value_edited),
+ G_CALLBACK (sysprof_profiler_menu_button_env_value_edited),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (gtk_tree_view_get_model (priv->env_tree_view),
"row-changed",
- G_CALLBACK (sp_profiler_menu_button_env_row_changed),
+ G_CALLBACK (sysprof_profiler_menu_button_env_row_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->key_cell,
"editing-started",
- G_CALLBACK (sp_profiler_menu_button_env_key_editing_started),
+ G_CALLBACK (sysprof_profiler_menu_button_env_key_editing_started),
self,
G_CONNECT_SWAPPED);
diff --git a/src/libsysprof-ui/sp-profiler-menu-button.h b/src/libsysprof-ui/sysprof-profiler-menu-button.h
similarity index 61%
rename from src/libsysprof-ui/sp-profiler-menu-button.h
rename to src/libsysprof-ui/sysprof-profiler-menu-button.h
index d761e30..a30fffb 100644
--- a/src/libsysprof-ui/sp-profiler-menu-button.h
+++ b/src/libsysprof-ui/sysprof-profiler-menu-button.h
@@ -1,4 +1,4 @@
-/* sp-profiler-menu-button.h
+/* sysprof-profiler-menu-button.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,17 +22,17 @@
#include <gtk/gtk.h>
-#include "sp-profiler.h"
+#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_PROFILER_MENU_BUTTON (sp_profiler_menu_button_get_type())
+#define SYSPROF_TYPE_PROFILER_MENU_BUTTON (sysprof_profiler_menu_button_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpProfilerMenuButton, sp_profiler_menu_button, SP, PROFILER_MENU_BUTTON,
GtkMenuButton)
+G_DECLARE_DERIVABLE_TYPE (SysprofProfilerMenuButton, sysprof_profiler_menu_button, SYSPROF,
PROFILER_MENU_BUTTON, GtkMenuButton)
-struct _SpProfilerMenuButtonClass
+struct _SysprofProfilerMenuButtonClass
{
GtkMenuButtonClass parent_class;
@@ -40,11 +40,11 @@ struct _SpProfilerMenuButtonClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_profiler_menu_button_new (void);
+GtkWidget *sysprof_profiler_menu_button_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_profiler_menu_button_set_profiler (SpProfilerMenuButton *self,
- SpProfiler *profiler);
+void sysprof_profiler_menu_button_set_profiler (SysprofProfilerMenuButton *self,
+ SysprofProfiler *profiler);
SYSPROF_AVAILABLE_IN_ALL
-SpProfiler *sp_profiler_menu_button_get_profiler (SpProfilerMenuButton *self);
+SysprofProfiler *sysprof_profiler_menu_button_get_profiler (SysprofProfilerMenuButton *self);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-recording-state-view.c b/src/libsysprof-ui/sysprof-recording-state-view.c
similarity index 59%
rename from src/libsysprof-ui/sp-recording-state-view.c
rename to src/libsysprof-ui/sysprof-recording-state-view.c
index fde6616..21222b4 100644
--- a/src/libsysprof-ui/sp-recording-state-view.c
+++ b/src/libsysprof-ui/sysprof-recording-state-view.c
@@ -1,4 +1,4 @@
-/* sp-recording-state-view.c
+/* sysprof-recording-state-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,16 +20,16 @@
#include "config.h"
-#include "sp-recording-state-view.h"
+#include "sysprof-recording-state-view.h"
typedef struct
{
- SpProfiler *profiler;
+ SysprofProfiler *profiler;
gulong notify_elapsed_handler;
GtkLabel *elapsed;
-} SpRecordingStateViewPrivate;
+} SysprofRecordingStateViewPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (SpRecordingStateView, sp_recording_state_view, GTK_TYPE_BIN)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofRecordingStateView, sysprof_recording_state_view, GTK_TYPE_BIN)
enum {
PROP_0,
@@ -40,27 +40,27 @@ enum {
static GParamSpec *properties [N_PROPS];
GtkWidget *
-sp_recording_state_view_new (void)
+sysprof_recording_state_view_new (void)
{
- return g_object_new (SP_TYPE_RECORDING_STATE_VIEW, NULL);
+ return g_object_new (SYSPROF_TYPE_RECORDING_STATE_VIEW, NULL);
}
static void
-sp_recording_state_view_notify_elapsed (SpRecordingStateView *self,
+sysprof_recording_state_view_notify_elapsed (SysprofRecordingStateView *self,
GParamSpec *pspec,
- SpProfiler *profiler)
+ SysprofProfiler *profiler)
{
- SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
+ SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
g_autofree gchar *str = NULL;
gint64 elapsed;
guint hours;
guint minutes;
guint seconds;
- g_assert (SP_IS_RECORDING_STATE_VIEW (self));
- g_assert (SP_IS_PROFILER (profiler));
+ g_assert (SYSPROF_IS_RECORDING_STATE_VIEW (self));
+ g_assert (SYSPROF_IS_PROFILER (profiler));
- elapsed = (gint64)sp_profiler_get_elapsed (profiler);
+ elapsed = (gint64)sysprof_profiler_get_elapsed (profiler);
hours = elapsed / (60 * 60);
if (hours > 0)
@@ -78,10 +78,10 @@ sp_recording_state_view_notify_elapsed (SpRecordingStateView *self,
}
static void
-sp_recording_state_view_destroy (GtkWidget *widget)
+sysprof_recording_state_view_destroy (GtkWidget *widget)
{
- SpRecordingStateView *self = (SpRecordingStateView *)widget;
- SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
+ SysprofRecordingStateView *self = (SysprofRecordingStateView *)widget;
+ SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
if (priv->profiler != NULL)
{
@@ -89,17 +89,17 @@ sp_recording_state_view_destroy (GtkWidget *widget)
g_clear_object (&priv->profiler);
}
- GTK_WIDGET_CLASS (sp_recording_state_view_parent_class)->destroy (widget);
+ GTK_WIDGET_CLASS (sysprof_recording_state_view_parent_class)->destroy (widget);
}
static void
-sp_recording_state_view_get_property (GObject *object,
+sysprof_recording_state_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpRecordingStateView *self = SP_RECORDING_STATE_VIEW (object);
- SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
+ SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
+ SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
switch (prop_id)
{
@@ -113,17 +113,17 @@ sp_recording_state_view_get_property (GObject *object,
}
static void
-sp_recording_state_view_set_property (GObject *object,
+sysprof_recording_state_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpRecordingStateView *self = SP_RECORDING_STATE_VIEW (object);
+ SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
switch (prop_id)
{
case PROP_PROFILER:
- sp_recording_state_view_set_profiler (self, g_value_get_object (value));
+ sysprof_recording_state_view_set_profiler (self, g_value_get_object (value));
break;
default:
@@ -132,44 +132,44 @@ sp_recording_state_view_set_property (GObject *object,
}
static void
-sp_recording_state_view_class_init (SpRecordingStateViewClass *klass)
+sysprof_recording_state_view_class_init (SysprofRecordingStateViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->get_property = sp_recording_state_view_get_property;
- object_class->set_property = sp_recording_state_view_set_property;
+ object_class->get_property = sysprof_recording_state_view_get_property;
+ object_class->set_property = sysprof_recording_state_view_set_property;
- widget_class->destroy = sp_recording_state_view_destroy;
+ widget_class->destroy = sysprof_recording_state_view_destroy;
properties [PROP_PROFILER] =
g_param_spec_object ("profiler",
"Profiler",
"Profiler",
- SP_TYPE_PROFILER,
+ SYSPROF_TYPE_PROFILER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gnome/sysprof/ui/sp-recording-state-view.ui");
- gtk_widget_class_bind_template_child_private (widget_class, SpRecordingStateView, elapsed);
+ "/org/gnome/sysprof/ui/sysprof-recording-state-view.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofRecordingStateView, elapsed);
}
static void
-sp_recording_state_view_init (SpRecordingStateView *self)
+sysprof_recording_state_view_init (SysprofRecordingStateView *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
void
-sp_recording_state_view_set_profiler (SpRecordingStateView *self,
- SpProfiler *profiler)
+sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self,
+ SysprofProfiler *profiler)
{
- SpRecordingStateViewPrivate *priv = sp_recording_state_view_get_instance_private (self);
+ SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
- g_assert (SP_IS_RECORDING_STATE_VIEW (self));
- g_assert (!profiler || SP_IS_PROFILER (profiler));
+ g_assert (SYSPROF_IS_RECORDING_STATE_VIEW (self));
+ g_assert (!profiler || SYSPROF_IS_PROFILER (profiler));
gtk_label_set_label (priv->elapsed, "00:00");
@@ -189,7 +189,7 @@ sp_recording_state_view_set_profiler (SpRecordingStateView *self,
priv->notify_elapsed_handler =
g_signal_connect_object (profiler,
"notify::elapsed",
- G_CALLBACK (sp_recording_state_view_notify_elapsed),
+ G_CALLBACK (sysprof_recording_state_view_notify_elapsed),
self,
G_CONNECT_SWAPPED);
}
diff --git a/src/libsysprof-ui/sp-failed-state-view.h b/src/libsysprof-ui/sysprof-recording-state-view.h
similarity index 64%
rename from src/libsysprof-ui/sp-failed-state-view.h
rename to src/libsysprof-ui/sysprof-recording-state-view.h
index c201cb4..30ade80 100644
--- a/src/libsysprof-ui/sp-failed-state-view.h
+++ b/src/libsysprof-ui/sysprof-recording-state-view.h
@@ -1,4 +1,4 @@
-/* sp-failed-state-view.h
+/* sysprof-recording-state-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,17 +22,17 @@
#include <gtk/gtk.h>
-#include "sp-profiler.h"
+#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_FAILED_STATE_VIEW (sp_failed_state_view_get_type())
+#define SYSPROF_TYPE_RECORDING_STATE_VIEW (sysprof_recording_state_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpFailedStateView, sp_failed_state_view, SP, FAILED_STATE_VIEW, GtkBin)
+G_DECLARE_DERIVABLE_TYPE (SysprofRecordingStateView, sysprof_recording_state_view, SYSPROF,
RECORDING_STATE_VIEW, GtkBin)
-struct _SpFailedStateViewClass
+struct _SysprofRecordingStateViewClass
{
GtkBinClass parent;
@@ -40,9 +40,9 @@ struct _SpFailedStateViewClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_failed_state_view_new (void);
+GtkWidget *sysprof_recording_state_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_failed_state_view_set_profiler (SpFailedStateView *self,
- SpProfiler *profiler);
+void sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self,
+ SysprofProfiler *profiler);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-theme-manager.c b/src/libsysprof-ui/sysprof-theme-manager.c
similarity index 80%
rename from src/libsysprof-ui/sp-theme-manager.c
rename to src/libsysprof-ui/sysprof-theme-manager.c
index f8efdc8..b1ebfe5 100644
--- a/src/libsysprof-ui/sp-theme-manager.c
+++ b/src/libsysprof-ui/sysprof-theme-manager.c
@@ -1,4 +1,4 @@
-/* sp-theme-manager.c
+/* sysprof-theme-manager.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,13 +18,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-theme-manager"
+#define G_LOG_DOMAIN "sysprof-theme-manager"
#include "config.h"
-#include "sp-theme-manager.h"
+#include "sysprof-theme-manager.h"
-struct _SpThemeManager
+struct _SysprofThemeManager
{
GObject parent_instance;
GHashTable *theme_resources;
@@ -42,7 +42,7 @@ typedef struct
GtkCssProvider *provider;
} ThemeResource;
-G_DEFINE_TYPE (SpThemeManager, sp_theme_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE (SysprofThemeManager, sysprof_theme_manager, G_TYPE_OBJECT)
static void
theme_resource_free (gpointer data)
@@ -98,14 +98,14 @@ theme_resource_matches (ThemeResource *theme_resource,
}
static gboolean
-sp_theme_manager_do_reload (gpointer data)
+sysprof_theme_manager_do_reload (gpointer data)
{
- SpThemeManager *self = data;
+ SysprofThemeManager *self = data;
ThemeResource *theme_resource;
GHashTableIter iter;
GtkSettings *settings;
- g_assert (SP_IS_THEME_MANAGER (self));
+ g_assert (SYSPROF_IS_THEME_MANAGER (self));
self->reload_source = 0;
@@ -141,21 +141,21 @@ sp_theme_manager_do_reload (gpointer data)
}
static void
-sp_theme_manager_queue_reload (SpThemeManager *self)
+sysprof_theme_manager_queue_reload (SysprofThemeManager *self)
{
- g_assert (SP_IS_THEME_MANAGER (self));
+ g_assert (SYSPROF_IS_THEME_MANAGER (self));
if (self->reload_source == 0)
self->reload_source = gdk_threads_add_idle_full (G_PRIORITY_LOW,
- sp_theme_manager_do_reload,
+ sysprof_theme_manager_do_reload,
self,
NULL);
}
static void
-sp_theme_manager_finalize (GObject *object)
+sysprof_theme_manager_finalize (GObject *object)
{
- SpThemeManager *self = (SpThemeManager *)object;
+ SysprofThemeManager *self = (SysprofThemeManager *)object;
if (self->reload_source != 0)
{
@@ -165,19 +165,19 @@ sp_theme_manager_finalize (GObject *object)
g_clear_pointer (&self->theme_resources, g_hash_table_unref);
- G_OBJECT_CLASS (sp_theme_manager_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_theme_manager_parent_class)->finalize (object);
}
static void
-sp_theme_manager_class_init (SpThemeManagerClass *klass)
+sysprof_theme_manager_class_init (SysprofThemeManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_theme_manager_finalize;
+ object_class->finalize = sysprof_theme_manager_finalize;
}
static void
-sp_theme_manager_init (SpThemeManager *self)
+sysprof_theme_manager_init (SysprofThemeManager *self)
{
self->theme_resources = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, theme_resource_free);
@@ -185,23 +185,23 @@ sp_theme_manager_init (SpThemeManager *self)
}
/**
- * sp_theme_manager_get_default:
+ * sysprof_theme_manager_get_default:
*
- * Returns: (transfer none): An #SpThemeManager
+ * Returns: (transfer none): An #SysprofThemeManager
*/
-SpThemeManager *
-sp_theme_manager_get_default (void)
+SysprofThemeManager *
+sysprof_theme_manager_get_default (void)
{
- static SpThemeManager *instance;
+ static SysprofThemeManager *instance;
if (instance == NULL)
- instance = g_object_new (SP_TYPE_THEME_MANAGER, NULL);
+ instance = g_object_new (SYSPROF_TYPE_THEME_MANAGER, NULL);
return instance;
}
guint
-sp_theme_manager_register_resource (SpThemeManager *self,
+sysprof_theme_manager_register_resource (SysprofThemeManager *self,
const gchar *theme_name,
const gchar *variant,
const gchar *resource)
@@ -210,7 +210,7 @@ sp_theme_manager_register_resource (SpThemeManager *self,
static guint counter;
guint id;
- g_return_val_if_fail (SP_IS_THEME_MANAGER (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_THEME_MANAGER (self), 0);
theme_resource = g_slice_new0 (ThemeResource);
theme_resource->id = id = ++counter;
@@ -230,29 +230,29 @@ sp_theme_manager_register_resource (SpThemeManager *self,
self->registered_signals = TRUE;
g_signal_connect_object (gtk_settings_get_default (),
"notify::gtk-application-prefer-dark-theme",
- G_CALLBACK (sp_theme_manager_queue_reload),
+ G_CALLBACK (sysprof_theme_manager_queue_reload),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (gtk_settings_get_default (),
"notify::gtk-theme-name",
- G_CALLBACK (sp_theme_manager_queue_reload),
+ G_CALLBACK (sysprof_theme_manager_queue_reload),
self,
G_CONNECT_SWAPPED);
}
- sp_theme_manager_queue_reload (self);
+ sysprof_theme_manager_queue_reload (self);
return id;
}
void
-sp_theme_manager_unregister (SpThemeManager *self,
+sysprof_theme_manager_unregister (SysprofThemeManager *self,
guint registration_id)
{
GHashTableIter iter;
ThemeResource *theme_resource;
- g_return_if_fail (SP_IS_THEME_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_THEME_MANAGER (self));
g_hash_table_iter_init (&iter, self->theme_resources);
diff --git a/src/libsysprof-ui/sp-theme-manager.h b/src/libsysprof-ui/sysprof-theme-manager.h
similarity index 73%
rename from src/libsysprof-ui/sp-theme-manager.h
rename to src/libsysprof-ui/sysprof-theme-manager.h
index e1562e9..6388049 100644
--- a/src/libsysprof-ui/sp-theme-manager.h
+++ b/src/libsysprof-ui/sysprof-theme-manager.h
@@ -1,4 +1,4 @@
-/* sp-theme-manager.h
+/* sysprof-theme-manager.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -24,18 +24,18 @@
G_BEGIN_DECLS
-#define SP_TYPE_THEME_MANAGER (sp_theme_manager_get_type())
+#define SYSPROF_TYPE_THEME_MANAGER (sysprof_theme_manager_get_type())
G_GNUC_INTERNAL
-G_DECLARE_FINAL_TYPE (SpThemeManager, sp_theme_manager, SP, THEME_MANAGER, GObject)
+G_DECLARE_FINAL_TYPE (SysprofThemeManager, sysprof_theme_manager, SYSPROF, THEME_MANAGER, GObject)
G_GNUC_INTERNAL
-SpThemeManager *sp_theme_manager_get_default (void);
+SysprofThemeManager *sysprof_theme_manager_get_default (void);
G_GNUC_INTERNAL
-void sp_theme_manager_unregister (SpThemeManager *self,
+void sysprof_theme_manager_unregister (SysprofThemeManager *self,
guint registration_id);
G_GNUC_INTERNAL
-guint sp_theme_manager_register_resource (SpThemeManager *self,
+guint sysprof_theme_manager_register_resource (SysprofThemeManager *self,
const gchar *theme_name,
const gchar *variant,
const gchar *resource);
diff --git a/src/libsysprof-ui/sysprof-ui.h b/src/libsysprof-ui/sysprof-ui.h
index bdbf7f3..6e27882 100644
--- a/src/libsysprof-ui/sysprof-ui.h
+++ b/src/libsysprof-ui/sysprof-ui.h
@@ -26,22 +26,22 @@ G_BEGIN_DECLS
#define SYSPROF_UI_INSIDE
-# include "sp-callgraph-view.h"
-# include "sp-cell-renderer-percent.h"
-# include "sp-cpu-visualizer-row.h"
-# include "sp-failed-state-view.h"
-# include "sp-line-visualizer-row.h"
-# include "sp-empty-state-view.h"
-# include "sp-model-filter.h"
-# include "sp-multi-paned.h"
-# include "sp-recording-state-view.h"
-# include "sp-process-model.h"
-# include "sp-process-model-item.h"
-# include "sp-process-model-row.h"
-# include "sp-profiler-menu-button.h"
-# include "sp-visualizer-row.h"
-# include "sp-visualizer-view.h"
-# include "sp-zoom-manager.h"
+# include "sysprof-callgraph-view.h"
+# include "sysprof-cell-renderer-percent.h"
+# include "sysprof-cpu-visualizer-row.h"
+# include "sysprof-failed-state-view.h"
+# include "sysprof-line-visualizer-row.h"
+# include "sysprof-empty-state-view.h"
+# include "sysprof-model-filter.h"
+# include "sysprof-multi-paned.h"
+# include "sysprof-recording-state-view.h"
+# include "sysprof-process-model.h"
+# include "sysprof-process-model-item.h"
+# include "sysprof-process-model-row.h"
+# include "sysprof-profiler-menu-button.h"
+# include "sysprof-visualizer-row.h"
+# include "sysprof-visualizer-view.h"
+# include "sysprof-zoom-manager.h"
#undef SYSPROF_UI_INSIDE
diff --git a/src/libsysprof-ui/sp-visualizer-list.c b/src/libsysprof-ui/sysprof-visualizer-list.c
similarity index 59%
rename from src/libsysprof-ui/sp-visualizer-list.c
rename to src/libsysprof-ui/sysprof-visualizer-list.c
index 02833dc..1673c63 100644
--- a/src/libsysprof-ui/sp-visualizer-list.c
+++ b/src/libsysprof-ui/sysprof-visualizer-list.c
@@ -1,4 +1,4 @@
-/* sp-visualizer-list.c
+/* sysprof-visualizer-list.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,33 +18,33 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-visualizer-list"
+#define G_LOG_DOMAIN "sysprof-visualizer-list"
#include "config.h"
#include <glib/gi18n.h>
#include <sysprof.h>
-#include "sp-cpu-visualizer-row.h"
-#include "sp-visualizer-list.h"
-#include "sp-visualizer-row.h"
-#include "sp-mark-visualizer-row.h"
-#include "sp-zoom-manager.h"
+#include "sysprof-cpu-visualizer-row.h"
+#include "sysprof-visualizer-list.h"
+#include "sysprof-visualizer-row.h"
+#include "sysprof-mark-visualizer-row.h"
+#include "sysprof-zoom-manager.h"
#define NSEC_PER_SEC G_GUINT64_CONSTANT(1000000000)
#define DEFAULT_PIXELS_PER_SECOND 20
typedef struct
{
- SpCaptureReader *reader;
- SpZoomManager *zoom_manager;
+ SysprofCaptureReader *reader;
+ SysprofZoomManager *zoom_manager;
gint64 begin_time;
gint64 end_time;
-} SpVisualizerListPrivate;
+} SysprofVisualizerListPrivate;
typedef struct
{
- SpCaptureCursor *cursor;
+ SysprofCaptureCursor *cursor;
GHashTable *mark_groups;
guint fps_counter;
GArray *memory;
@@ -58,7 +58,7 @@ enum {
N_PROPS
};
-G_DEFINE_TYPE_WITH_PRIVATE (SpVisualizerList, sp_visualizer_list, GTK_TYPE_LIST_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (SysprofVisualizerList, sysprof_visualizer_list, GTK_TYPE_LIST_BOX)
static GParamSpec *properties [N_PROPS];
@@ -67,53 +67,53 @@ discovery_free (Discovery *state)
{
g_clear_pointer (&state->mark_groups, g_hash_table_unref);
g_clear_pointer (&state->memory, g_array_unref);
- g_clear_pointer (&state->cursor, sp_capture_cursor_unref);
+ g_clear_pointer (&state->cursor, sysprof_capture_cursor_unref);
g_slice_free (Discovery, state);
}
static void
-sp_visualizer_list_add (GtkContainer *container,
+sysprof_visualizer_list_add (GtkContainer *container,
GtkWidget *widget)
{
- SpVisualizerList *self = (SpVisualizerList *)container;
- SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
+ SysprofVisualizerList *self = (SysprofVisualizerList *)container;
+ SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
- GTK_CONTAINER_CLASS (sp_visualizer_list_parent_class)->add (container, widget);
+ GTK_CONTAINER_CLASS (sysprof_visualizer_list_parent_class)->add (container, widget);
- if (SP_IS_VISUALIZER_ROW (widget))
+ if (SYSPROF_IS_VISUALIZER_ROW (widget))
{
- sp_visualizer_row_set_reader (SP_VISUALIZER_ROW (widget), priv->reader);
- sp_visualizer_row_set_zoom_manager (SP_VISUALIZER_ROW (widget), priv->zoom_manager);
+ sysprof_visualizer_row_set_reader (SYSPROF_VISUALIZER_ROW (widget), priv->reader);
+ sysprof_visualizer_row_set_zoom_manager (SYSPROF_VISUALIZER_ROW (widget), priv->zoom_manager);
}
}
static void
-sp_visualizer_list_finalize (GObject *object)
+sysprof_visualizer_list_finalize (GObject *object)
{
- SpVisualizerList *self = (SpVisualizerList *)object;
- SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
+ SysprofVisualizerList *self = (SysprofVisualizerList *)object;
+ SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
- G_OBJECT_CLASS (sp_visualizer_list_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_visualizer_list_parent_class)->finalize (object);
}
static void
-sp_visualizer_list_get_property (GObject *object,
+sysprof_visualizer_list_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpVisualizerList *self = SP_VISUALIZER_LIST (object);
+ SysprofVisualizerList *self = SYSPROF_VISUALIZER_LIST (object);
switch (prop_id)
{
case PROP_READER:
- g_value_set_boxed (value, sp_visualizer_list_get_reader (self));
+ g_value_set_boxed (value, sysprof_visualizer_list_get_reader (self));
break;
case PROP_ZOOM_MANAGER:
- g_value_set_object (value, sp_visualizer_list_get_zoom_manager (self));
+ g_value_set_object (value, sysprof_visualizer_list_get_zoom_manager (self));
break;
default:
@@ -122,21 +122,21 @@ sp_visualizer_list_get_property (GObject *object,
}
static void
-sp_visualizer_list_set_property (GObject *object,
+sysprof_visualizer_list_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpVisualizerList *self = SP_VISUALIZER_LIST (object);
+ SysprofVisualizerList *self = SYSPROF_VISUALIZER_LIST (object);
switch (prop_id)
{
case PROP_READER:
- sp_visualizer_list_set_reader (self, g_value_get_boxed (value));
+ sysprof_visualizer_list_set_reader (self, g_value_get_boxed (value));
break;
case PROP_ZOOM_MANAGER:
- sp_visualizer_list_set_zoom_manager (self, g_value_get_object (value));
+ sysprof_visualizer_list_set_zoom_manager (self, g_value_get_object (value));
break;
default:
@@ -145,64 +145,64 @@ sp_visualizer_list_set_property (GObject *object,
}
static void
-sp_visualizer_list_class_init (SpVisualizerListClass *klass)
+sysprof_visualizer_list_class_init (SysprofVisualizerListClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- object_class->finalize = sp_visualizer_list_finalize;
- object_class->get_property = sp_visualizer_list_get_property;
- object_class->set_property = sp_visualizer_list_set_property;
+ object_class->finalize = sysprof_visualizer_list_finalize;
+ object_class->get_property = sysprof_visualizer_list_get_property;
+ object_class->set_property = sysprof_visualizer_list_set_property;
- container_class->add = sp_visualizer_list_add;
+ container_class->add = sysprof_visualizer_list_add;
properties [PROP_READER] =
g_param_spec_boxed ("reader",
"Reader",
"The capture reader",
- SP_TYPE_CAPTURE_READER,
+ SYSPROF_TYPE_CAPTURE_READER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager",
"Zoom Manager",
"The zoom manager",
- SP_TYPE_ZOOM_MANAGER,
+ SYSPROF_TYPE_ZOOM_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
-sp_visualizer_list_init (SpVisualizerList *self)
+sysprof_visualizer_list_init (SysprofVisualizerList *self)
{
}
GtkWidget *
-sp_visualizer_list_new (void)
+sysprof_visualizer_list_new (void)
{
- return g_object_new (SP_TYPE_VISUALIZER_ROW, NULL);
+ return g_object_new (SYSPROF_TYPE_VISUALIZER_ROW, NULL);
}
/**
- * sp_visualizer_list_get_reader:
+ * sysprof_visualizer_list_get_reader:
*
- * Gets the reader that is being used for the #SpVisualizerList.
+ * Gets the reader that is being used for the #SysprofVisualizerList.
*
- * Returns: (transfer none): An #SpCaptureReader
+ * Returns: (transfer none): An #SysprofCaptureReader
*/
-SpCaptureReader *
-sp_visualizer_list_get_reader (SpVisualizerList *self)
+SysprofCaptureReader *
+sysprof_visualizer_list_get_reader (SysprofVisualizerList *self)
{
- SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
+ SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
- g_return_val_if_fail (SP_IS_VISUALIZER_LIST (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_LIST (self), NULL);
return priv->reader;
}
static gboolean
-discover_new_rows_frame_cb (const SpCaptureFrame *frame,
+discover_new_rows_frame_cb (const SysprofCaptureFrame *frame,
gpointer user_data)
{
Discovery *state = user_data;
@@ -218,21 +218,21 @@ discover_new_rows_frame_cb (const SpCaptureFrame *frame,
* and widget views to be displayed.
*/
- if (frame->type == SP_CAPTURE_FRAME_MARK)
+ if (frame->type == SYSPROF_CAPTURE_FRAME_MARK)
{
- const SpCaptureMark *mark = (const SpCaptureMark *)frame;
+ const SysprofCaptureMark *mark = (const SysprofCaptureMark *)frame;
if (!g_hash_table_contains (state->mark_groups, mark->group))
g_hash_table_add (state->mark_groups, g_strdup (mark->group));
}
- if (frame->type == SP_CAPTURE_FRAME_CTRDEF)
+ if (frame->type == SYSPROF_CAPTURE_FRAME_CTRDEF)
{
- const SpCaptureFrameCounterDefine *def = (const SpCaptureFrameCounterDefine *)frame;
+ const SysprofCaptureFrameCounterDefine *def = (const SysprofCaptureFrameCounterDefine *)frame;
for (guint i = 0; i < def->n_counters; i++)
{
- const SpCaptureCounter *ctr = &def->counters[i];
+ const SysprofCaptureCounter *ctr = &def->counters[i];
if (!state->has_cpu &&
strstr (ctr->category, "CPU Percent") != NULL)
@@ -263,7 +263,7 @@ discover_new_rows_worker (GTask *task,
g_assert (state != NULL);
g_assert (state->cursor != NULL);
- sp_capture_cursor_foreach (state->cursor, discover_new_rows_frame_cb, state);
+ sysprof_capture_cursor_foreach (state->cursor, discover_new_rows_frame_cb, state);
g_task_return_boolean (task, TRUE);
}
@@ -272,11 +272,11 @@ handle_capture_results (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- SpVisualizerList *self = (SpVisualizerList *)object;
+ SysprofVisualizerList *self = (SysprofVisualizerList *)object;
Discovery *state;
const gchar *key;
- g_assert (SP_IS_VISUALIZER_LIST (self));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (self));
g_assert (G_IS_TASK (result));
g_assert (user_data == NULL);
@@ -292,7 +292,7 @@ handle_capture_results (GObject *object,
if (state->has_cpu)
{
- GtkWidget *row = g_object_new (SP_TYPE_CPU_VISUALIZER_ROW,
+ GtkWidget *row = g_object_new (SYSPROF_TYPE_CPU_VISUALIZER_ROW,
/* Translators: CPU is the processor. */
"title", _("CPU"),
"height-request", 50,
@@ -308,7 +308,7 @@ handle_capture_results (GObject *object,
{
guint counter_id = g_array_index (state->memory, guint, i);
GdkRGBA rgba;
- GtkWidget *row = g_object_new (SP_TYPE_LINE_VISUALIZER_ROW,
+ GtkWidget *row = g_object_new (SYSPROF_TYPE_LINE_VISUALIZER_ROW,
"title", _("Memory Used"),
"height-request", 35,
"selectable", FALSE,
@@ -316,16 +316,16 @@ handle_capture_results (GObject *object,
"y-lower", 0.0,
NULL);
gdk_rgba_parse (&rgba, "#204a87");
- sp_line_visualizer_row_add_counter (SP_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
+ sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
rgba.alpha = 0.3;
- sp_line_visualizer_row_set_fill (SP_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
+ sysprof_line_visualizer_row_set_fill (SYSPROF_LINE_VISUALIZER_ROW (row), counter_id, &rgba);
gtk_container_add (GTK_CONTAINER (self), row);
}
if (state->fps_counter)
{
GdkRGBA rgba;
- GtkWidget *row = g_object_new (SP_TYPE_LINE_VISUALIZER_ROW,
+ GtkWidget *row = g_object_new (SYSPROF_TYPE_LINE_VISUALIZER_ROW,
/* Translators: FPS is frames per second. */
"title", _("FPS"),
"height-request", 35,
@@ -335,9 +335,9 @@ handle_capture_results (GObject *object,
"y-upper", 150.0,
NULL);
gdk_rgba_parse (&rgba, "#204a87");
- sp_line_visualizer_row_add_counter (SP_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
+ sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
rgba.alpha = 0.3;
- sp_line_visualizer_row_set_fill (SP_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
+ sysprof_line_visualizer_row_set_fill (SYSPROF_LINE_VISUALIZER_ROW (row), state->fps_counter, &rgba);
gtk_container_add (GTK_CONTAINER (self), row);
}
@@ -349,7 +349,7 @@ handle_capture_results (GObject *object,
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
{
- GtkWidget *row = g_object_new (SP_TYPE_MARK_VISUALIZER_ROW,
+ GtkWidget *row = g_object_new (SYSPROF_TYPE_MARK_VISUALIZER_ROW,
"group", key,
"title", key,
"height-request", 50,
@@ -362,16 +362,16 @@ handle_capture_results (GObject *object,
}
static void
-discover_new_rows (SpVisualizerList *self,
- SpCaptureReader *reader)
+discover_new_rows (SysprofVisualizerList *self,
+ SysprofCaptureReader *reader)
{
- static const SpCaptureFrameType types[] = { SP_CAPTURE_FRAME_CTRDEF, SP_CAPTURE_FRAME_MARK };
- g_autoptr(SpCaptureCursor) cursor = NULL;
+ static const SysprofCaptureFrameType types[] = { SYSPROF_CAPTURE_FRAME_CTRDEF, SYSPROF_CAPTURE_FRAME_MARK
};
+ g_autoptr(SysprofCaptureCursor) cursor = NULL;
g_autoptr(GTask) task = NULL;
- SpCaptureCondition *condition;
+ SysprofCaptureCondition *condition;
Discovery *state;
- g_assert (SP_IS_VISUALIZER_LIST (self));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (self));
g_assert (reader != NULL);
/*
@@ -381,9 +381,9 @@ discover_new_rows (SpVisualizerList *self,
* denote capabilities at the beginning of the capture stream.
*/
- cursor = sp_capture_cursor_new (reader);
- condition = sp_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types);
- sp_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
+ cursor = sysprof_capture_cursor_new (reader);
+ condition = sysprof_capture_condition_new_where_type_in (G_N_ELEMENTS (types), types);
+ sysprof_capture_cursor_add_condition (cursor, g_steal_pointer (&condition));
state = g_slice_new0 (Discovery);
state->mark_groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -396,25 +396,25 @@ discover_new_rows (SpVisualizerList *self,
}
void
-sp_visualizer_list_set_reader (SpVisualizerList *self,
- SpCaptureReader *reader)
+sysprof_visualizer_list_set_reader (SysprofVisualizerList *self,
+ SysprofCaptureReader *reader)
{
- SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
+ SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
- g_return_if_fail (SP_IS_VISUALIZER_LIST (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_LIST (self));
if (reader != priv->reader)
{
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
{
- priv->reader = sp_capture_reader_ref (reader);
+ priv->reader = sysprof_capture_reader_ref (reader);
discover_new_rows (self, reader);
}
gtk_container_foreach (GTK_CONTAINER (self),
- (GtkCallback)sp_visualizer_row_set_reader,
+ (GtkCallback)sysprof_visualizer_row_set_reader,
reader);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_READER]);
@@ -422,34 +422,34 @@ sp_visualizer_list_set_reader (SpVisualizerList *self,
}
void
-sp_visualizer_list_set_zoom_manager (SpVisualizerList *self,
- SpZoomManager *zoom_manager)
+sysprof_visualizer_list_set_zoom_manager (SysprofVisualizerList *self,
+ SysprofZoomManager *zoom_manager)
{
- SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
+ SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
- g_return_if_fail (SP_IS_VISUALIZER_LIST (self));
- g_return_if_fail (SP_IS_ZOOM_MANAGER (zoom_manager));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_LIST (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
if (g_set_object (&priv->zoom_manager, zoom_manager))
{
gtk_container_foreach (GTK_CONTAINER (self),
- (GtkCallback)sp_visualizer_row_set_zoom_manager,
+ (GtkCallback)sysprof_visualizer_row_set_zoom_manager,
zoom_manager);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ZOOM_MANAGER]);
}
}
/**
- * sp_visualizer_list_get_zoom_manager:
+ * sysprof_visualizer_list_get_zoom_manager:
*
- * Returns: (nullable) (transfer): A #SpZoomManager or %NULL.
+ * Returns: (nullable) (transfer): A #SysprofZoomManager or %NULL.
*/
-SpZoomManager *
-sp_visualizer_list_get_zoom_manager (SpVisualizerList *self)
+SysprofZoomManager *
+sysprof_visualizer_list_get_zoom_manager (SysprofVisualizerList *self)
{
- SpVisualizerListPrivate *priv = sp_visualizer_list_get_instance_private (self);
+ SysprofVisualizerListPrivate *priv = sysprof_visualizer_list_get_instance_private (self);
- g_return_val_if_fail (SP_IS_VISUALIZER_LIST (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_LIST (self), NULL);
return priv->zoom_manager;
}
diff --git a/src/libsysprof-ui/sp-visualizer-list.h b/src/libsysprof-ui/sysprof-visualizer-list.h
similarity index 53%
rename from src/libsysprof-ui/sp-visualizer-list.h
rename to src/libsysprof-ui/sysprof-visualizer-list.h
index 5235b87..b942283 100644
--- a/src/libsysprof-ui/sp-visualizer-list.h
+++ b/src/libsysprof-ui/sysprof-visualizer-list.h
@@ -1,4 +1,4 @@
-/* sp-visualizer-list.h
+/* sysprof-visualizer-list.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,16 +22,16 @@
#include <gtk/gtk.h>
-#include "sp-capture-reader.h"
-#include "sp-zoom-manager.h"
+#include "sysprof-capture-reader.h"
+#include "sysprof-zoom-manager.h"
G_BEGIN_DECLS
-#define SP_TYPE_VISUALIZER_LIST (sp_visualizer_list_get_type())
+#define SYSPROF_TYPE_VISUALIZER_LIST (sysprof_visualizer_list_get_type())
-G_DECLARE_DERIVABLE_TYPE (SpVisualizerList, sp_visualizer_list, SP, VISUALIZER_LIST, GtkListBox)
+G_DECLARE_DERIVABLE_TYPE (SysprofVisualizerList, sysprof_visualizer_list, SYSPROF, VISUALIZER_LIST,
GtkListBox)
-struct _SpVisualizerListClass
+struct _SysprofVisualizerListClass
{
GtkListBoxClass parent_class;
@@ -45,12 +45,12 @@ struct _SpVisualizerListClass
gpointer _reserved8;
};
-GtkWidget *sp_visualizer_list_new (void);
-void sp_visualizer_list_set_reader (SpVisualizerList *self,
- SpCaptureReader *reader);
-SpCaptureReader *sp_visualizer_list_get_reader (SpVisualizerList *self);
-SpZoomManager *sp_visualizer_list_get_zoom_manager (SpVisualizerList *self);
-void sp_visualizer_list_set_zoom_manager (SpVisualizerList *self,
- SpZoomManager *zoom_manager);
+GtkWidget *sysprof_visualizer_list_new (void);
+void sysprof_visualizer_list_set_reader (SysprofVisualizerList *self,
+ SysprofCaptureReader *reader);
+SysprofCaptureReader *sysprof_visualizer_list_get_reader (SysprofVisualizerList *self);
+SysprofZoomManager *sysprof_visualizer_list_get_zoom_manager (SysprofVisualizerList *self);
+void sysprof_visualizer_list_set_zoom_manager (SysprofVisualizerList *self,
+ SysprofZoomManager *zoom_manager);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-visualizer-row-private.h
b/src/libsysprof-ui/sysprof-visualizer-row-private.h
similarity index 84%
rename from src/libsysprof-ui/sp-visualizer-row-private.h
rename to src/libsysprof-ui/sysprof-visualizer-row-private.h
index 761dc71..a364056 100644
--- a/src/libsysprof-ui/sp-visualizer-row-private.h
+++ b/src/libsysprof-ui/sysprof-visualizer-row-private.h
@@ -1,4 +1,4 @@
-/* sp-visualizer-row-private.h
+/* sysprof-visualizer-row-private.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,10 +20,10 @@
#pragma once
-#include "sp-visualizer-row.h"
+#include "sysprof-visualizer-row.h"
G_BEGIN_DECLS
-gint _sp_visualizer_row_get_graph_width (SpVisualizerRow *self);
+gint _sysprof_visualizer_row_get_graph_width (SysprofVisualizerRow *self);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-visualizer-row.c b/src/libsysprof-ui/sysprof-visualizer-row.c
similarity index 54%
rename from src/libsysprof-ui/sp-visualizer-row.c
rename to src/libsysprof-ui/sysprof-visualizer-row.c
index bc5c6f7..dffe2b5 100644
--- a/src/libsysprof-ui/sp-visualizer-row.c
+++ b/src/libsysprof-ui/sysprof-visualizer-row.c
@@ -1,4 +1,4 @@
-/* sp-visualizer-row.c
+/* sysprof-visualizer-row.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -18,21 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-visualizer-row"
+#define G_LOG_DOMAIN "sysprof-visualizer-row"
#include "config.h"
-#include "sp-visualizer-row.h"
-#include "sp-visualizer-row-private.h"
+#include "sysprof-visualizer-row.h"
+#include "sysprof-visualizer-row-private.h"
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
#define DEFAULT_PIXELS_PER_SECOND 20
typedef struct
{
- SpCaptureReader *reader;
- SpZoomManager *zoom_manager;
-} SpVisualizerRowPrivate;
+ SysprofCaptureReader *reader;
+ SysprofZoomManager *zoom_manager;
+} SysprofVisualizerRowPrivate;
enum {
PROP_0,
@@ -42,26 +42,26 @@ enum {
static GParamSpec *properties [N_PROPS];
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SpVisualizerRow, sp_visualizer_row, GTK_TYPE_LIST_BOX_ROW)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SysprofVisualizerRow, sysprof_visualizer_row, GTK_TYPE_LIST_BOX_ROW)
gint
-_sp_visualizer_row_get_graph_width (SpVisualizerRow *self)
+_sysprof_visualizer_row_get_graph_width (SysprofVisualizerRow *self)
{
- SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
+ SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
gdouble zoom_level = 1.0;
gint64 begin_time;
gint64 end_time;
- g_assert (SP_IS_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
if (priv->reader == NULL)
return 0;
if (priv->zoom_manager != NULL)
- zoom_level = sp_zoom_manager_get_zoom (priv->zoom_manager);
+ zoom_level = sysprof_zoom_manager_get_zoom (priv->zoom_manager);
- begin_time = sp_capture_reader_get_start_time (priv->reader);
- end_time = sp_capture_reader_get_end_time (priv->reader);
+ begin_time = sysprof_capture_reader_get_start_time (priv->reader);
+ end_time = sysprof_capture_reader_get_end_time (priv->reader);
return (end_time - begin_time)
/ (gdouble)NSEC_PER_SEC
@@ -70,36 +70,36 @@ _sp_visualizer_row_get_graph_width (SpVisualizerRow *self)
}
static void
-sp_visualizer_row_get_preferred_width (GtkWidget *widget,
+sysprof_visualizer_row_get_preferred_width (GtkWidget *widget,
gint *min_width,
gint *nat_width)
{
- SpVisualizerRow *self = (SpVisualizerRow *)widget;
+ SysprofVisualizerRow *self = (SysprofVisualizerRow *)widget;
gint graph_width;
gint real_min_width = 0;
gint real_nat_width = 0;
- g_assert (SP_IS_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
- GTK_WIDGET_CLASS (sp_visualizer_row_parent_class)->get_preferred_width (widget, &real_min_width,
&real_nat_width);
+ GTK_WIDGET_CLASS (sysprof_visualizer_row_parent_class)->get_preferred_width (widget, &real_min_width,
&real_nat_width);
- graph_width = _sp_visualizer_row_get_graph_width (self);
+ graph_width = _sysprof_visualizer_row_get_graph_width (self);
*min_width = *nat_width = real_min_width + graph_width;
}
static void
-sp_visualizer_row_get_property (GObject *object,
+sysprof_visualizer_row_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpVisualizerRow *self = SP_VISUALIZER_ROW (object);
+ SysprofVisualizerRow *self = SYSPROF_VISUALIZER_ROW (object);
switch (prop_id)
{
case PROP_ZOOM_MANAGER:
- g_value_set_object (value, sp_visualizer_row_get_zoom_manager (self));
+ g_value_set_object (value, sysprof_visualizer_row_get_zoom_manager (self));
break;
default:
@@ -108,17 +108,17 @@ sp_visualizer_row_get_property (GObject *object,
}
static void
-sp_visualizer_row_set_property (GObject *object,
+sysprof_visualizer_row_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpVisualizerRow *self = SP_VISUALIZER_ROW (object);
+ SysprofVisualizerRow *self = SYSPROF_VISUALIZER_ROW (object);
switch (prop_id)
{
case PROP_ZOOM_MANAGER:
- sp_visualizer_row_set_zoom_manager (self, g_value_get_object (value));
+ sysprof_visualizer_row_set_zoom_manager (self, g_value_get_object (value));
break;
default:
@@ -127,87 +127,87 @@ sp_visualizer_row_set_property (GObject *object,
}
static void
-sp_visualizer_row_finalize (GObject *object)
+sysprof_visualizer_row_finalize (GObject *object)
{
- SpVisualizerRow *self = (SpVisualizerRow *)object;
- SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
+ SysprofVisualizerRow *self = (SysprofVisualizerRow *)object;
+ SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
g_clear_object (&priv->zoom_manager);
- G_OBJECT_CLASS (sp_visualizer_row_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_visualizer_row_parent_class)->finalize (object);
}
static void
-sp_visualizer_row_class_init (SpVisualizerRowClass *klass)
+sysprof_visualizer_row_class_init (SysprofVisualizerRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = sp_visualizer_row_finalize;
- object_class->get_property = sp_visualizer_row_get_property;
- object_class->set_property = sp_visualizer_row_set_property;
+ object_class->finalize = sysprof_visualizer_row_finalize;
+ object_class->get_property = sysprof_visualizer_row_get_property;
+ object_class->set_property = sysprof_visualizer_row_set_property;
- widget_class->get_preferred_width = sp_visualizer_row_get_preferred_width;
+ widget_class->get_preferred_width = sysprof_visualizer_row_get_preferred_width;
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager",
"Zoom Manager",
"Zoom Manager",
- SP_TYPE_ZOOM_MANAGER,
+ SYSPROF_TYPE_ZOOM_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
-sp_visualizer_row_init (SpVisualizerRow *self)
+sysprof_visualizer_row_init (SysprofVisualizerRow *self)
{
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (self), FALSE);
gtk_list_box_row_set_selectable (GTK_LIST_BOX_ROW (self), FALSE);
}
static void
-sp_visualizer_row_zoom_manager_notify_zoom (SpVisualizerRow *self,
+sysprof_visualizer_row_zoom_manager_notify_zoom (SysprofVisualizerRow *self,
GParamSpec *pspec,
- SpZoomManager *zoom_manager)
+ SysprofZoomManager *zoom_manager)
{
- g_assert (SP_IS_VISUALIZER_ROW (self));
- g_assert (SP_IS_ZOOM_MANAGER (zoom_manager));
+ g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
gtk_widget_queue_resize (GTK_WIDGET (self));
}
/**
- * sp_visualizer_row_get_zoom_manager:
+ * sysprof_visualizer_row_get_zoom_manager:
*
- * Returns: (transfer none) (nullable): A #SpZoomManager or %NULL.
+ * Returns: (transfer none) (nullable): A #SysprofZoomManager or %NULL.
*/
-SpZoomManager *
-sp_visualizer_row_get_zoom_manager (SpVisualizerRow *self)
+SysprofZoomManager *
+sysprof_visualizer_row_get_zoom_manager (SysprofVisualizerRow *self)
{
- SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
+ SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
- g_return_val_if_fail (SP_IS_VISUALIZER_ROW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_ROW (self), NULL);
return priv->zoom_manager;
}
void
-sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
- SpZoomManager *zoom_manager)
+sysprof_visualizer_row_set_zoom_manager (SysprofVisualizerRow *self,
+ SysprofZoomManager *zoom_manager)
{
- SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
+ SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
- g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
- g_return_if_fail (!zoom_manager || SP_IS_ZOOM_MANAGER (zoom_manager));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_ROW (self));
+ g_return_if_fail (!zoom_manager || SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
if (priv->zoom_manager != zoom_manager)
{
if (priv->zoom_manager != NULL)
{
g_signal_handlers_disconnect_by_func (priv->zoom_manager,
- G_CALLBACK (sp_visualizer_row_zoom_manager_notify_zoom),
+ G_CALLBACK (sysprof_visualizer_row_zoom_manager_notify_zoom),
self);
g_clear_object (&priv->zoom_manager);
}
@@ -217,7 +217,7 @@ sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
priv->zoom_manager = g_object_ref (zoom_manager);
g_signal_connect_object (priv->zoom_manager,
"notify::zoom",
- G_CALLBACK (sp_visualizer_row_zoom_manager_notify_zoom),
+ G_CALLBACK (sysprof_visualizer_row_zoom_manager_notify_zoom),
self,
G_CONNECT_SWAPPED);
}
@@ -228,22 +228,22 @@ sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
}
void
-sp_visualizer_row_set_reader (SpVisualizerRow *self,
- SpCaptureReader *reader)
+sysprof_visualizer_row_set_reader (SysprofVisualizerRow *self,
+ SysprofCaptureReader *reader)
{
- SpVisualizerRowPrivate *priv = sp_visualizer_row_get_instance_private (self);
+ SysprofVisualizerRowPrivate *priv = sysprof_visualizer_row_get_instance_private (self);
- g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_ROW (self));
if (priv->reader != reader)
{
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
- priv->reader = sp_capture_reader_ref (reader);
+ priv->reader = sysprof_capture_reader_ref (reader);
- if (SP_VISUALIZER_ROW_GET_CLASS (self)->set_reader)
- SP_VISUALIZER_ROW_GET_CLASS (self)->set_reader (self, reader);
+ if (SYSPROF_VISUALIZER_ROW_GET_CLASS (self)->set_reader)
+ SYSPROF_VISUALIZER_ROW_GET_CLASS (self)->set_reader (self, reader);
gtk_widget_queue_resize (GTK_WIDGET (self));
}
@@ -264,14 +264,14 @@ subtract_border (GtkAllocation *alloc,
}
static void
-adjust_alloc_for_borders (SpVisualizerRow *self,
+adjust_alloc_for_borders (SysprofVisualizerRow *self,
GtkAllocation *alloc)
{
GtkStyleContext *style_context;
GtkBorder border;
GtkStateFlags state;
- g_assert (SP_IS_VISUALIZER_ROW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_ROW (self));
g_assert (alloc != NULL);
state = gtk_widget_get_state_flags (GTK_WIDGET (self));
@@ -282,16 +282,16 @@ adjust_alloc_for_borders (SpVisualizerRow *self,
}
void
-sp_visualizer_row_translate_points (SpVisualizerRow *self,
- const SpVisualizerRowRelativePoint *in_points,
+sysprof_visualizer_row_translate_points (SysprofVisualizerRow *self,
+ const SysprofVisualizerRowRelativePoint *in_points,
guint n_in_points,
- SpVisualizerRowAbsolutePoint *out_points,
+ SysprofVisualizerRowAbsolutePoint *out_points,
guint n_out_points)
{
GtkAllocation alloc;
gint graph_width;
- g_return_if_fail (SP_IS_VISUALIZER_ROW (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_ROW (self));
g_return_if_fail (in_points != NULL);
g_return_if_fail (out_points != NULL);
g_return_if_fail (n_in_points == n_out_points);
@@ -299,7 +299,7 @@ sp_visualizer_row_translate_points (SpVisualizerRow *self,
gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
adjust_alloc_for_borders (self, &alloc);
- graph_width = _sp_visualizer_row_get_graph_width (self);
+ graph_width = _sysprof_visualizer_row_get_graph_width (self);
for (guint i = 0; i < n_in_points; i++)
{
diff --git a/src/libsysprof-ui/sp-visualizer-row.h b/src/libsysprof-ui/sysprof-visualizer-row.h
similarity index 50%
rename from src/libsysprof-ui/sp-visualizer-row.h
rename to src/libsysprof-ui/sysprof-visualizer-row.h
index 50fb5f8..9cb85a7 100644
--- a/src/libsysprof-ui/sp-visualizer-row.h
+++ b/src/libsysprof-ui/sysprof-visualizer-row.h
@@ -1,4 +1,4 @@
-/* sp-visualizer-row.h
+/* sysprof-visualizer-row.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,54 +22,54 @@
#include <gtk/gtk.h>
-#include "sp-capture-reader.h"
-#include "sp-zoom-manager.h"
+#include "sysprof-capture-reader.h"
+#include "sysprof-zoom-manager.h"
G_BEGIN_DECLS
-#define SP_TYPE_VISUALIZER_ROW (sp_visualizer_row_get_type())
+#define SYSPROF_TYPE_VISUALIZER_ROW (sysprof_visualizer_row_get_type())
-G_DECLARE_DERIVABLE_TYPE (SpVisualizerRow, sp_visualizer_row, SP, VISUALIZER_ROW, GtkListBoxRow)
+G_DECLARE_DERIVABLE_TYPE (SysprofVisualizerRow, sysprof_visualizer_row, SYSPROF, VISUALIZER_ROW,
GtkListBoxRow)
typedef struct
{
gdouble x;
gdouble y;
-} SpVisualizerRowRelativePoint;
+} SysprofVisualizerRowRelativePoint;
typedef struct
{
gint x;
gint y;
-} SpVisualizerRowAbsolutePoint;
+} SysprofVisualizerRowAbsolutePoint;
-struct _SpVisualizerRowClass
+struct _SysprofVisualizerRowClass
{
GtkListBoxRowClass parent_class;
/**
- * SpVisualizerRow::set_reader:
+ * SysprofVisualizerRow::set_reader:
*
* Sets the reader that the row should use to extract counters.
* This reader is private to the row and should be freed when
- * no longer in use with sp_capture_reader_unref().
+ * no longer in use with sysprof_capture_reader_unref().
*/
- void (*set_reader) (SpVisualizerRow *self,
- SpCaptureReader *reader);
+ void (*set_reader) (SysprofVisualizerRow *self,
+ SysprofCaptureReader *reader);
/*< private >*/
gpointer _reserved[16];
};
-void sp_visualizer_row_set_reader (SpVisualizerRow *self,
- SpCaptureReader *reader);
-SpZoomManager *sp_visualizer_row_get_zoom_manager (SpVisualizerRow *self);
-void sp_visualizer_row_set_zoom_manager (SpVisualizerRow *self,
- SpZoomManager *zoom_manager);
-void sp_visualizer_row_translate_points (SpVisualizerRow *self,
- const SpVisualizerRowRelativePoint *in_points,
+void sysprof_visualizer_row_set_reader (SysprofVisualizerRow *self,
+ SysprofCaptureReader *reader);
+SysprofZoomManager *sysprof_visualizer_row_get_zoom_manager (SysprofVisualizerRow *self);
+void sysprof_visualizer_row_set_zoom_manager (SysprofVisualizerRow *self,
+ SysprofZoomManager *zoom_manager);
+void sysprof_visualizer_row_translate_points (SysprofVisualizerRow *self,
+ const SysprofVisualizerRowRelativePoint *in_points,
guint n_in_points,
- SpVisualizerRowAbsolutePoint *out_points,
+ SysprofVisualizerRowAbsolutePoint *out_points,
guint n_out_points);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-visualizer-ticks.c b/src/libsysprof-ui/sysprof-visualizer-ticks.c
similarity index 85%
rename from src/libsysprof-ui/sp-visualizer-ticks.c
rename to src/libsysprof-ui/sysprof-visualizer-ticks.c
index d57dfb3..4cbf291 100644
--- a/src/libsysprof-ui/sp-visualizer-ticks.c
+++ b/src/libsysprof-ui/sysprof-visualizer-ticks.c
@@ -1,4 +1,4 @@
-/* sp-visualizer-ticks.c
+/* sysprof-visualizer-ticks.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,7 +22,7 @@
#include <glib/gi18n.h>
-#include "sp-visualizer-ticks.h"
+#include "sysprof-visualizer-ticks.h"
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
#define NSEC_PER_HOUR (NSEC_PER_SEC * 60 * 60)
@@ -31,7 +31,7 @@
#define MIN_TICK_DISTANCE 20
#define LABEL_HEIGHT_PX 8
-struct _SpVisualizerTicks
+struct _SysprofVisualizerTicks
{
GtkDrawingArea parent_instance;
@@ -69,7 +69,7 @@ struct {
{ 1, 3, NSEC_PER_SEC / 1000 },
};
-G_DEFINE_TYPE (SpVisualizerTicks, sp_visualizer_ticks, GTK_TYPE_DRAWING_AREA)
+G_DEFINE_TYPE (SysprofVisualizerTicks, sysprof_visualizer_ticks, GTK_TYPE_DRAWING_AREA)
static void
update_label_text (PangoLayout *layout,
@@ -126,7 +126,7 @@ update_label_text (PangoLayout *layout,
}
static inline gdouble
-get_x_for_time (SpVisualizerTicks *self,
+get_x_for_time (SysprofVisualizerTicks *self,
const GtkAllocation *alloc,
gint64 t)
{
@@ -137,7 +137,7 @@ get_x_for_time (SpVisualizerTicks *self,
#if 0
static inline gint64
-get_time_at_x (SpVisualizerTicks *self,
+get_time_at_x (SysprofVisualizerTicks *self,
const GtkAllocation *alloc,
gdouble x)
{
@@ -148,7 +148,7 @@ get_time_at_x (SpVisualizerTicks *self,
#endif
static gboolean
-draw_ticks (SpVisualizerTicks *self,
+draw_ticks (SysprofVisualizerTicks *self,
cairo_t *cr,
GtkAllocation *area,
gint ticks,
@@ -159,7 +159,7 @@ draw_ticks (SpVisualizerTicks *self,
gint64 x_offset;
gint count = 0;
- g_assert (SP_IS_VISUALIZER_TICKS (self));
+ g_assert (SYSPROF_IS_VISUALIZER_TICKS (self));
g_assert (cr != NULL);
g_assert (area != NULL);
g_assert (ticks >= 0);
@@ -234,17 +234,17 @@ draw_ticks (SpVisualizerTicks *self,
}
static gboolean
-sp_visualizer_ticks_draw (GtkWidget *widget,
+sysprof_visualizer_ticks_draw (GtkWidget *widget,
cairo_t *cr)
{
- SpVisualizerTicks *self = SP_VISUALIZER_TICKS (widget);
+ SysprofVisualizerTicks *self = SYSPROF_VISUALIZER_TICKS (widget);
GtkStyleContext *style;
GtkAllocation alloc;
GtkStateFlags state;
gint64 timespan;
GdkRGBA color;
- g_assert (SP_IS_VISUALIZER_TICKS (self));
+ g_assert (SYSPROF_IS_VISUALIZER_TICKS (self));
g_assert (cr != NULL);
if (0 == (timespan = self->end_time - self->begin_time))
@@ -289,28 +289,28 @@ sp_visualizer_ticks_draw (GtkWidget *widget,
}
static void
-sp_visualizer_ticks_get_preferred_height (GtkWidget *widget,
+sysprof_visualizer_ticks_get_preferred_height (GtkWidget *widget,
gint *min_height,
gint *nat_height)
{
- g_assert (SP_IS_VISUALIZER_TICKS (widget));
+ g_assert (SYSPROF_IS_VISUALIZER_TICKS (widget));
*min_height = *nat_height = tick_sizing[0].height + LABEL_HEIGHT_PX;
}
static void
-sp_visualizer_ticks_class_init (SpVisualizerTicksClass *klass)
+sysprof_visualizer_ticks_class_init (SysprofVisualizerTicksClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->draw = sp_visualizer_ticks_draw;
- widget_class->get_preferred_height = sp_visualizer_ticks_get_preferred_height;
+ widget_class->draw = sysprof_visualizer_ticks_draw;
+ widget_class->get_preferred_height = sysprof_visualizer_ticks_get_preferred_height;
gtk_widget_class_set_css_name (widget_class, "ticks");
}
static void
-sp_visualizer_ticks_init (SpVisualizerTicks *self)
+sysprof_visualizer_ticks_init (SysprofVisualizerTicks *self)
{
self->end_time = G_GINT64_CONSTANT (1000000000) * 60;
@@ -318,17 +318,17 @@ sp_visualizer_ticks_init (SpVisualizerTicks *self)
}
GtkWidget *
-sp_visualizer_ticks_new (void)
+sysprof_visualizer_ticks_new (void)
{
- return g_object_new (SP_TYPE_VISUALIZER_TICKS, NULL);
+ return g_object_new (SYSPROF_TYPE_VISUALIZER_TICKS, NULL);
}
void
-sp_visualizer_ticks_get_time_range (SpVisualizerTicks *self,
+sysprof_visualizer_ticks_get_time_range (SysprofVisualizerTicks *self,
gint64 *begin_time,
gint64 *end_time)
{
- g_return_if_fail (SP_IS_VISUALIZER_TICKS (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self));
g_return_if_fail (begin_time != NULL || end_time != NULL);
if (begin_time != NULL)
@@ -339,11 +339,11 @@ sp_visualizer_ticks_get_time_range (SpVisualizerTicks *self,
}
void
-sp_visualizer_ticks_set_time_range (SpVisualizerTicks *self,
+sysprof_visualizer_ticks_set_time_range (SysprofVisualizerTicks *self,
gint64 begin_time,
gint64 end_time)
{
- g_return_if_fail (SP_IS_VISUALIZER_TICKS (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self));
if (begin_time > end_time)
{
@@ -359,9 +359,9 @@ sp_visualizer_ticks_set_time_range (SpVisualizerTicks *self,
}
gint64
-sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self)
+sysprof_visualizer_ticks_get_epoch (SysprofVisualizerTicks *self)
{
- g_return_val_if_fail (SP_IS_VISUALIZER_TICKS (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self), 0);
return self->epoch;
}
@@ -370,7 +370,7 @@ sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self)
* Sets the epoch for the visualizer ticks.
*
* The epoch is the "real" starting time of the capture, where as the
- * sp_visualizer_ticks_set_time_range() function sets the visible range
+ * sysprof_visualizer_ticks_set_time_range() function sets the visible range
* of the capture.
*
* This is used to calculate the offset of the beginning of the capture
@@ -379,10 +379,10 @@ sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self)
* This function should only need to be called when the reader is changed.
*/
void
-sp_visualizer_ticks_set_epoch (SpVisualizerTicks *self,
+sysprof_visualizer_ticks_set_epoch (SysprofVisualizerTicks *self,
gint64 epoch)
{
- g_return_if_fail (SP_IS_VISUALIZER_TICKS (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_TICKS (self));
if (self->epoch != epoch)
{
diff --git a/src/libsysprof-ui/sp-visualizer-ticks.h b/src/libsysprof-ui/sysprof-visualizer-ticks.h
similarity index 66%
rename from src/libsysprof-ui/sp-visualizer-ticks.h
rename to src/libsysprof-ui/sysprof-visualizer-ticks.h
index 6fc530e..067881b 100644
--- a/src/libsysprof-ui/sp-visualizer-ticks.h
+++ b/src/libsysprof-ui/sysprof-visualizer-ticks.h
@@ -1,4 +1,4 @@
-/* sp-visualizer-ticks.h
+/* sysprof-visualizer-ticks.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -24,18 +24,18 @@
G_BEGIN_DECLS
-#define SP_TYPE_VISUALIZER_TICKS (sp_visualizer_ticks_get_type())
+#define SYSPROF_TYPE_VISUALIZER_TICKS (sysprof_visualizer_ticks_get_type())
-G_DECLARE_FINAL_TYPE (SpVisualizerTicks, sp_visualizer_ticks, SP, VISUALIZER_TICKS, GtkDrawingArea)
+G_DECLARE_FINAL_TYPE (SysprofVisualizerTicks, sysprof_visualizer_ticks, SYSPROF, VISUALIZER_TICKS,
GtkDrawingArea)
-GtkWidget *sp_visualizer_ticks_new (void);
-void sp_visualizer_ticks_set_epoch (SpVisualizerTicks *self,
+GtkWidget *sysprof_visualizer_ticks_new (void);
+void sysprof_visualizer_ticks_set_epoch (SysprofVisualizerTicks *self,
gint64 epoch);
-gint64 sp_visualizer_ticks_get_epoch (SpVisualizerTicks *self);
-void sp_visualizer_ticks_get_time_range (SpVisualizerTicks *self,
+gint64 sysprof_visualizer_ticks_get_epoch (SysprofVisualizerTicks *self);
+void sysprof_visualizer_ticks_get_time_range (SysprofVisualizerTicks *self,
gint64 *begin_time,
gint64 *end_time);
-void sp_visualizer_ticks_set_time_range (SpVisualizerTicks *self,
+void sysprof_visualizer_ticks_set_time_range (SysprofVisualizerTicks *self,
gint64 begin_time,
gint64 end_time);
diff --git a/src/libsysprof-ui/sp-visualizer-view.c b/src/libsysprof-ui/sysprof-visualizer-view.c
similarity index 51%
rename from src/libsysprof-ui/sp-visualizer-view.c
rename to src/libsysprof-ui/sysprof-visualizer-view.c
index 0a4d4ed..8d8dee1 100644
--- a/src/libsysprof-ui/sp-visualizer-view.c
+++ b/src/libsysprof-ui/sysprof-visualizer-view.c
@@ -1,4 +1,4 @@
-/* sp-visualizer-view.c
+/* sysprof-visualizer-view.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,42 +18,42 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-visualizer-view"
+#define G_LOG_DOMAIN "sysprof-visualizer-view"
#include "config.h"
#include <glib/gi18n.h>
-#include "sp-theme-manager.h"
-#include "sp-visualizer-list.h"
-#include "sp-visualizer-row.h"
-#include "sp-visualizer-row-private.h"
-#include "sp-selection.h"
-#include "sp-visualizer-ticks.h"
-#include "sp-visualizer-view.h"
+#include "sysprof-theme-manager.h"
+#include "sysprof-visualizer-list.h"
+#include "sysprof-visualizer-row.h"
+#include "sysprof-visualizer-row-private.h"
+#include "sysprof-selection.h"
+#include "sysprof-visualizer-ticks.h"
+#include "sysprof-visualizer-view.h"
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
#define DEFAULT_PIXELS_PER_SECOND 20
typedef struct
{
- SpCaptureReader *reader;
- SpZoomManager *zoom_manager;
- SpSelection *selection;
+ SysprofCaptureReader *reader;
+ SysprofZoomManager *zoom_manager;
+ SysprofSelection *selection;
- SpVisualizerList *list;
+ SysprofVisualizerList *list;
GtkScrolledWindow *scroller;
- SpVisualizerTicks *ticks;
+ SysprofVisualizerTicks *ticks;
gint64 drag_begin_at;
gint64 drag_selection_at;
guint button_pressed : 1;
-} SpVisualizerViewPrivate;
+} SysprofVisualizerViewPrivate;
typedef struct
{
- SpVisualizerView *self;
+ SysprofVisualizerView *self;
GtkStyleContext *style_context;
cairo_t *cr;
GtkAllocation alloc;
@@ -74,8 +74,8 @@ enum {
static void buildable_iface_init (GtkBuildableIface *iface);
-G_DEFINE_TYPE_EXTENDED (SpVisualizerView, sp_visualizer_view, GTK_TYPE_BIN, 0,
- G_ADD_PRIVATE (SpVisualizerView)
+G_DEFINE_TYPE_EXTENDED (SysprofVisualizerView, sysprof_visualizer_view, GTK_TYPE_BIN, 0,
+ G_ADD_PRIVATE (SysprofVisualizerView)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
static GParamSpec *properties [N_PROPS];
@@ -88,23 +88,23 @@ find_row1 (GtkWidget *widget,
{
GtkWidget **row1 = data;
- if (*row1 == NULL && SP_IS_VISUALIZER_ROW (widget))
+ if (*row1 == NULL && SYSPROF_IS_VISUALIZER_ROW (widget))
*row1 = widget;
}
static gint64
-get_time_from_coordinates (SpVisualizerView *self,
+get_time_from_coordinates (SysprofVisualizerView *self,
gint x,
gint y)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
- SpVisualizerRow *row1 = NULL;
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
+ SysprofVisualizerRow *row1 = NULL;
GtkAllocation alloc;
gint64 begin_time;
gint64 end_time;
gint graph_width;
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
if (priv->reader == NULL)
return 0;
@@ -119,23 +119,23 @@ get_time_from_coordinates (SpVisualizerView *self,
* (ignoring spacing caused by the widget being wider than the data points.
*/
gtk_container_foreach (GTK_CONTAINER (priv->list), find_row1, &row1);
- if (!SP_IS_VISUALIZER_ROW (row1))
+ if (!SYSPROF_IS_VISUALIZER_ROW (row1))
return 0;
- begin_time = sp_capture_reader_get_start_time (priv->reader);
- end_time = sp_capture_reader_get_end_time (priv->reader);
- graph_width = _sp_visualizer_row_get_graph_width (row1);
+ begin_time = sysprof_capture_reader_get_start_time (priv->reader);
+ end_time = sysprof_capture_reader_get_end_time (priv->reader);
+ graph_width = _sysprof_visualizer_row_get_graph_width (row1);
return begin_time + ((end_time - begin_time) * (x / (gdouble)graph_width));
}
static gint
-get_x_for_time_at (SpVisualizerView *self,
+get_x_for_time_at (SysprofVisualizerView *self,
const GtkAllocation *alloc,
gint64 time_at)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
- SpVisualizerRow *row1 = NULL;
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
+ SysprofVisualizerRow *row1 = NULL;
GtkAdjustment *hadjustment;
gdouble nsec_per_pixel;
gdouble value;
@@ -143,7 +143,7 @@ get_x_for_time_at (SpVisualizerView *self,
gint64 end_time;
gint graph_width;
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (alloc != NULL);
/*
@@ -151,16 +151,16 @@ get_x_for_time_at (SpVisualizerView *self,
* (ignoring spacing caused by the widget being wider than the data points.
*/
gtk_container_foreach (GTK_CONTAINER (priv->list), find_row1, &row1);
- if (!SP_IS_VISUALIZER_ROW (row1))
+ if (!SYSPROF_IS_VISUALIZER_ROW (row1))
return 0;
hadjustment = gtk_scrolled_window_get_hadjustment (priv->scroller);
value = gtk_adjustment_get_value (hadjustment);
- begin_time = sp_capture_reader_get_start_time (priv->reader);
- end_time = sp_capture_reader_get_end_time (priv->reader);
+ begin_time = sysprof_capture_reader_get_start_time (priv->reader);
+ end_time = sysprof_capture_reader_get_end_time (priv->reader);
- graph_width = _sp_visualizer_row_get_graph_width (row1);
+ graph_width = _sysprof_visualizer_row_get_graph_width (row1);
nsec_per_pixel = (end_time - begin_time) / (gdouble)graph_width;
begin_time += value * nsec_per_pixel;
@@ -168,42 +168,42 @@ get_x_for_time_at (SpVisualizerView *self,
}
static void
-sp_visualizer_view_row_added (SpVisualizerView *self,
+sysprof_visualizer_view_row_added (SysprofVisualizerView *self,
GtkWidget *widget,
- SpVisualizerList *list)
+ SysprofVisualizerList *list)
{
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_WIDGET (widget));
- g_assert (SP_IS_VISUALIZER_LIST (list));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
- if (SP_IS_VISUALIZER_ROW (widget))
+ if (SYSPROF_IS_VISUALIZER_ROW (widget))
g_signal_emit (self, signals [VISUALIZER_ADDED], 0, widget);
}
static void
-sp_visualizer_view_row_removed (SpVisualizerView *self,
+sysprof_visualizer_view_row_removed (SysprofVisualizerView *self,
GtkWidget *widget,
- SpVisualizerList *list)
+ SysprofVisualizerList *list)
{
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_WIDGET (widget));
- g_assert (SP_IS_VISUALIZER_LIST (list));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
- if (SP_IS_VISUALIZER_ROW (widget))
+ if (SYSPROF_IS_VISUALIZER_ROW (widget))
g_signal_emit (self, signals [VISUALIZER_REMOVED], 0, widget);
}
static void
-sp_visualizer_view_update_ticks (SpVisualizerView *self)
+sysprof_visualizer_view_update_ticks (SysprofVisualizerView *self)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
GtkAdjustment *hadjustment;
GtkAllocation alloc;
gdouble value;
gint64 begin_time;
gint64 end_time;
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
hadjustment = gtk_scrolled_window_get_hadjustment (priv->scroller);
value = gtk_adjustment_get_value (hadjustment);
@@ -213,35 +213,35 @@ sp_visualizer_view_update_ticks (SpVisualizerView *self)
begin_time = get_time_from_coordinates (self, alloc.x + value, alloc.y);
end_time = get_time_from_coordinates (self, alloc.x + value + alloc.width, alloc.y);
- sp_visualizer_ticks_set_time_range (priv->ticks, begin_time, end_time);
+ sysprof_visualizer_ticks_set_time_range (priv->ticks, begin_time, end_time);
}
static void
-sp_visualizer_view_hadjustment_value_changed (SpVisualizerView *self,
+sysprof_visualizer_view_hadjustment_value_changed (SysprofVisualizerView *self,
GtkAdjustment *adjustment)
{
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_ADJUSTMENT (adjustment));
- sp_visualizer_view_update_ticks (self);
+ sysprof_visualizer_view_update_ticks (self);
}
static void
-sp_visualizer_view_size_allocate (GtkWidget *widget,
+sysprof_visualizer_view_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- SpVisualizerView *self = (SpVisualizerView *)widget;
+ SysprofVisualizerView *self = (SysprofVisualizerView *)widget;
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (allocation != NULL);
- GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (sysprof_visualizer_view_parent_class)->size_allocate (widget, allocation);
- sp_visualizer_view_update_ticks (self);
+ sysprof_visualizer_view_update_ticks (self);
}
static void
-draw_selection_cb (SpSelection *selection,
+draw_selection_cb (SysprofSelection *selection,
gint64 range_begin,
gint64 range_end,
gpointer user_data)
@@ -249,10 +249,10 @@ draw_selection_cb (SpSelection *selection,
SelectionDraw *draw = user_data;
GdkRectangle area;
- g_assert (SP_IS_SELECTION (selection));
+ g_assert (SYSPROF_IS_SELECTION (selection));
g_assert (draw != NULL);
g_assert (draw->cr != NULL);
- g_assert (SP_IS_VISUALIZER_VIEW (draw->self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (draw->self));
area.x = get_x_for_time_at (draw->self, &draw->alloc, range_begin);
area.width = get_x_for_time_at (draw->self, &draw->alloc, range_end) - area.x;
@@ -269,11 +269,11 @@ draw_selection_cb (SpSelection *selection,
}
static gboolean
-sp_visualizer_view_draw (GtkWidget *widget,
+sysprof_visualizer_view_draw (GtkWidget *widget,
cairo_t *cr)
{
- SpVisualizerView *self = (SpVisualizerView *)widget;
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerView *self = (SysprofVisualizerView *)widget;
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
SelectionDraw draw = { 0 };
gboolean ret;
@@ -286,12 +286,12 @@ sp_visualizer_view_draw (GtkWidget *widget,
gtk_widget_get_allocation (widget, &draw.alloc);
- ret = GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->draw (widget, cr);
+ ret = GTK_WIDGET_CLASS (sysprof_visualizer_view_parent_class)->draw (widget, cr);
- if (sp_selection_get_has_selection (priv->selection) || priv->button_pressed)
+ if (sysprof_selection_get_has_selection (priv->selection) || priv->button_pressed)
{
gtk_style_context_add_class (draw.style_context, "selection");
- sp_selection_foreach (priv->selection, draw_selection_cb, &draw);
+ sysprof_selection_foreach (priv->selection, draw_selection_cb, &draw);
if (priv->button_pressed)
draw_selection_cb (priv->selection, priv->drag_begin_at, priv->drag_selection_at, &draw);
gtk_style_context_remove_class (draw.style_context, "selection");
@@ -301,31 +301,31 @@ sp_visualizer_view_draw (GtkWidget *widget,
}
static gboolean
-sp_visualizer_view_list_button_press_event (SpVisualizerView *self,
+sysprof_visualizer_view_list_button_press_event (SysprofVisualizerView *self,
GdkEventButton *ev,
- SpVisualizerList *list)
+ SysprofVisualizerList *list)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (ev != NULL);
- g_assert (SP_IS_VISUALIZER_LIST (list));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (priv->reader == NULL)
return GDK_EVENT_PROPAGATE;
if (ev->button != GDK_BUTTON_PRIMARY)
{
- if (sp_selection_get_has_selection (priv->selection))
+ if (sysprof_selection_get_has_selection (priv->selection))
{
- sp_selection_unselect_all (priv->selection);
+ sysprof_selection_unselect_all (priv->selection);
return GDK_EVENT_STOP;
}
return GDK_EVENT_PROPAGATE;
}
if ((ev->state & GDK_SHIFT_MASK) == 0)
- sp_selection_unselect_all (priv->selection);
+ sysprof_selection_unselect_all (priv->selection);
priv->button_pressed = TRUE;
@@ -338,15 +338,15 @@ sp_visualizer_view_list_button_press_event (SpVisualizerView *self,
}
static gboolean
-sp_visualizer_view_list_button_release_event (SpVisualizerView *self,
+sysprof_visualizer_view_list_button_release_event (SysprofVisualizerView *self,
GdkEventButton *ev,
- SpVisualizerList *list)
+ SysprofVisualizerList *list)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (ev != NULL);
- g_assert (SP_IS_VISUALIZER_LIST (list));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (!priv->button_pressed || ev->button != GDK_BUTTON_PRIMARY)
return GDK_EVENT_PROPAGATE;
@@ -355,7 +355,7 @@ sp_visualizer_view_list_button_release_event (SpVisualizerView *self,
if (priv->drag_begin_at != priv->drag_selection_at)
{
- sp_selection_select_range (priv->selection,
+ sysprof_selection_select_range (priv->selection,
priv->drag_begin_at,
priv->drag_selection_at);
priv->drag_begin_at = -1;
@@ -368,15 +368,15 @@ sp_visualizer_view_list_button_release_event (SpVisualizerView *self,
}
static gboolean
-sp_visualizer_view_list_motion_notify_event (SpVisualizerView *self,
+sysprof_visualizer_view_list_motion_notify_event (SysprofVisualizerView *self,
GdkEventMotion *ev,
- SpVisualizerList *list)
+ SysprofVisualizerList *list)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (ev != NULL);
- g_assert (SP_IS_VISUALIZER_LIST (list));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
if (!priv->button_pressed)
return GDK_EVENT_PROPAGATE;
@@ -389,15 +389,15 @@ sp_visualizer_view_list_motion_notify_event (SpVisualizerView *self,
}
static void
-sp_visualizer_view_list_realize_after (SpVisualizerView *self,
- SpVisualizerList *list)
+sysprof_visualizer_view_list_realize_after (SysprofVisualizerView *self,
+ SysprofVisualizerList *list)
{
GdkDisplay *display;
GdkWindow *window;
GdkCursor *cursor;
- g_assert (SP_IS_VISUALIZER_VIEW (self));
- g_assert (SP_IS_VISUALIZER_LIST (list));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_LIST (list));
window = gtk_widget_get_window (GTK_WIDGET (list));
display = gdk_window_get_display (window);
@@ -407,44 +407,44 @@ sp_visualizer_view_list_realize_after (SpVisualizerView *self,
}
static void
-sp_visualizer_view_selection_changed (SpVisualizerView *self,
- SpSelection *selection)
+sysprof_visualizer_view_selection_changed (SysprofVisualizerView *self,
+ SysprofSelection *selection)
{
- g_assert (SP_IS_VISUALIZER_VIEW (self));
- g_assert (SP_IS_SELECTION (selection));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_SELECTION (selection));
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
-sp_visualizer_view_finalize (GObject *object)
+sysprof_visualizer_view_finalize (GObject *object)
{
- SpVisualizerView *self = (SpVisualizerView *)object;
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerView *self = (SysprofVisualizerView *)object;
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
g_clear_object (&priv->zoom_manager);
g_clear_object (&priv->selection);
- G_OBJECT_CLASS (sp_visualizer_view_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_visualizer_view_parent_class)->finalize (object);
}
static void
-sp_visualizer_view_get_property (GObject *object,
+sysprof_visualizer_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpVisualizerView *self = SP_VISUALIZER_VIEW (object);
+ SysprofVisualizerView *self = SYSPROF_VISUALIZER_VIEW (object);
switch (prop_id)
{
case PROP_READER:
- g_value_set_boxed (value, sp_visualizer_view_get_reader (self));
+ g_value_set_boxed (value, sysprof_visualizer_view_get_reader (self));
break;
case PROP_ZOOM_MANAGER:
- g_value_set_object (value, sp_visualizer_view_get_zoom_manager (self));
+ g_value_set_object (value, sysprof_visualizer_view_get_zoom_manager (self));
break;
default:
@@ -453,21 +453,21 @@ sp_visualizer_view_get_property (GObject *object,
}
static void
-sp_visualizer_view_set_property (GObject *object,
+sysprof_visualizer_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpVisualizerView *self = SP_VISUALIZER_VIEW (object);
+ SysprofVisualizerView *self = SYSPROF_VISUALIZER_VIEW (object);
switch (prop_id)
{
case PROP_READER:
- sp_visualizer_view_set_reader (self, g_value_get_boxed (value));
+ sysprof_visualizer_view_set_reader (self, g_value_get_boxed (value));
break;
case PROP_ZOOM_MANAGER:
- sp_visualizer_view_set_zoom_manager (self, g_value_get_object (value));
+ sysprof_visualizer_view_set_zoom_manager (self, g_value_get_object (value));
break;
default:
@@ -476,31 +476,31 @@ sp_visualizer_view_set_property (GObject *object,
}
static void
-sp_visualizer_view_class_init (SpVisualizerViewClass *klass)
+sysprof_visualizer_view_class_init (SysprofVisualizerViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- SpThemeManager *theme_manager = sp_theme_manager_get_default ();
+ SysprofThemeManager *theme_manager = sysprof_theme_manager_get_default ();
- object_class->finalize = sp_visualizer_view_finalize;
- object_class->get_property = sp_visualizer_view_get_property;
- object_class->set_property = sp_visualizer_view_set_property;
+ object_class->finalize = sysprof_visualizer_view_finalize;
+ object_class->get_property = sysprof_visualizer_view_get_property;
+ object_class->set_property = sysprof_visualizer_view_set_property;
- widget_class->draw = sp_visualizer_view_draw;
- widget_class->size_allocate = sp_visualizer_view_size_allocate;
+ widget_class->draw = sysprof_visualizer_view_draw;
+ widget_class->size_allocate = sysprof_visualizer_view_size_allocate;
properties [PROP_READER] =
g_param_spec_boxed ("reader",
"Reader",
"The reader for the visualizers",
- SP_TYPE_CAPTURE_READER,
+ SYSPROF_TYPE_CAPTURE_READER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_ZOOM_MANAGER] =
g_param_spec_object ("zoom-manager",
"Zoom Manager",
"The zoom manager for the view",
- SP_TYPE_ZOOM_MANAGER,
+ SYSPROF_TYPE_ZOOM_MANAGER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
@@ -509,37 +509,37 @@ sp_visualizer_view_class_init (SpVisualizerViewClass *klass)
g_signal_new ("visualizer-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (SpVisualizerViewClass, visualizer_added),
+ G_STRUCT_OFFSET (SysprofVisualizerViewClass, visualizer_added),
NULL, NULL, NULL,
- G_TYPE_NONE, 1, SP_TYPE_VISUALIZER_ROW);
+ G_TYPE_NONE, 1, SYSPROF_TYPE_VISUALIZER_ROW);
signals [VISUALIZER_REMOVED] =
g_signal_new ("visualizer-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (SpVisualizerViewClass, visualizer_removed),
+ G_STRUCT_OFFSET (SysprofVisualizerViewClass, visualizer_removed),
NULL, NULL, NULL,
- G_TYPE_NONE, 1, SP_TYPE_VISUALIZER_ROW);
+ G_TYPE_NONE, 1, SYSPROF_TYPE_VISUALIZER_ROW);
- gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sp-visualizer-view.ui");
- gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, list);
- gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, scroller);
- gtk_widget_class_bind_template_child_private (widget_class, SpVisualizerView, ticks);
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sysprof-visualizer-view.ui");
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofVisualizerView, list);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofVisualizerView, scroller);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofVisualizerView, ticks);
gtk_widget_class_set_css_name (widget_class, "visualizers");
- sp_theme_manager_register_resource (theme_manager, NULL, NULL,
"/org/gnome/sysprof/css/SpVisualizerView-shared.css");
- sp_theme_manager_register_resource (theme_manager, "Adwaita", NULL,
"/org/gnome/sysprof/css/SpVisualizerView-Adwaita.css");
- sp_theme_manager_register_resource (theme_manager, "Adwaita", "dark",
"/org/gnome/sysprof/css/SpVisualizerView-Adwaita-dark.css");
+ sysprof_theme_manager_register_resource (theme_manager, NULL, NULL,
"/org/gnome/sysprof/css/SysprofVisualizerView-shared.css");
+ sysprof_theme_manager_register_resource (theme_manager, "Adwaita", NULL,
"/org/gnome/sysprof/css/SysprofVisualizerView-Adwaita.css");
+ sysprof_theme_manager_register_resource (theme_manager, "Adwaita", "dark",
"/org/gnome/sysprof/css/SysprofVisualizerView-Adwaita-dark.css");
- g_type_ensure (SP_TYPE_VISUALIZER_LIST);
- g_type_ensure (SP_TYPE_VISUALIZER_TICKS);
+ g_type_ensure (SYSPROF_TYPE_VISUALIZER_LIST);
+ g_type_ensure (SYSPROF_TYPE_VISUALIZER_TICKS);
}
static void
-sp_visualizer_view_init (SpVisualizerView *self)
+sysprof_visualizer_view_init (SysprofVisualizerView *self)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
GtkAdjustment *hadjustment;
priv->drag_begin_at = -1;
@@ -547,47 +547,47 @@ sp_visualizer_view_init (SpVisualizerView *self)
gtk_widget_init_template (GTK_WIDGET (self));
- priv->selection = g_object_new (SP_TYPE_SELECTION, NULL);
+ priv->selection = g_object_new (SYSPROF_TYPE_SELECTION, NULL);
g_signal_connect_object (priv->selection,
"changed",
- G_CALLBACK (sp_visualizer_view_selection_changed),
+ G_CALLBACK (sysprof_visualizer_view_selection_changed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"button-press-event",
- G_CALLBACK (sp_visualizer_view_list_button_press_event),
+ G_CALLBACK (sysprof_visualizer_view_list_button_press_event),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"button-release-event",
- G_CALLBACK (sp_visualizer_view_list_button_release_event),
+ G_CALLBACK (sysprof_visualizer_view_list_button_release_event),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"motion-notify-event",
- G_CALLBACK (sp_visualizer_view_list_motion_notify_event),
+ G_CALLBACK (sysprof_visualizer_view_list_motion_notify_event),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"realize",
- G_CALLBACK (sp_visualizer_view_list_realize_after),
+ G_CALLBACK (sysprof_visualizer_view_list_realize_after),
self,
G_CONNECT_SWAPPED | G_CONNECT_AFTER);
g_signal_connect_object (priv->list,
"add",
- G_CALLBACK (sp_visualizer_view_row_added),
+ G_CALLBACK (sysprof_visualizer_view_row_added),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->list,
"remove",
- G_CALLBACK (sp_visualizer_view_row_removed),
+ G_CALLBACK (sysprof_visualizer_view_row_removed),
self,
G_CONNECT_SWAPPED);
@@ -595,69 +595,69 @@ sp_visualizer_view_init (SpVisualizerView *self)
g_signal_connect_object (hadjustment,
"value-changed",
- G_CALLBACK (sp_visualizer_view_hadjustment_value_changed),
+ G_CALLBACK (sysprof_visualizer_view_hadjustment_value_changed),
self,
G_CONNECT_SWAPPED);
}
/**
- * sp_visualizer_view_get_reader:
+ * sysprof_visualizer_view_get_reader:
*
- * Returns: (transfer none): An #SpCaptureReader
+ * Returns: (transfer none): An #SysprofCaptureReader
*/
-SpCaptureReader *
-sp_visualizer_view_get_reader (SpVisualizerView *self)
+SysprofCaptureReader *
+sysprof_visualizer_view_get_reader (SysprofVisualizerView *self)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_return_val_if_fail (SP_IS_VISUALIZER_VIEW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self), NULL);
return priv->reader;
}
void
-sp_visualizer_view_set_reader (SpVisualizerView *self,
- SpCaptureReader *reader)
+sysprof_visualizer_view_set_reader (SysprofVisualizerView *self,
+ SysprofCaptureReader *reader)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_return_if_fail (SP_IS_VISUALIZER_VIEW (self));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self));
if (priv->reader != reader)
{
- g_clear_pointer (&priv->reader, sp_capture_reader_unref);
+ g_clear_pointer (&priv->reader, sysprof_capture_reader_unref);
if (reader != NULL)
{
gint64 begin_time;
- priv->reader = sp_capture_reader_ref (reader);
+ priv->reader = sysprof_capture_reader_ref (reader);
- begin_time = sp_capture_reader_get_start_time (priv->reader);
+ begin_time = sysprof_capture_reader_get_start_time (priv->reader);
- sp_visualizer_ticks_set_epoch (priv->ticks, begin_time);
- sp_visualizer_ticks_set_time_range (priv->ticks, begin_time, begin_time);
+ sysprof_visualizer_ticks_set_epoch (priv->ticks, begin_time);
+ sysprof_visualizer_ticks_set_time_range (priv->ticks, begin_time, begin_time);
- sp_selection_unselect_all (priv->selection);
+ sysprof_selection_unselect_all (priv->selection);
}
- sp_visualizer_list_set_reader (priv->list, reader);
- sp_visualizer_view_update_ticks (self);
+ sysprof_visualizer_list_set_reader (priv->list, reader);
+ sysprof_visualizer_view_update_ticks (self);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_READER]);
}
}
static void
-sp_visualizer_view_add_child (GtkBuildable *buildable,
+sysprof_visualizer_view_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *type)
{
- SpVisualizerView *self = (SpVisualizerView *)buildable;
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerView *self = (SysprofVisualizerView *)buildable;
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_assert (SP_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
g_assert (GTK_IS_BUILDER (builder));
g_assert (G_IS_OBJECT (child));
@@ -674,50 +674,50 @@ static void
buildable_iface_init (GtkBuildableIface *iface)
{
parent_buildable = g_type_interface_peek_parent (iface);
- iface->add_child = sp_visualizer_view_add_child;
+ iface->add_child = sysprof_visualizer_view_add_child;
}
static void
-sp_visualizer_view_zoom_manager_notify_zoom (SpVisualizerView *self,
+sysprof_visualizer_view_zoom_manager_notify_zoom (SysprofVisualizerView *self,
GParamSpec *pspec,
- SpZoomManager *zoom_manager)
+ SysprofZoomManager *zoom_manager)
{
- g_assert (SP_IS_VISUALIZER_VIEW (self));
- g_assert (SP_IS_ZOOM_MANAGER (zoom_manager));
+ g_assert (SYSPROF_IS_VISUALIZER_VIEW (self));
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
- sp_visualizer_view_update_ticks (self);
+ sysprof_visualizer_view_update_ticks (self);
}
/**
- * sp_visualizer_view_get_zoom_manager:
+ * sysprof_visualizer_view_get_zoom_manager:
*
- * Returns: (transfer none) (nullable): An #SpZoomManager or %NULL
+ * Returns: (transfer none) (nullable): An #SysprofZoomManager or %NULL
*/
-SpZoomManager *
-sp_visualizer_view_get_zoom_manager (SpVisualizerView *self)
+SysprofZoomManager *
+sysprof_visualizer_view_get_zoom_manager (SysprofVisualizerView *self)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_return_val_if_fail (SP_IS_VISUALIZER_VIEW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self), NULL);
return priv->zoom_manager;
}
void
-sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
- SpZoomManager *zoom_manager)
+sysprof_visualizer_view_set_zoom_manager (SysprofVisualizerView *self,
+ SysprofZoomManager *zoom_manager)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_return_if_fail (SP_IS_VISUALIZER_VIEW (self));
- g_return_if_fail (!zoom_manager || SP_IS_ZOOM_MANAGER (zoom_manager));
+ g_return_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self));
+ g_return_if_fail (!zoom_manager || SYSPROF_IS_ZOOM_MANAGER (zoom_manager));
if (priv->zoom_manager != zoom_manager)
{
if (priv->zoom_manager != NULL)
{
g_signal_handlers_disconnect_by_func (priv->zoom_manager,
- G_CALLBACK (sp_visualizer_view_zoom_manager_notify_zoom),
+ G_CALLBACK
(sysprof_visualizer_view_zoom_manager_notify_zoom),
self);
g_clear_object (&priv->zoom_manager);
}
@@ -727,12 +727,12 @@ sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
priv->zoom_manager = g_object_ref (zoom_manager);
g_signal_connect_object (priv->zoom_manager,
"notify::zoom",
- G_CALLBACK (sp_visualizer_view_zoom_manager_notify_zoom),
+ G_CALLBACK (sysprof_visualizer_view_zoom_manager_notify_zoom),
self,
G_CONNECT_SWAPPED);
}
- sp_visualizer_list_set_zoom_manager (priv->list, zoom_manager);
+ sysprof_visualizer_list_set_zoom_manager (priv->list, zoom_manager);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ZOOM_MANAGER]);
@@ -740,19 +740,19 @@ sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
}
/**
- * sp_visualizer_view_get_selection:
+ * sysprof_visualizer_view_get_selection:
*
- * Gets the #SpSelection instance for the visualizer view.
+ * Gets the #SysprofSelection instance for the visualizer view.
* This can be used to alter the selection or selections of the visualizers.
*
- * Returns: (transfer none): An #SpSelection.
+ * Returns: (transfer none): An #SysprofSelection.
*/
-SpSelection *
-sp_visualizer_view_get_selection (SpVisualizerView *self)
+SysprofSelection *
+sysprof_visualizer_view_get_selection (SysprofVisualizerView *self)
{
- SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
+ SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
- g_return_val_if_fail (SP_IS_VISUALIZER_VIEW (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self), NULL);
return priv->selection;
}
diff --git a/src/libsysprof-ui/sp-visualizer-view.h b/src/libsysprof-ui/sysprof-visualizer-view.h
similarity index 53%
rename from src/libsysprof-ui/sp-visualizer-view.h
rename to src/libsysprof-ui/sysprof-visualizer-view.h
index 615c50a..be29b4d 100644
--- a/src/libsysprof-ui/sp-visualizer-view.h
+++ b/src/libsysprof-ui/sysprof-visualizer-view.h
@@ -1,4 +1,4 @@
-/* sp-visualizer-view.h
+/* sysprof-visualizer-view.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -23,26 +23,26 @@
#include <gtk/gtk.h>
#include <sysprof.h>
-#include "sp-visualizer-row.h"
-#include "sp-selection.h"
-#include "sp-zoom-manager.h"
+#include "sysprof-visualizer-row.h"
+#include "sysprof-selection.h"
+#include "sysprof-zoom-manager.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_VISUALIZER_VIEW (sp_visualizer_view_get_type())
+#define SYSPROF_TYPE_VISUALIZER_VIEW (sysprof_visualizer_view_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpVisualizerView, sp_visualizer_view, SP, VISUALIZER_VIEW, GtkBin)
+G_DECLARE_DERIVABLE_TYPE (SysprofVisualizerView, sysprof_visualizer_view, SYSPROF, VISUALIZER_VIEW, GtkBin)
-struct _SpVisualizerViewClass
+struct _SysprofVisualizerViewClass
{
GtkBinClass parent_class;
- void (*visualizer_added) (SpVisualizerView *self,
- SpVisualizerRow *visualizer);
- void (*visualizer_removed) (SpVisualizerView *self,
- SpVisualizerRow *visualizer);
+ void (*visualizer_added) (SysprofVisualizerView *self,
+ SysprofVisualizerRow *visualizer);
+ void (*visualizer_removed) (SysprofVisualizerView *self,
+ SysprofVisualizerRow *visualizer);
gpointer _reserved1;
gpointer _reserved2;
@@ -63,18 +63,18 @@ struct _SpVisualizerViewClass
};
SYSPROF_AVAILABLE_IN_ALL
-GtkWidget *sp_visualizer_view_new (void);
+GtkWidget *sysprof_visualizer_view_new (void);
SYSPROF_AVAILABLE_IN_ALL
-SpCaptureReader *sp_visualizer_view_get_reader (SpVisualizerView *self);
+SysprofCaptureReader *sysprof_visualizer_view_get_reader (SysprofVisualizerView *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_visualizer_view_set_reader (SpVisualizerView *self,
- SpCaptureReader *reader);
+void sysprof_visualizer_view_set_reader (SysprofVisualizerView *self,
+ SysprofCaptureReader *reader);
SYSPROF_AVAILABLE_IN_ALL
-SpZoomManager *sp_visualizer_view_get_zoom_manager (SpVisualizerView *self);
+SysprofZoomManager *sysprof_visualizer_view_get_zoom_manager (SysprofVisualizerView *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_visualizer_view_set_zoom_manager (SpVisualizerView *self,
- SpZoomManager *zoom_manager);
+void sysprof_visualizer_view_set_zoom_manager (SysprofVisualizerView *self,
+ SysprofZoomManager *zoom_manager);
SYSPROF_AVAILABLE_IN_ALL
-SpSelection *sp_visualizer_view_get_selection (SpVisualizerView *self);
+SysprofSelection *sysprof_visualizer_view_get_selection (SysprofVisualizerView *self);
G_END_DECLS
diff --git a/src/libsysprof-ui/sp-zoom-manager.c b/src/libsysprof-ui/sysprof-zoom-manager.c
similarity index 65%
rename from src/libsysprof-ui/sp-zoom-manager.c
rename to src/libsysprof-ui/sysprof-zoom-manager.c
index b648e89..1f445e4 100644
--- a/src/libsysprof-ui/sp-zoom-manager.c
+++ b/src/libsysprof-ui/sysprof-zoom-manager.c
@@ -1,4 +1,4 @@
-/* sp-zoom-manager.c
+/* sysprof-zoom-manager.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,16 +18,16 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-zoom-manager"
+#define G_LOG_DOMAIN "sysprof-zoom-manager"
#include "config.h"
#include <glib/gi18n.h>
#include <gio/gio.h>
-#include "sp-zoom-manager.h"
+#include "sysprof-zoom-manager.h"
-struct _SpZoomManager
+struct _SysprofZoomManager
{
GObject parent_instance;
@@ -50,7 +50,7 @@ enum {
static void action_group_iface_init (GActionGroupInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpZoomManager, sp_zoom_manager, G_TYPE_OBJECT, 0,
+G_DEFINE_TYPE_EXTENDED (SysprofZoomManager, sysprof_zoom_manager, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, action_group_iface_init))
static GParamSpec *properties [N_PROPS];
@@ -77,63 +77,63 @@ static gdouble zoom_levels[] = {
};
static void
-sp_zoom_manager_zoom_in_action (GSimpleAction *action,
+sysprof_zoom_manager_zoom_in_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- SpZoomManager *self = user_data;
- g_assert (SP_IS_ZOOM_MANAGER (self));
- sp_zoom_manager_zoom_in (self);
+ SysprofZoomManager *self = user_data;
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
+ sysprof_zoom_manager_zoom_in (self);
}
static void
-sp_zoom_manager_zoom_out_action (GSimpleAction *action,
+sysprof_zoom_manager_zoom_out_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- SpZoomManager *self = user_data;
- g_assert (SP_IS_ZOOM_MANAGER (self));
- sp_zoom_manager_zoom_out (self);
+ SysprofZoomManager *self = user_data;
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
+ sysprof_zoom_manager_zoom_out (self);
}
static void
-sp_zoom_manager_zoom_one_action (GSimpleAction *action,
+sysprof_zoom_manager_zoom_one_action (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- SpZoomManager *self = user_data;
- g_assert (SP_IS_ZOOM_MANAGER (self));
- sp_zoom_manager_reset (self);
+ SysprofZoomManager *self = user_data;
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
+ sysprof_zoom_manager_reset (self);
}
static void
-sp_zoom_manager_get_property (GObject *object,
+sysprof_zoom_manager_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpZoomManager *self = SP_ZOOM_MANAGER (object);
+ SysprofZoomManager *self = SYSPROF_ZOOM_MANAGER (object);
switch (prop_id)
{
case PROP_MIN_ZOOM:
- g_value_set_double (value, sp_zoom_manager_get_min_zoom (self));
+ g_value_set_double (value, sysprof_zoom_manager_get_min_zoom (self));
break;
case PROP_MAX_ZOOM:
- g_value_set_double (value, sp_zoom_manager_get_max_zoom (self));
+ g_value_set_double (value, sysprof_zoom_manager_get_max_zoom (self));
break;
case PROP_ZOOM:
- g_value_set_double (value, sp_zoom_manager_get_zoom (self));
+ g_value_set_double (value, sysprof_zoom_manager_get_zoom (self));
break;
case PROP_CAN_ZOOM_IN:
- g_value_set_boolean (value, sp_zoom_manager_get_can_zoom_in (self));
+ g_value_set_boolean (value, sysprof_zoom_manager_get_can_zoom_in (self));
break;
case PROP_CAN_ZOOM_OUT:
- g_value_set_boolean (value, sp_zoom_manager_get_can_zoom_out (self));
+ g_value_set_boolean (value, sysprof_zoom_manager_get_can_zoom_out (self));
break;
default:
@@ -142,25 +142,25 @@ sp_zoom_manager_get_property (GObject *object,
}
static void
-sp_zoom_manager_set_property (GObject *object,
+sysprof_zoom_manager_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpZoomManager *self = SP_ZOOM_MANAGER (object);
+ SysprofZoomManager *self = SYSPROF_ZOOM_MANAGER (object);
switch (prop_id)
{
case PROP_MIN_ZOOM:
- sp_zoom_manager_set_min_zoom (self, g_value_get_double (value));
+ sysprof_zoom_manager_set_min_zoom (self, g_value_get_double (value));
break;
case PROP_MAX_ZOOM:
- sp_zoom_manager_set_max_zoom (self, g_value_get_double (value));
+ sysprof_zoom_manager_set_max_zoom (self, g_value_get_double (value));
break;
case PROP_ZOOM:
- sp_zoom_manager_set_zoom (self, g_value_get_double (value));
+ sysprof_zoom_manager_set_zoom (self, g_value_get_double (value));
break;
default:
@@ -169,12 +169,12 @@ sp_zoom_manager_set_property (GObject *object,
}
static void
-sp_zoom_manager_class_init (SpZoomManagerClass *klass)
+sysprof_zoom_manager_class_init (SysprofZoomManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = sp_zoom_manager_get_property;
- object_class->set_property = sp_zoom_manager_set_property;
+ object_class->get_property = sysprof_zoom_manager_get_property;
+ object_class->set_property = sysprof_zoom_manager_set_property;
properties [PROP_CAN_ZOOM_IN] =
g_param_spec_boolean ("can-zoom-in",
@@ -221,12 +221,12 @@ sp_zoom_manager_class_init (SpZoomManagerClass *klass)
}
static void
-sp_zoom_manager_init (SpZoomManager *self)
+sysprof_zoom_manager_init (SysprofZoomManager *self)
{
static const GActionEntry entries[] = {
- { "zoom-in", sp_zoom_manager_zoom_in_action },
- { "zoom-out", sp_zoom_manager_zoom_out_action },
- { "zoom-one", sp_zoom_manager_zoom_one_action },
+ { "zoom-in", sysprof_zoom_manager_zoom_in_action },
+ { "zoom-out", sysprof_zoom_manager_zoom_out_action },
+ { "zoom-one", sysprof_zoom_manager_zoom_one_action },
};
GAction *action;
@@ -247,49 +247,49 @@ sp_zoom_manager_init (SpZoomManager *self)
g_object_bind_property (self, "can-zoom-out", action, "enabled", G_BINDING_SYNC_CREATE);
}
-SpZoomManager *
-sp_zoom_manager_new (void)
+SysprofZoomManager *
+sysprof_zoom_manager_new (void)
{
- return g_object_new (SP_TYPE_ZOOM_MANAGER, NULL);
+ return g_object_new (SYSPROF_TYPE_ZOOM_MANAGER, NULL);
}
gboolean
-sp_zoom_manager_get_can_zoom_in (SpZoomManager *self)
+sysprof_zoom_manager_get_can_zoom_in (SysprofZoomManager *self)
{
- g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->max_zoom == 0.0 || self->zoom < self->max_zoom;
}
gboolean
-sp_zoom_manager_get_can_zoom_out (SpZoomManager *self)
+sysprof_zoom_manager_get_can_zoom_out (SysprofZoomManager *self)
{
- g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->min_zoom == 0.0 || self->zoom > self->min_zoom;
}
gboolean
-sp_zoom_manager_get_min_zoom (SpZoomManager *self)
+sysprof_zoom_manager_get_min_zoom (SysprofZoomManager *self)
{
- g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->min_zoom;
}
gboolean
-sp_zoom_manager_get_max_zoom (SpZoomManager *self)
+sysprof_zoom_manager_get_max_zoom (SysprofZoomManager *self)
{
- g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), FALSE);
return self->max_zoom;
}
void
-sp_zoom_manager_set_min_zoom (SpZoomManager *self,
+sysprof_zoom_manager_set_min_zoom (SysprofZoomManager *self,
gdouble min_zoom)
{
- g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
if (min_zoom != self->min_zoom)
{
@@ -300,10 +300,10 @@ sp_zoom_manager_set_min_zoom (SpZoomManager *self,
}
void
-sp_zoom_manager_set_max_zoom (SpZoomManager *self,
+sysprof_zoom_manager_set_max_zoom (SysprofZoomManager *self,
gdouble max_zoom)
{
- g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
if (max_zoom != self->max_zoom)
{
@@ -314,13 +314,13 @@ sp_zoom_manager_set_max_zoom (SpZoomManager *self,
}
void
-sp_zoom_manager_zoom_in (SpZoomManager *self)
+sysprof_zoom_manager_zoom_in (SysprofZoomManager *self)
{
gdouble zoom;
- g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
- if (!sp_zoom_manager_get_can_zoom_in (self))
+ if (!sysprof_zoom_manager_get_can_zoom_in (self))
return;
zoom = self->zoom;
@@ -337,17 +337,17 @@ sp_zoom_manager_zoom_in (SpZoomManager *self)
if (zoom == self->zoom)
zoom *= 2;
- sp_zoom_manager_set_zoom (self, zoom);
+ sysprof_zoom_manager_set_zoom (self, zoom);
}
void
-sp_zoom_manager_zoom_out (SpZoomManager *self)
+sysprof_zoom_manager_zoom_out (SysprofZoomManager *self)
{
gdouble zoom;
- g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
- if (!sp_zoom_manager_get_can_zoom_out (self))
+ if (!sysprof_zoom_manager_get_can_zoom_out (self))
return;
zoom = self->zoom;
@@ -364,33 +364,33 @@ sp_zoom_manager_zoom_out (SpZoomManager *self)
if (zoom == self->zoom)
zoom /= 2.0;
- sp_zoom_manager_set_zoom (self, zoom);
+ sysprof_zoom_manager_set_zoom (self, zoom);
}
void
-sp_zoom_manager_reset (SpZoomManager *self)
+sysprof_zoom_manager_reset (SysprofZoomManager *self)
{
- g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
- sp_zoom_manager_set_zoom (self, 1.0);
+ sysprof_zoom_manager_set_zoom (self, 1.0);
}
gdouble
-sp_zoom_manager_get_zoom (SpZoomManager *self)
+sysprof_zoom_manager_get_zoom (SysprofZoomManager *self)
{
- g_return_val_if_fail (SP_IS_ZOOM_MANAGER (self), 0.0);
+ g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), 0.0);
return self->zoom;
}
void
-sp_zoom_manager_set_zoom (SpZoomManager *self,
+sysprof_zoom_manager_set_zoom (SysprofZoomManager *self,
gdouble zoom)
{
gdouble min_zoom;
gdouble max_zoom;
- g_return_if_fail (SP_IS_ZOOM_MANAGER (self));
+ g_return_if_fail (SYSPROF_IS_ZOOM_MANAGER (self));
min_zoom = (self->min_zoom == 0.0) ? -G_MAXDOUBLE : self->min_zoom;
max_zoom = (self->max_zoom == 0.0) ? G_MAXDOUBLE : self->max_zoom;
@@ -410,17 +410,17 @@ sp_zoom_manager_set_zoom (SpZoomManager *self,
}
static gchar **
-sp_zoom_manager_list_actions (GActionGroup *action_group)
+sysprof_zoom_manager_list_actions (GActionGroup *action_group)
{
- SpZoomManager *self = (SpZoomManager *)action_group;
+ SysprofZoomManager *self = (SysprofZoomManager *)action_group;
- g_assert (SP_IS_ZOOM_MANAGER (self));
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
return g_action_group_list_actions (G_ACTION_GROUP (self->actions));
}
static gboolean
-sp_zoom_manager_query_action (GActionGroup *action_group,
+sysprof_zoom_manager_query_action (GActionGroup *action_group,
const gchar *action_name,
gboolean *enabled,
const GVariantType **parameter_type,
@@ -428,9 +428,9 @@ sp_zoom_manager_query_action (GActionGroup *action_group,
GVariant **state_hint,
GVariant **state)
{
- SpZoomManager *self = (SpZoomManager *)action_group;
+ SysprofZoomManager *self = (SysprofZoomManager *)action_group;
- g_assert (SP_IS_ZOOM_MANAGER (self));
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
g_assert (action_name != NULL);
return g_action_group_query_action (G_ACTION_GROUP (self->actions),
@@ -443,26 +443,26 @@ sp_zoom_manager_query_action (GActionGroup *action_group,
}
static void
-sp_zoom_manager_change_action_state (GActionGroup *action_group,
+sysprof_zoom_manager_change_action_state (GActionGroup *action_group,
const gchar *action_name,
GVariant *value)
{
- SpZoomManager *self = (SpZoomManager *)action_group;
+ SysprofZoomManager *self = (SysprofZoomManager *)action_group;
- g_assert (SP_IS_ZOOM_MANAGER (self));
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
g_assert (action_name != NULL);
g_action_group_change_action_state (G_ACTION_GROUP (self->actions), action_name, value);
}
static void
-sp_zoom_manager_activate_action (GActionGroup *action_group,
+sysprof_zoom_manager_activate_action (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter)
{
- SpZoomManager *self = (SpZoomManager *)action_group;
+ SysprofZoomManager *self = (SysprofZoomManager *)action_group;
- g_assert (SP_IS_ZOOM_MANAGER (self));
+ g_assert (SYSPROF_IS_ZOOM_MANAGER (self));
g_assert (action_name != NULL);
g_action_group_activate_action (G_ACTION_GROUP (self->actions), action_name, parameter);
@@ -471,8 +471,8 @@ sp_zoom_manager_activate_action (GActionGroup *action_group,
static void
action_group_iface_init (GActionGroupInterface *iface)
{
- iface->list_actions = sp_zoom_manager_list_actions;
- iface->query_action = sp_zoom_manager_query_action;
- iface->change_action_state = sp_zoom_manager_change_action_state;
- iface->activate_action = sp_zoom_manager_activate_action;
+ iface->list_actions = sysprof_zoom_manager_list_actions;
+ iface->query_action = sysprof_zoom_manager_query_action;
+ iface->change_action_state = sysprof_zoom_manager_change_action_state;
+ iface->activate_action = sysprof_zoom_manager_activate_action;
}
diff --git a/src/libsysprof-ui/sp-zoom-manager.h b/src/libsysprof-ui/sysprof-zoom-manager.h
similarity index 55%
rename from src/libsysprof-ui/sp-zoom-manager.h
rename to src/libsysprof-ui/sysprof-zoom-manager.h
index ca18798..f7932a0 100644
--- a/src/libsysprof-ui/sp-zoom-manager.h
+++ b/src/libsysprof-ui/sysprof-zoom-manager.h
@@ -1,4 +1,4 @@
-/* sp-zoom-manager.h
+/* sysprof-zoom-manager.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -26,37 +26,37 @@
G_BEGIN_DECLS
-#define SP_TYPE_ZOOM_MANAGER (sp_zoom_manager_get_type())
+#define SYSPROF_TYPE_ZOOM_MANAGER (sysprof_zoom_manager_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpZoomManager, sp_zoom_manager, SP, ZOOM_MANAGER, GObject)
+G_DECLARE_FINAL_TYPE (SysprofZoomManager, sysprof_zoom_manager, SYSPROF, ZOOM_MANAGER, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpZoomManager *sp_zoom_manager_new (void);
+SysprofZoomManager *sysprof_zoom_manager_new (void);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_zoom_manager_get_can_zoom_in (SpZoomManager *self);
+gboolean sysprof_zoom_manager_get_can_zoom_in (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_zoom_manager_get_can_zoom_out (SpZoomManager *self);
+gboolean sysprof_zoom_manager_get_can_zoom_out (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_zoom_manager_get_min_zoom (SpZoomManager *self);
+gboolean sysprof_zoom_manager_get_min_zoom (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_zoom_manager_get_max_zoom (SpZoomManager *self);
+gboolean sysprof_zoom_manager_get_max_zoom (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_zoom_manager_set_min_zoom (SpZoomManager *self,
+void sysprof_zoom_manager_set_min_zoom (SysprofZoomManager *self,
gdouble min_zoom);
SYSPROF_AVAILABLE_IN_ALL
-void sp_zoom_manager_set_max_zoom (SpZoomManager *self,
+void sysprof_zoom_manager_set_max_zoom (SysprofZoomManager *self,
gdouble max_zoom);
SYSPROF_AVAILABLE_IN_ALL
-void sp_zoom_manager_zoom_in (SpZoomManager *self);
+void sysprof_zoom_manager_zoom_in (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_zoom_manager_zoom_out (SpZoomManager *self);
+void sysprof_zoom_manager_zoom_out (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_zoom_manager_reset (SpZoomManager *self);
+void sysprof_zoom_manager_reset (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-gdouble sp_zoom_manager_get_zoom (SpZoomManager *self);
+gdouble sysprof_zoom_manager_get_zoom (SysprofZoomManager *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_zoom_manager_set_zoom (SpZoomManager *self,
+void sysprof_zoom_manager_set_zoom (SysprofZoomManager *self,
gdouble zoom);
G_END_DECLS
diff --git a/src/libsysprof/binfile.c b/src/libsysprof/binfile.c
index 04430fc..8a427a2 100644
--- a/src/libsysprof/binfile.c
+++ b/src/libsysprof/binfile.c
@@ -37,7 +37,7 @@
#include "binfile.h"
#include "elfparser.h"
-#include "sp-symbol-dirs.h"
+#include "sysprof-symbol-dirs.h"
struct bin_file_t
{
@@ -173,7 +173,7 @@ get_debuglink_file (ElfParser *elf,
dir = g_path_get_dirname (filename);
- tries = sp_symbol_dirs_get_paths (dir, basename);
+ tries = sysprof_symbol_dirs_get_paths (dir, basename);
for (i = 0; tries[i]; i++)
{
diff --git a/src/libsysprof/meson.build b/src/libsysprof/meson.build
index c54937e..5ffcbee 100644
--- a/src/libsysprof/meson.build
+++ b/src/libsysprof/meson.build
@@ -1,45 +1,45 @@
libsysprof_c_args = [ '-DSYSPROF_COMPILATION' ]
libsysprof_public_sources = [
- 'sp-callgraph-profile.c',
- 'sp-capture-gobject.c',
- 'sp-elf-symbol-resolver.c',
- 'sp-hostinfo-source.c',
- 'sp-jitmap-symbol-resolver.c',
- 'sp-kallsyms.c',
- 'sp-kernel-symbol.c',
- 'sp-kernel-symbol-resolver.c',
- 'sp-local-profiler.c',
- 'sp-map-lookaside.c',
- 'sp-process-model.c',
- 'sp-process-model-item.c',
- 'sp-profile.c',
- 'sp-profiler.c',
- 'sp-selection.c',
- 'sp-source.c',
- 'sp-symbol-dirs.c',
- 'sp-symbol-resolver.c',
+ 'sysprof-callgraph-profile.c',
+ 'sysprof-capture-gobject.c',
+ 'sysprof-elf-symbol-resolver.c',
+ 'sysprof-hostinfo-source.c',
+ 'sysprof-jitmap-symbol-resolver.c',
+ 'sysprof-kallsyms.c',
+ 'sysprof-kernel-symbol.c',
+ 'sysprof-kernel-symbol-resolver.c',
+ 'sysprof-local-profiler.c',
+ 'sysprof-map-lookaside.c',
+ 'sysprof-process-model.c',
+ 'sysprof-process-model-item.c',
+ 'sysprof-profile.c',
+ 'sysprof-profiler.c',
+ 'sysprof-selection.c',
+ 'sysprof-source.c',
+ 'sysprof-symbol-dirs.c',
+ 'sysprof-symbol-resolver.c',
]
libsysprof_public_headers = [
- 'sp-callgraph-profile.h',
- 'sp-capture-gobject.h',
- 'sp-elf-symbol-resolver.h',
- 'sp-hostinfo-source.h',
- 'sp-jitmap-symbol-resolver.h',
- 'sp-kallsyms.h',
- 'sp-kernel-symbol.h',
- 'sp-kernel-symbol-resolver.h',
- 'sp-local-profiler.h',
- 'sp-map-lookaside.h',
- 'sp-process-model.h',
- 'sp-process-model-item.h',
- 'sp-profile.h',
- 'sp-profiler.h',
- 'sp-selection.h',
- 'sp-source.h',
- 'sp-symbol-dirs.h',
- 'sp-symbol-resolver.h',
+ 'sysprof-callgraph-profile.h',
+ 'sysprof-capture-gobject.h',
+ 'sysprof-elf-symbol-resolver.h',
+ 'sysprof-hostinfo-source.h',
+ 'sysprof-jitmap-symbol-resolver.h',
+ 'sysprof-kallsyms.h',
+ 'sysprof-kernel-symbol.h',
+ 'sysprof-kernel-symbol-resolver.h',
+ 'sysprof-local-profiler.h',
+ 'sysprof-map-lookaside.h',
+ 'sysprof-process-model.h',
+ 'sysprof-process-model-item.h',
+ 'sysprof-profile.h',
+ 'sysprof-profiler.h',
+ 'sysprof-selection.h',
+ 'sysprof-source.h',
+ 'sysprof-symbol-dirs.h',
+ 'sysprof-symbol-resolver.h',
'sysprof.h',
]
@@ -48,8 +48,8 @@ libsysprof_private_sources = [
'binfile.c',
'demangle.cpp',
'elfparser.c',
- 'sp-source-util.c',
- 'sp-line-reader.c',
+ 'sysprof-source-util.c',
+ 'sysprof-line-reader.c',
]
libsysprof_public_sources += libsysprof_capture_sources
@@ -62,19 +62,19 @@ libsysprof_deps = [
if host_machine.system() == 'linux'
libsysprof_public_sources += [
- 'sp-gjs-source.c',
- 'sp-memory-source.c',
- 'sp-perf-counter.c',
- 'sp-perf-source.c',
- 'sp-proc-source.c',
+ 'sysprof-gjs-source.c',
+ 'sysprof-memory-source.c',
+ 'sysprof-perf-counter.c',
+ 'sysprof-perf-source.c',
+ 'sysprof-proc-source.c',
]
libsysprof_public_headers += [
- 'sp-gjs-source.h',
- 'sp-memory-source.h',
- 'sp-perf-counter.h',
- 'sp-perf-source.h',
- 'sp-proc-source.h',
+ 'sysprof-gjs-source.h',
+ 'sysprof-memory-source.h',
+ 'sysprof-perf-counter.h',
+ 'sysprof-perf-source.h',
+ 'sysprof-proc-source.h',
]
endif
diff --git a/src/libsysprof/sp-callgraph-profile.c b/src/libsysprof/sysprof-callgraph-profile.c
similarity index 63%
rename from src/libsysprof/sp-callgraph-profile.c
rename to src/libsysprof/sysprof-callgraph-profile.c
index 2707bb3..7351289 100644
--- a/src/libsysprof/sp-callgraph-profile.c
+++ b/src/libsysprof/sysprof-callgraph-profile.c
@@ -1,4 +1,4 @@
-/* sp-callgraph-profile.c
+/* sysprof-callgraph-profile.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -45,22 +45,22 @@
#include "../stackstash.h"
-#include "sp-callgraph-profile.h"
-#include "sp-capture-reader.h"
-#include "sp-elf-symbol-resolver.h"
-#include "sp-jitmap-symbol-resolver.h"
-#include "sp-kernel-symbol-resolver.h"
-#include "sp-map-lookaside.h"
-#include "sp-selection.h"
+#include "sysprof-callgraph-profile.h"
+#include "sysprof-capture-reader.h"
+#include "sysprof-elf-symbol-resolver.h"
+#include "sysprof-jitmap-symbol-resolver.h"
+#include "sysprof-kernel-symbol-resolver.h"
+#include "sysprof-map-lookaside.h"
+#include "sysprof-selection.h"
#define CHECK_CANCELLABLE_INTERVAL 100
-struct _SpCallgraphProfile
+struct _SysprofCallgraphProfile
{
GObject parent_instance;
- SpCaptureReader *reader;
- SpSelection *selection;
+ SysprofCaptureReader *reader;
+ SysprofSelection *selection;
StackStash *stash;
GStringChunk *symbols;
GHashTable *tags;
@@ -68,14 +68,14 @@ struct _SpCallgraphProfile
typedef struct
{
- SpCaptureReader *reader;
- SpSelection *selection;
+ SysprofCaptureReader *reader;
+ SysprofSelection *selection;
} Generate;
-static void profile_iface_init (SpProfileInterface *iface);
+static void profile_iface_init (SysprofProfileInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpCallgraphProfile, sp_callgraph_profile, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (SP_TYPE_PROFILE, profile_iface_init))
+G_DEFINE_TYPE_EXTENDED (SysprofCallgraphProfile, sysprof_callgraph_profile, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_PROFILE, profile_iface_init))
enum {
PROP_0,
@@ -85,41 +85,41 @@ enum {
static GParamSpec *properties [N_PROPS];
-SpProfile *
-sp_callgraph_profile_new (void)
+SysprofProfile *
+sysprof_callgraph_profile_new (void)
{
- return g_object_new (SP_TYPE_CALLGRAPH_PROFILE, NULL);
+ return g_object_new (SYSPROF_TYPE_CALLGRAPH_PROFILE, NULL);
}
-SpProfile *
-sp_callgraph_profile_new_with_selection (SpSelection *selection)
+SysprofProfile *
+sysprof_callgraph_profile_new_with_selection (SysprofSelection *selection)
{
- return g_object_new (SP_TYPE_CALLGRAPH_PROFILE,
+ return g_object_new (SYSPROF_TYPE_CALLGRAPH_PROFILE,
"selection", selection,
NULL);
}
static void
-sp_callgraph_profile_finalize (GObject *object)
+sysprof_callgraph_profile_finalize (GObject *object)
{
- SpCallgraphProfile *self = (SpCallgraphProfile *)object;
+ SysprofCallgraphProfile *self = (SysprofCallgraphProfile *)object;
g_clear_pointer (&self->symbols, g_string_chunk_free);
g_clear_pointer (&self->stash, stack_stash_unref);
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
g_clear_pointer (&self->tags, g_hash_table_unref);
g_clear_object (&self->selection);
- G_OBJECT_CLASS (sp_callgraph_profile_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_callgraph_profile_parent_class)->finalize (object);
}
static void
-sp_callgraph_profile_get_property (GObject *object,
+sysprof_callgraph_profile_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpCallgraphProfile *self = SP_CALLGRAPH_PROFILE (object);
+ SysprofCallgraphProfile *self = SYSPROF_CALLGRAPH_PROFILE (object);
switch (prop_id)
{
@@ -133,12 +133,12 @@ sp_callgraph_profile_get_property (GObject *object,
}
static void
-sp_callgraph_profile_set_property (GObject *object,
+sysprof_callgraph_profile_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpCallgraphProfile *self = SP_CALLGRAPH_PROFILE (object);
+ SysprofCallgraphProfile *self = SYSPROF_CALLGRAPH_PROFILE (object);
switch (prop_id)
{
@@ -152,51 +152,51 @@ sp_callgraph_profile_set_property (GObject *object,
}
static void
-sp_callgraph_profile_class_init (SpCallgraphProfileClass *klass)
+sysprof_callgraph_profile_class_init (SysprofCallgraphProfileClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_callgraph_profile_finalize;
- object_class->get_property = sp_callgraph_profile_get_property;
- object_class->set_property = sp_callgraph_profile_set_property;
+ object_class->finalize = sysprof_callgraph_profile_finalize;
+ object_class->get_property = sysprof_callgraph_profile_get_property;
+ object_class->set_property = sysprof_callgraph_profile_set_property;
properties [PROP_SELECTION] =
g_param_spec_object ("selection",
"Selection",
"The selection for filtering the callgraph",
- SP_TYPE_SELECTION,
+ SYSPROF_TYPE_SELECTION,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
-sp_callgraph_profile_init (SpCallgraphProfile *self)
+sysprof_callgraph_profile_init (SysprofCallgraphProfile *self)
{
self->symbols = g_string_chunk_new (getpagesize ());
self->tags = g_hash_table_new (g_str_hash, g_str_equal);
}
static void
-sp_callgraph_profile_set_reader (SpProfile *profile,
- SpCaptureReader *reader)
+sysprof_callgraph_profile_set_reader (SysprofProfile *profile,
+ SysprofCaptureReader *reader)
{
- SpCallgraphProfile *self = (SpCallgraphProfile *)profile;
+ SysprofCallgraphProfile *self = (SysprofCallgraphProfile *)profile;
- g_assert (SP_IS_CALLGRAPH_PROFILE (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (self));
g_assert (reader != NULL);
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
- self->reader = sp_capture_reader_ref (reader);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
+ self->reader = sysprof_capture_reader_ref (reader);
}
static const gchar *
-sp_callgraph_profile_intern_string_take (SpCallgraphProfile *self,
+sysprof_callgraph_profile_intern_string_take (SysprofCallgraphProfile *self,
gchar *str)
{
const gchar *ret;
- g_assert (SP_IS_CALLGRAPH_PROFILE (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (self));
g_assert (str != NULL);
ret = g_string_chunk_insert_const (self->symbols, str);
@@ -205,30 +205,30 @@ sp_callgraph_profile_intern_string_take (SpCallgraphProfile *self,
}
static const gchar *
-sp_callgraph_profile_intern_string (SpCallgraphProfile *self,
+sysprof_callgraph_profile_intern_string (SysprofCallgraphProfile *self,
const gchar *str)
{
- g_assert (SP_IS_CALLGRAPH_PROFILE (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (self));
g_assert (str != NULL);
return g_string_chunk_insert_const (self->symbols, str);
}
static void
-sp_callgraph_profile_generate_worker (GTask *task,
+sysprof_callgraph_profile_generate_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
- SpCallgraphProfile *self = source_object;
+ SysprofCallgraphProfile *self = source_object;
Generate *gen = task_data;
- SpCaptureReader *reader;
- SpSelection *selection;
+ SysprofCaptureReader *reader;
+ SysprofSelection *selection;
g_autoptr(GArray) resolved = NULL;
g_autoptr(GHashTable) maps_by_pid = NULL;
g_autoptr(GHashTable) cmdlines = NULL;
g_autoptr(GPtrArray) resolvers = NULL;
- SpCaptureFrameType type;
+ SysprofCaptureFrameType type;
StackStash *stash = NULL;
StackStash *resolved_stash = NULL;
guint count = 0;
@@ -241,26 +241,26 @@ sp_callgraph_profile_generate_worker (GTask *task,
reader = gen->reader;
selection = gen->selection;
- maps_by_pid = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)sp_map_lookaside_free);
+ maps_by_pid = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)sysprof_map_lookaside_free);
cmdlines = g_hash_table_new (NULL, NULL);
stash = stack_stash_new (NULL);
resolved_stash = stack_stash_new (NULL);
resolvers = g_ptr_array_new_with_free_func (g_object_unref);
- g_ptr_array_add (resolvers, sp_kernel_symbol_resolver_new ());
- g_ptr_array_add (resolvers, sp_elf_symbol_resolver_new ());
- g_ptr_array_add (resolvers, sp_jitmap_symbol_resolver_new ());
+ g_ptr_array_add (resolvers, sysprof_kernel_symbol_resolver_new ());
+ g_ptr_array_add (resolvers, sysprof_elf_symbol_resolver_new ());
+ g_ptr_array_add (resolvers, sysprof_jitmap_symbol_resolver_new ());
for (guint j = 0; j < resolvers->len; j++)
{
- SpSymbolResolver *resolver = g_ptr_array_index (resolvers, j);
+ SysprofSymbolResolver *resolver = g_ptr_array_index (resolvers, j);
- sp_capture_reader_reset (reader);
- sp_symbol_resolver_load (resolver, reader);
+ sysprof_capture_reader_reset (reader);
+ sysprof_symbol_resolver_load (resolver, reader);
}
- sp_capture_reader_reset (reader);
+ sysprof_capture_reader_reset (reader);
/*
* The resolved pointer array is where we stash the names for the
@@ -270,31 +270,31 @@ sp_callgraph_profile_generate_worker (GTask *task,
*/
resolved = g_array_new (FALSE, TRUE, sizeof (guint64));
- while (sp_capture_reader_peek_type (reader, &type))
+ while (sysprof_capture_reader_peek_type (reader, &type))
{
- const SpCaptureProcess *pr;
+ const SysprofCaptureProcess *pr;
const gchar *cmdline;
- if (type != SP_CAPTURE_FRAME_PROCESS)
+ if (type != SYSPROF_CAPTURE_FRAME_PROCESS)
{
- if (!sp_capture_reader_skip (reader))
+ if (!sysprof_capture_reader_skip (reader))
goto failure;
continue;
}
- if (NULL == (pr = sp_capture_reader_read_process (reader)))
+ if (NULL == (pr = sysprof_capture_reader_read_process (reader)))
goto failure;
cmdline = g_strdup_printf ("[%s]", pr->cmdline);
g_hash_table_insert (cmdlines,
GINT_TO_POINTER (pr->frame.pid),
- (gchar *)sp_callgraph_profile_intern_string (self, cmdline));
+ (gchar *)sysprof_callgraph_profile_intern_string (self, cmdline));
}
if (g_task_return_error_if_cancelled (task))
goto cleanup;
- sp_capture_reader_reset (reader);
+ sysprof_capture_reader_reset (reader);
/*
* Walk through all of the sample events and resolve instruction-pointers
@@ -302,18 +302,18 @@ sp_callgraph_profile_generate_worker (GTask *task,
* name. If we wanted to support dynamic systems, we'd want to extend this
* to parse information from captured data about the languages jit'd code.
*/
- while (sp_capture_reader_peek_type (reader, &type))
+ while (sysprof_capture_reader_peek_type (reader, &type))
{
- SpAddressContext last_context = SP_ADDRESS_CONTEXT_NONE;
- const SpCaptureSample *sample;
+ SysprofAddressContext last_context = SYSPROF_ADDRESS_CONTEXT_NONE;
+ const SysprofCaptureSample *sample;
StackNode *node;
StackNode *iter;
const gchar *cmdline;
guint len = 5;
- if (type != SP_CAPTURE_FRAME_SAMPLE)
+ if (type != SYSPROF_CAPTURE_FRAME_SAMPLE)
{
- if (!sp_capture_reader_skip (reader))
+ if (!sysprof_capture_reader_skip (reader))
goto failure;
continue;
}
@@ -324,10 +324,10 @@ sp_callgraph_profile_generate_worker (GTask *task,
goto cleanup;
}
- if (NULL == (sample = sp_capture_reader_read_sample (reader)))
+ if (NULL == (sample = sysprof_capture_reader_read_sample (reader)))
goto failure;
- if (!sp_selection_contains (selection, sample->frame.time))
+ if (!sysprof_selection_contains (selection, sample->frame.time))
continue;
if (sample->n_addrs == 0)
@@ -340,8 +340,8 @@ sp_callgraph_profile_generate_worker (GTask *task,
* untrusted data from capture files, it's not safe to assume. But in
* practice it is.
*/
- g_assert (sp_address_is_context_switch (sample->addrs[0], &last_context));
- last_context = SP_ADDRESS_CONTEXT_NONE;
+ g_assert (sysprof_address_is_context_switch (sample->addrs[0], &last_context));
+ last_context = SYSPROF_ADDRESS_CONTEXT_NONE;
#endif
node = stack_stash_add_trace (stash, (gpointer)sample->addrs, sample->n_addrs, 1);
@@ -356,14 +356,14 @@ sp_callgraph_profile_generate_worker (GTask *task,
for (iter = node; iter != NULL; iter = iter->parent)
{
- SpAddressContext context = SP_ADDRESS_CONTEXT_NONE;
- SpAddress address = iter->data;
+ SysprofAddressContext context = SYSPROF_ADDRESS_CONTEXT_NONE;
+ SysprofAddress address = iter->data;
const gchar *symbol = NULL;
- if (sp_address_is_context_switch (address, &context))
+ if (sysprof_address_is_context_switch (address, &context))
{
if (last_context)
- symbol = sp_address_context_to_string (last_context);
+ symbol = sysprof_address_context_to_string (last_context);
else
symbol = NULL;
@@ -373,11 +373,11 @@ sp_callgraph_profile_generate_worker (GTask *task,
{
for (guint j = 0; j < resolvers->len; j++)
{
- SpSymbolResolver *resolver = g_ptr_array_index (resolvers, j);
+ SysprofSymbolResolver *resolver = g_ptr_array_index (resolvers, j);
GQuark tag = 0;
gchar *str;
- str = sp_symbol_resolver_resolve_with_context (resolver,
+ str = sysprof_symbol_resolver_resolve_with_context (resolver,
sample->frame.time,
sample->frame.pid,
last_context,
@@ -386,7 +386,7 @@ sp_callgraph_profile_generate_worker (GTask *task,
if (str != NULL)
{
- symbol = sp_callgraph_profile_intern_string_take (self, str);
+ symbol = sysprof_callgraph_profile_intern_string_take (self, str);
if (tag != 0)
g_hash_table_insert (self->tags, (gchar *)symbol, GSIZE_TO_POINTER (tag));
break;
@@ -395,18 +395,18 @@ sp_callgraph_profile_generate_worker (GTask *task,
}
if (symbol != NULL)
- g_array_index (resolved, SpAddress, len++) = POINTER_TO_U64 (symbol);
+ g_array_index (resolved, SysprofAddress, len++) = POINTER_TO_U64 (symbol);
}
- if (last_context && last_context != SP_ADDRESS_CONTEXT_USER)
+ if (last_context && last_context != SYSPROF_ADDRESS_CONTEXT_USER)
{
/* Kernel threads do not have a user part, so we end up here
* without ever getting a user context. If this happens,
* add the '- - kernel - - ' name, so that kernel threads
* are properly blamed on the kernel
*/
- const gchar *name = sp_address_context_to_string (last_context);
- g_array_index (resolved, SpAddress, len++) = POINTER_TO_U64 (name);
+ const gchar *name = sysprof_address_context_to_string (last_context);
+ g_array_index (resolved, SysprofAddress, len++) = POINTER_TO_U64 (name);
}
if (cmdline != NULL)
@@ -438,43 +438,43 @@ cleanup:
static void
generate_free (Generate *generate)
{
- sp_capture_reader_unref (generate->reader);
+ sysprof_capture_reader_unref (generate->reader);
g_clear_object (&generate->selection);
g_slice_free (Generate, generate);
}
static void
-sp_callgraph_profile_generate (SpProfile *profile,
+sysprof_callgraph_profile_generate (SysprofProfile *profile,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
- SpCallgraphProfile *self = (SpCallgraphProfile *)profile;
+ SysprofCallgraphProfile *self = (SysprofCallgraphProfile *)profile;
Generate *gen;
g_autoptr(GTask) task = NULL;
- g_assert (SP_IS_CALLGRAPH_PROFILE (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (self));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
gen = g_slice_new0 (Generate);
- gen->reader = sp_capture_reader_copy (self->reader);
- gen->selection = sp_selection_copy (self->selection);
+ gen->reader = sysprof_capture_reader_copy (self->reader);
+ gen->selection = sysprof_selection_copy (self->selection);
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, gen, (GDestroyNotify)generate_free);
- g_task_run_in_thread (task, sp_callgraph_profile_generate_worker);
+ g_task_run_in_thread (task, sysprof_callgraph_profile_generate_worker);
}
static gboolean
-sp_callgraph_profile_generate_finish (SpProfile *profile,
+sysprof_callgraph_profile_generate_finish (SysprofProfile *profile,
GAsyncResult *result,
GError **error)
{
- SpCallgraphProfile *self = (SpCallgraphProfile *)profile;
+ SysprofCallgraphProfile *self = (SysprofCallgraphProfile *)profile;
StackStash *stash;
- g_assert (SP_IS_CALLGRAPH_PROFILE (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (self));
g_assert (G_IS_TASK (result));
stash = g_task_propagate_pointer (G_TASK (result), error);
@@ -496,26 +496,26 @@ sp_callgraph_profile_generate_finish (SpProfile *profile,
}
static void
-profile_iface_init (SpProfileInterface *iface)
+profile_iface_init (SysprofProfileInterface *iface)
{
- iface->generate = sp_callgraph_profile_generate;
- iface->generate_finish = sp_callgraph_profile_generate_finish;
- iface->set_reader = sp_callgraph_profile_set_reader;
+ iface->generate = sysprof_callgraph_profile_generate;
+ iface->generate_finish = sysprof_callgraph_profile_generate_finish;
+ iface->set_reader = sysprof_callgraph_profile_set_reader;
}
gpointer
-sp_callgraph_profile_get_stash (SpCallgraphProfile *self)
+sysprof_callgraph_profile_get_stash (SysprofCallgraphProfile *self)
{
- g_return_val_if_fail (SP_IS_CALLGRAPH_PROFILE (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_PROFILE (self), NULL);
return self->stash;
}
GQuark
-sp_callgraph_profile_get_tag (SpCallgraphProfile *self,
+sysprof_callgraph_profile_get_tag (SysprofCallgraphProfile *self,
const gchar *symbol)
{
- g_return_val_if_fail (SP_IS_CALLGRAPH_PROFILE (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_PROFILE (self), 0);
return GPOINTER_TO_SIZE (g_hash_table_lookup (self->tags, symbol));
}
diff --git a/src/libsysprof/sp-callgraph-profile.h b/src/libsysprof/sysprof-callgraph-profile.h
similarity index 62%
rename from src/libsysprof/sp-callgraph-profile.h
rename to src/libsysprof/sysprof-callgraph-profile.h
index 951908f..bb1d849 100644
--- a/src/libsysprof/sp-callgraph-profile.h
+++ b/src/libsysprof/sysprof-callgraph-profile.h
@@ -1,4 +1,4 @@
-/* sp-callgraph-profile.h
+/* sysprof-callgraph-profile.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,24 +22,24 @@
#include "sysprof-version-macros.h"
-#include "sp-profile.h"
-#include "sp-selection.h"
+#include "sysprof-profile.h"
+#include "sysprof-selection.h"
G_BEGIN_DECLS
-#define SP_TYPE_CALLGRAPH_PROFILE (sp_callgraph_profile_get_type())
+#define SYSPROF_TYPE_CALLGRAPH_PROFILE (sysprof_callgraph_profile_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpCallgraphProfile, sp_callgraph_profile, SP, CALLGRAPH_PROFILE, GObject)
+G_DECLARE_FINAL_TYPE (SysprofCallgraphProfile, sysprof_callgraph_profile, SYSPROF, CALLGRAPH_PROFILE,
GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpProfile *sp_callgraph_profile_new (void);
+SysprofProfile *sysprof_callgraph_profile_new (void);
SYSPROF_AVAILABLE_IN_ALL
-SpProfile *sp_callgraph_profile_new_with_selection (SpSelection *selection);
+SysprofProfile *sysprof_callgraph_profile_new_with_selection (SysprofSelection *selection);
SYSPROF_AVAILABLE_IN_ALL
-gpointer sp_callgraph_profile_get_stash (SpCallgraphProfile *self);
+gpointer sysprof_callgraph_profile_get_stash (SysprofCallgraphProfile *self);
SYSPROF_AVAILABLE_IN_ALL
-GQuark sp_callgraph_profile_get_tag (SpCallgraphProfile *self,
+GQuark sysprof_callgraph_profile_get_tag (SysprofCallgraphProfile *self,
const gchar *symbol);
G_END_DECLS
diff --git a/src/libsysprof/sp-capture-gobject.c b/src/libsysprof/sysprof-capture-gobject.c
similarity index 60%
rename from src/libsysprof/sp-capture-gobject.c
rename to src/libsysprof/sysprof-capture-gobject.c
index f6717df..dbd7cf2 100644
--- a/src/libsysprof/sp-capture-gobject.c
+++ b/src/libsysprof/sysprof-capture-gobject.c
@@ -1,4 +1,4 @@
-/* sp-capture-gobject.c
+/* sysprof-capture-gobject.c
*
* Copyright 2019 Christian Hergert <chergert redhat com>
*
@@ -20,10 +20,10 @@
#include "config.h"
-#include "sp-capture-gobject.h"
+#include "sysprof-capture-gobject.h"
#include <sysprof-capture.h>
-G_DEFINE_BOXED_TYPE (SpCaptureReader, sp_capture_reader, (GBoxedCopyFunc)sp_capture_reader_ref,
(GBoxedFreeFunc)sp_capture_reader_unref)
-G_DEFINE_BOXED_TYPE (SpCaptureWriter, sp_capture_writer, (GBoxedCopyFunc)sp_capture_writer_ref,
(GBoxedFreeFunc)sp_capture_writer_unref)
-G_DEFINE_BOXED_TYPE (SpCaptureCursor, sp_capture_cursor, (GBoxedCopyFunc)sp_capture_cursor_ref,
(GBoxedFreeFunc)sp_capture_cursor_unref)
+G_DEFINE_BOXED_TYPE (SysprofCaptureReader, sysprof_capture_reader,
(GBoxedCopyFunc)sysprof_capture_reader_ref, (GBoxedFreeFunc)sysprof_capture_reader_unref)
+G_DEFINE_BOXED_TYPE (SysprofCaptureWriter, sysprof_capture_writer,
(GBoxedCopyFunc)sysprof_capture_writer_ref, (GBoxedFreeFunc)sysprof_capture_writer_unref)
+G_DEFINE_BOXED_TYPE (SysprofCaptureCursor, sysprof_capture_cursor,
(GBoxedCopyFunc)sysprof_capture_cursor_ref, (GBoxedFreeFunc)sysprof_capture_cursor_unref)
diff --git a/src/libsysprof/sp-capture-gobject.h b/src/libsysprof/sysprof-capture-gobject.h
similarity index 71%
rename from src/libsysprof/sp-capture-gobject.h
rename to src/libsysprof/sysprof-capture-gobject.h
index c7b791b..30f5994 100644
--- a/src/libsysprof/sp-capture-gobject.h
+++ b/src/libsysprof/sysprof-capture-gobject.h
@@ -1,4 +1,4 @@
-/* sp-capture-gobject.h
+/* sysprof-capture-gobject.h
*
* Copyright 2019 Christian Hergert <chergert redhat com>
*
@@ -26,15 +26,15 @@
G_BEGIN_DECLS
-#define SP_TYPE_CAPTURE_READER (sp_capture_reader_get_type())
-#define SP_TYPE_CAPTURE_WRITER (sp_capture_writer_get_type())
-#define SP_TYPE_CAPTURE_CURSOR (sp_capture_cursor_get_type())
+#define SYSPROF_TYPE_CAPTURE_READER (sysprof_capture_reader_get_type())
+#define SYSPROF_TYPE_CAPTURE_WRITER (sysprof_capture_writer_get_type())
+#define SYSPROF_TYPE_CAPTURE_CURSOR (sysprof_capture_cursor_get_type())
SYSPROF_AVAILABLE_IN_ALL
-GType sp_capture_reader_get_type (void);
+GType sysprof_capture_reader_get_type (void);
SYSPROF_AVAILABLE_IN_ALL
-GType sp_capture_writer_get_type (void);
+GType sysprof_capture_writer_get_type (void);
SYSPROF_AVAILABLE_IN_ALL
-GType sp_capture_cursor_get_type (void);
+GType sysprof_capture_cursor_get_type (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-elf-symbol-resolver.c b/src/libsysprof/sysprof-elf-symbol-resolver.c
similarity index 71%
rename from src/libsysprof/sp-elf-symbol-resolver.c
rename to src/libsysprof/sysprof-elf-symbol-resolver.c
index a62f21e..71a9d44 100644
--- a/src/libsysprof/sp-elf-symbol-resolver.c
+++ b/src/libsysprof/sysprof-elf-symbol-resolver.c
@@ -1,4 +1,4 @@
-/* sp-elf-symbol-resolver.c
+/* sysprof-elf-symbol-resolver.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -24,10 +24,10 @@
#include "binfile.h"
#include "elfparser.h"
-#include "sp-elf-symbol-resolver.h"
-#include "sp-map-lookaside.h"
+#include "sysprof-elf-symbol-resolver.h"
+#include "sysprof-map-lookaside.h"
-struct _SpElfSymbolResolver
+struct _SysprofElfSymbolResolver
{
GObject parent_instance;
@@ -36,42 +36,42 @@ struct _SpElfSymbolResolver
GHashTable *tag_cache;
};
-static void symbol_resolver_iface_init (SpSymbolResolverInterface *iface);
+static void symbol_resolver_iface_init (SysprofSymbolResolverInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpElfSymbolResolver,
- sp_elf_symbol_resolver,
+G_DEFINE_TYPE_EXTENDED (SysprofElfSymbolResolver,
+ sysprof_elf_symbol_resolver,
G_TYPE_OBJECT,
0,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SYMBOL_RESOLVER,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SYMBOL_RESOLVER,
symbol_resolver_iface_init))
static void
-sp_elf_symbol_resolver_finalize (GObject *object)
+sysprof_elf_symbol_resolver_finalize (GObject *object)
{
- SpElfSymbolResolver *self = (SpElfSymbolResolver *)object;
+ SysprofElfSymbolResolver *self = (SysprofElfSymbolResolver *)object;
g_clear_pointer (&self->bin_files, g_hash_table_unref);
g_clear_pointer (&self->lookasides, g_hash_table_unref);
g_clear_pointer (&self->tag_cache, g_hash_table_unref);
- G_OBJECT_CLASS (sp_elf_symbol_resolver_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_elf_symbol_resolver_parent_class)->finalize (object);
}
static void
-sp_elf_symbol_resolver_class_init (SpElfSymbolResolverClass *klass)
+sysprof_elf_symbol_resolver_class_init (SysprofElfSymbolResolverClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_elf_symbol_resolver_finalize;
+ object_class->finalize = sysprof_elf_symbol_resolver_finalize;
}
static void
-sp_elf_symbol_resolver_init (SpElfSymbolResolver *self)
+sysprof_elf_symbol_resolver_init (SysprofElfSymbolResolver *self)
{
self->lookasides = g_hash_table_new_full (NULL,
NULL,
NULL,
- (GDestroyNotify)sp_map_lookaside_free);
+ (GDestroyNotify)sysprof_map_lookaside_free);
self->bin_files = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -82,31 +82,31 @@ sp_elf_symbol_resolver_init (SpElfSymbolResolver *self)
}
static void
-sp_elf_symbol_resolver_load (SpSymbolResolver *resolver,
- SpCaptureReader *reader)
+sysprof_elf_symbol_resolver_load (SysprofSymbolResolver *resolver,
+ SysprofCaptureReader *reader)
{
- SpElfSymbolResolver *self = (SpElfSymbolResolver *)resolver;
- SpCaptureFrameType type;
+ SysprofElfSymbolResolver *self = (SysprofElfSymbolResolver *)resolver;
+ SysprofCaptureFrameType type;
- g_assert (SP_IS_SYMBOL_RESOLVER (resolver));
+ g_assert (SYSPROF_IS_SYMBOL_RESOLVER (resolver));
g_assert (reader != NULL);
- sp_capture_reader_reset (reader);
+ sysprof_capture_reader_reset (reader);
- while (sp_capture_reader_peek_type (reader, &type))
+ while (sysprof_capture_reader_peek_type (reader, &type))
{
- const SpCaptureMap *ev;
- SpMapLookaside *lookaside;
- SpMap map;
+ const SysprofCaptureMap *ev;
+ SysprofMapLookaside *lookaside;
+ SysprofMap map;
- if (type != SP_CAPTURE_FRAME_MAP)
+ if (type != SYSPROF_CAPTURE_FRAME_MAP)
{
- if (!sp_capture_reader_skip (reader))
+ if (!sysprof_capture_reader_skip (reader))
return;
continue;
}
- ev = sp_capture_reader_read_map (reader);
+ ev = sysprof_capture_reader_read_map (reader);
map.start = ev->start;
map.end = ev->end;
@@ -118,21 +118,21 @@ sp_elf_symbol_resolver_load (SpSymbolResolver *resolver,
if (lookaside == NULL)
{
- lookaside = sp_map_lookaside_new ();
+ lookaside = sysprof_map_lookaside_new ();
g_hash_table_insert (self->lookasides, GINT_TO_POINTER (ev->frame.pid), lookaside);
}
- sp_map_lookaside_insert (lookaside, &map);
+ sysprof_map_lookaside_insert (lookaside, &map);
}
}
static bin_file_t *
-sp_elf_symbol_resolver_get_bin_file (SpElfSymbolResolver *self,
+sysprof_elf_symbol_resolver_get_bin_file (SysprofElfSymbolResolver *self,
const gchar *filename)
{
bin_file_t *bin_file;
- g_assert (SP_IS_ELF_SYMBOL_RESOLVER (self));
+ g_assert (SYSPROF_IS_ELF_SYMBOL_RESOLVER (self));
bin_file = g_hash_table_lookup (self->bin_files, filename);
@@ -141,7 +141,7 @@ sp_elf_symbol_resolver_get_bin_file (SpElfSymbolResolver *self,
const gchar *alternate = filename;
/*
- * If we are in a new mount namespace, then rely on the sp_symbol_dirs
+ * If we are in a new mount namespace, then rely on the sysprof_symbol_dirs
* to find us a locate to resolve the file where the CRC will match.
*
* TODO: We need to translate the path here so that we can locate the
@@ -159,8 +159,8 @@ sp_elf_symbol_resolver_get_bin_file (SpElfSymbolResolver *self,
}
static GQuark
-guess_tag (SpElfSymbolResolver *self,
- const SpMap *map)
+guess_tag (SysprofElfSymbolResolver *self,
+ const SysprofMap *map)
{
g_assert (map != NULL);
g_assert (map->filename != NULL);
@@ -254,37 +254,37 @@ guess_tag (SpElfSymbolResolver *self,
}
static gchar *
-sp_elf_symbol_resolver_resolve_with_context (SpSymbolResolver *resolver,
+sysprof_elf_symbol_resolver_resolve_with_context (SysprofSymbolResolver *resolver,
guint64 time,
GPid pid,
- SpAddressContext context,
- SpCaptureAddress address,
+ SysprofAddressContext context,
+ SysprofCaptureAddress address,
GQuark *tag)
{
- SpElfSymbolResolver *self = (SpElfSymbolResolver *)resolver;
+ SysprofElfSymbolResolver *self = (SysprofElfSymbolResolver *)resolver;
const bin_symbol_t *bin_sym;
- SpMapLookaside *lookaside;
+ SysprofMapLookaside *lookaside;
const gchar *bin_sym_name;
- const SpMap *map;
+ const SysprofMap *map;
bin_file_t *bin_file;
- g_assert (SP_IS_ELF_SYMBOL_RESOLVER (self));
+ g_assert (SYSPROF_IS_ELF_SYMBOL_RESOLVER (self));
- if (context != SP_ADDRESS_CONTEXT_USER)
+ if (context != SYSPROF_ADDRESS_CONTEXT_USER)
return NULL;
lookaside = g_hash_table_lookup (self->lookasides, GINT_TO_POINTER (pid));
if (lookaside == NULL)
return NULL;
- map = sp_map_lookaside_lookup (lookaside, address);
+ map = sysprof_map_lookaside_lookup (lookaside, address);
if (map == NULL)
return NULL;
address -= map->start;
address += map->offset;
- bin_file = sp_elf_symbol_resolver_get_bin_file (self, map->filename);
+ bin_file = sysprof_elf_symbol_resolver_get_bin_file (self, map->filename);
g_assert (bin_file != NULL);
@@ -301,14 +301,14 @@ sp_elf_symbol_resolver_resolve_with_context (SpSymbolResolver *resolver,
}
static void
-symbol_resolver_iface_init (SpSymbolResolverInterface *iface)
+symbol_resolver_iface_init (SysprofSymbolResolverInterface *iface)
{
- iface->load = sp_elf_symbol_resolver_load;
- iface->resolve_with_context = sp_elf_symbol_resolver_resolve_with_context;
+ iface->load = sysprof_elf_symbol_resolver_load;
+ iface->resolve_with_context = sysprof_elf_symbol_resolver_resolve_with_context;
}
-SpSymbolResolver *
-sp_elf_symbol_resolver_new (void)
+SysprofSymbolResolver *
+sysprof_elf_symbol_resolver_new (void)
{
- return g_object_new (SP_TYPE_ELF_SYMBOL_RESOLVER, NULL);
+ return g_object_new (SYSPROF_TYPE_ELF_SYMBOL_RESOLVER, NULL);
}
diff --git a/src/libsysprof/sp-elf-symbol-resolver.h b/src/libsysprof/sysprof-elf-symbol-resolver.h
similarity index 73%
rename from src/libsysprof/sp-elf-symbol-resolver.h
rename to src/libsysprof/sysprof-elf-symbol-resolver.h
index f87e701..e2d2eae 100644
--- a/src/libsysprof/sp-elf-symbol-resolver.h
+++ b/src/libsysprof/sysprof-elf-symbol-resolver.h
@@ -1,4 +1,4 @@
-/* sp-elf-symbol-resolver.h
+/* sysprof-elf-symbol-resolver.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,16 +22,16 @@
#include "sysprof-version-macros.h"
-#include "sp-symbol-resolver.h"
+#include "sysprof-symbol-resolver.h"
G_BEGIN_DECLS
-#define SP_TYPE_ELF_SYMBOL_RESOLVER (sp_elf_symbol_resolver_get_type())
+#define SYSPROF_TYPE_ELF_SYMBOL_RESOLVER (sysprof_elf_symbol_resolver_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpElfSymbolResolver, sp_elf_symbol_resolver, SP, ELF_SYMBOL_RESOLVER, GObject)
+G_DECLARE_FINAL_TYPE (SysprofElfSymbolResolver, sysprof_elf_symbol_resolver, SYSPROF, ELF_SYMBOL_RESOLVER,
GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpSymbolResolver *sp_elf_symbol_resolver_new (void);
+SysprofSymbolResolver *sysprof_elf_symbol_resolver_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-gjs-source.c b/src/libsysprof/sysprof-gjs-source.c
similarity index 58%
rename from src/libsysprof/sp-gjs-source.c
rename to src/libsysprof/sysprof-gjs-source.c
index 065d491..ce3569b 100644
--- a/src/libsysprof/sp-gjs-source.c
+++ b/src/libsysprof/sysprof-gjs-source.c
@@ -1,4 +1,4 @@
-/* sp-gjs-source.c
+/* sysprof-gjs-source.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -23,14 +23,14 @@
#include <signal.h>
#include <string.h>
-#include "sp-capture-reader.h"
-#include "sp-gjs-source.h"
+#include "sysprof-capture-reader.h"
+#include "sysprof-gjs-source.h"
-struct _SpGjsSource
+struct _SysprofGjsSource
{
GObject parent_instance;
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
GArray *pids;
GArray *enabled;
};
@@ -38,57 +38,57 @@ struct _SpGjsSource
#define ENABLE_PROFILER 0x1
#define DISABLE_PROFILER 0x0
-static void source_iface_init (SpSourceInterface *iface);
+static void source_iface_init (SysprofSourceInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpGjsSource, sp_gjs_source, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SOURCE, source_iface_init))
+G_DEFINE_TYPE_EXTENDED (SysprofGjsSource, sysprof_gjs_source, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
static void
-sp_gjs_source_finalize (GObject *object)
+sysprof_gjs_source_finalize (GObject *object)
{
- SpGjsSource *self = (SpGjsSource *)object;
+ SysprofGjsSource *self = (SysprofGjsSource *)object;
g_clear_pointer (&self->pids, g_array_unref);
g_clear_pointer (&self->enabled, g_array_unref);
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
- G_OBJECT_CLASS (sp_gjs_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_gjs_source_parent_class)->finalize (object);
}
static void
-sp_gjs_source_class_init (SpGjsSourceClass *klass)
+sysprof_gjs_source_class_init (SysprofGjsSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_gjs_source_finalize;
+ object_class->finalize = sysprof_gjs_source_finalize;
}
static void
-sp_gjs_source_init (SpGjsSource *self)
+sysprof_gjs_source_init (SysprofGjsSource *self)
{
self->pids = g_array_new (FALSE, FALSE, sizeof (GPid));
self->enabled = g_array_new (FALSE, FALSE, sizeof (GPid));
}
static void
-sp_gjs_source_process_capture (SpGjsSource *self,
+sysprof_gjs_source_process_capture (SysprofGjsSource *self,
GPid pid,
const gchar *path)
{
g_autoptr(GError) error = NULL;
- g_autoptr(SpCaptureReader) reader = NULL;
+ g_autoptr(SysprofCaptureReader) reader = NULL;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
g_assert (self->writer != NULL);
g_assert (path != NULL);
- if (!(reader = sp_capture_reader_new (path, &error)))
+ if (!(reader = sysprof_capture_reader_new (path, &error)))
{
g_warning ("Failed to load capture: %s", error->message);
return;
}
- if (!sp_capture_reader_splice (reader, self->writer, &error))
+ if (!sysprof_capture_reader_splice (reader, self->writer, &error))
{
g_warning ("Failed to load capture: %s", error->message);
return;
@@ -96,11 +96,11 @@ sp_gjs_source_process_capture (SpGjsSource *self,
}
static void
-sp_gjs_source_process_captures (SpGjsSource *self)
+sysprof_gjs_source_process_captures (SysprofGjsSource *self)
{
guint i;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
g_assert (self->writer != NULL);
for (i = 0; i < self->enabled->len; i++)
@@ -112,20 +112,20 @@ sp_gjs_source_process_captures (SpGjsSource *self)
filename = g_strdup_printf ("gjs-profile-%u", (guint)pid);
path = g_build_filename (g_get_tmp_dir (), filename, NULL);
- sp_gjs_source_process_capture (self, pid, path);
+ sysprof_gjs_source_process_capture (self, pid, path);
}
}
static void
-sp_gjs_source_set_writer (SpSource *source,
- SpCaptureWriter *writer)
+sysprof_gjs_source_set_writer (SysprofSource *source,
+ SysprofCaptureWriter *writer)
{
- SpGjsSource *self = (SpGjsSource *)source;
+ SysprofGjsSource *self = (SysprofGjsSource *)source;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
g_assert (writer != NULL);
- self->writer = sp_capture_writer_ref (writer);
+ self->writer = sysprof_capture_writer_ref (writer);
}
static gboolean
@@ -154,12 +154,12 @@ pid_is_profileable (GPid pid)
}
static void
-sp_gjs_source_enable_pid (SpGjsSource *self,
+sysprof_gjs_source_enable_pid (SysprofGjsSource *self,
GPid pid)
{
union sigval si;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
g_assert (pid != -1);
si.sival_int = ENABLE_PROFILER;
@@ -171,12 +171,12 @@ sp_gjs_source_enable_pid (SpGjsSource *self,
}
static void
-sp_gjs_source_disable_pid (SpGjsSource *self,
+sysprof_gjs_source_disable_pid (SysprofGjsSource *self,
GPid pid)
{
union sigval si;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
g_assert (pid != -1);
si.sival_int = DISABLE_PROFILER;
@@ -186,64 +186,64 @@ sp_gjs_source_disable_pid (SpGjsSource *self,
}
static void
-sp_gjs_source_start (SpSource *source)
+sysprof_gjs_source_start (SysprofSource *source)
{
- SpGjsSource *self = (SpGjsSource *)source;
+ SysprofGjsSource *self = (SysprofGjsSource *)source;
guint i;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
for (i = 0; i < self->pids->len; i++)
{
GPid pid = g_array_index (self->pids, GPid, i);
if (pid_is_profileable (pid))
- sp_gjs_source_enable_pid (self, pid);
+ sysprof_gjs_source_enable_pid (self, pid);
}
}
static void
-sp_gjs_source_stop (SpSource *source)
+sysprof_gjs_source_stop (SysprofSource *source)
{
- SpGjsSource *self = (SpGjsSource *)source;
+ SysprofGjsSource *self = (SysprofGjsSource *)source;
guint i;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
for (i = 0; i < self->pids->len; i++)
{
GPid pid = g_array_index (self->pids, GPid, i);
if (pid_is_profileable (pid))
- sp_gjs_source_disable_pid (self, pid);
+ sysprof_gjs_source_disable_pid (self, pid);
}
- sp_gjs_source_process_captures (self);
+ sysprof_gjs_source_process_captures (self);
}
static void
-sp_gjs_source_add_pid (SpSource *source,
+sysprof_gjs_source_add_pid (SysprofSource *source,
GPid pid)
{
- SpGjsSource *self = (SpGjsSource *)source;
+ SysprofGjsSource *self = (SysprofGjsSource *)source;
- g_assert (SP_IS_GJS_SOURCE (self));
+ g_assert (SYSPROF_IS_GJS_SOURCE (self));
g_assert (pid > -1);
g_array_append_val (self->pids, pid);
}
static void
-source_iface_init (SpSourceInterface *iface)
+source_iface_init (SysprofSourceInterface *iface)
{
- iface->set_writer = sp_gjs_source_set_writer;
- iface->start = sp_gjs_source_start;
- iface->stop = sp_gjs_source_stop;
- iface->add_pid = sp_gjs_source_add_pid;
+ iface->set_writer = sysprof_gjs_source_set_writer;
+ iface->start = sysprof_gjs_source_start;
+ iface->stop = sysprof_gjs_source_stop;
+ iface->add_pid = sysprof_gjs_source_add_pid;
}
-SpSource *
-sp_gjs_source_new (void)
+SysprofSource *
+sysprof_gjs_source_new (void)
{
- return g_object_new (SP_TYPE_GJS_SOURCE, NULL);
+ return g_object_new (SYSPROF_TYPE_GJS_SOURCE, NULL);
}
diff --git a/src/libsysprof/sp-gjs-source.h b/src/libsysprof/sysprof-gjs-source.h
similarity index 76%
rename from src/libsysprof/sp-gjs-source.h
rename to src/libsysprof/sysprof-gjs-source.h
index fe98ee1..1c111b6 100644
--- a/src/libsysprof/sp-gjs-source.h
+++ b/src/libsysprof/sysprof-gjs-source.h
@@ -1,4 +1,4 @@
-/* sp-gjs-source.h
+/* sysprof-gjs-source.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,14 +20,14 @@
#pragma once
-#include "sp-source.h"
+#include "sysprof-source.h"
G_BEGIN_DECLS
-#define SP_TYPE_GJS_SOURCE (sp_gjs_source_get_type())
+#define SYSPROF_TYPE_GJS_SOURCE (sysprof_gjs_source_get_type())
-G_DECLARE_FINAL_TYPE (SpGjsSource, sp_gjs_source, SP, GJS_SOURCE, GObject)
+G_DECLARE_FINAL_TYPE (SysprofGjsSource, sysprof_gjs_source, SYSPROF, GJS_SOURCE, GObject)
-SpSource *sp_gjs_source_new (void);
+SysprofSource *sysprof_gjs_source_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-hostinfo-source.c b/src/libsysprof/sysprof-hostinfo-source.c
similarity index 72%
rename from src/libsysprof/sp-hostinfo-source.c
rename to src/libsysprof/sysprof-hostinfo-source.c
index af15320..b0a1504 100644
--- a/src/libsysprof/sp-hostinfo-source.c
+++ b/src/libsysprof/sysprof-hostinfo-source.c
@@ -1,4 +1,4 @@
-/* sp-hostinfo-source.c
+/* sysprof-hostinfo-source.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -27,11 +27,11 @@
#include <sys/stat.h>
#include <unistd.h>
-#include "sp-hostinfo-source.h"
+#include "sysprof-hostinfo-source.h"
#define PROC_STAT_BUF_SIZE 4096
-struct _SpHostinfoSource
+struct _SysprofHostinfoSource
{
GObject parent_instance;
@@ -39,7 +39,7 @@ struct _SpHostinfoSource
gint n_cpu;
gint stat_fd;
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
GArray *cpu_info;
gchar *stat_buf;
};
@@ -61,19 +61,19 @@ typedef struct
glong last_guest_nice;
} CpuInfo;
-static void source_iface_init (SpSourceInterface *iface);
+static void source_iface_init (SysprofSourceInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpHostinfoSource, sp_hostinfo_source, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SOURCE, source_iface_init))
+G_DEFINE_TYPE_EXTENDED (SysprofHostinfoSource, sysprof_hostinfo_source, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
-SpSource *
-sp_hostinfo_source_new (void)
+SysprofSource *
+sysprof_hostinfo_source_new (void)
{
- return g_object_new (SP_TYPE_HOSTINFO_SOURCE, NULL);
+ return g_object_new (SYSPROF_TYPE_HOSTINFO_SOURCE, NULL);
}
static gboolean
-read_stat (SpHostinfoSource *self)
+read_stat (SysprofHostinfoSource *self)
{
gssize len;
@@ -97,7 +97,7 @@ read_stat (SpHostinfoSource *self)
}
static void
-poll_cpu (SpHostinfoSource *self)
+poll_cpu (SysprofHostinfoSource *self)
{
gchar cpu[64] = { 0 };
glong user;
@@ -195,9 +195,9 @@ poll_cpu (SpHostinfoSource *self)
}
static void
-publish_cpu (SpHostinfoSource *self)
+publish_cpu (SysprofHostinfoSource *self)
{
- SpCaptureCounterValue *counter_values;
+ SysprofCaptureCounterValue *counter_values;
guint *counter_ids;
counter_ids = alloca (sizeof *counter_ids * self->n_cpu * 2);
@@ -206,7 +206,7 @@ publish_cpu (SpHostinfoSource *self)
for (guint i = 0; i < self->n_cpu; i++)
{
CpuInfo *info = &g_array_index (self->cpu_info, CpuInfo, i);
- SpCaptureCounterValue *value = &counter_values[i*2];
+ SysprofCaptureCounterValue *value = &counter_values[i*2];
guint *id = &counter_ids[i*2];
*id = info->counter_base;
@@ -219,8 +219,8 @@ publish_cpu (SpHostinfoSource *self)
value->vdbl = info->freq;
}
- sp_capture_writer_set_counters (self->writer,
- SP_CAPTURE_CURRENT_TIME,
+ sysprof_capture_writer_set_counters (self->writer,
+ SYSPROF_CAPTURE_CURRENT_TIME,
-1,
getpid (),
counter_ids,
@@ -231,9 +231,9 @@ publish_cpu (SpHostinfoSource *self)
static gboolean
collect_hostinfo_cb (gpointer data)
{
- SpHostinfoSource *self = data;
+ SysprofHostinfoSource *self = data;
- g_assert (SP_IS_HOSTINFO_SOURCE (self));
+ g_assert (SYSPROF_IS_HOSTINFO_SOURCE (self));
poll_cpu (self);
publish_cpu (self);
@@ -242,9 +242,9 @@ collect_hostinfo_cb (gpointer data)
}
static void
-sp_hostinfo_source_finalize (GObject *object)
+sysprof_hostinfo_source_finalize (GObject *object)
{
- SpHostinfoSource *self = (SpHostinfoSource *)object;
+ SysprofHostinfoSource *self = (SysprofHostinfoSource *)object;
if (self->handler)
{
@@ -252,23 +252,23 @@ sp_hostinfo_source_finalize (GObject *object)
self->handler = 0;
}
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
g_clear_pointer (&self->cpu_info, g_array_unref);
g_clear_pointer (&self->stat_buf, g_free);
- G_OBJECT_CLASS (sp_hostinfo_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_hostinfo_source_parent_class)->finalize (object);
}
static void
-sp_hostinfo_source_class_init (SpHostinfoSourceClass *klass)
+sysprof_hostinfo_source_class_init (SysprofHostinfoSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_hostinfo_source_finalize;
+ object_class->finalize = sysprof_hostinfo_source_finalize;
}
static void
-sp_hostinfo_source_init (SpHostinfoSource *self)
+sysprof_hostinfo_source_init (SysprofHostinfoSource *self)
{
self->stat_fd = -1;
self->cpu_info = g_array_new (FALSE, TRUE, sizeof (CpuInfo));
@@ -276,35 +276,35 @@ sp_hostinfo_source_init (SpHostinfoSource *self)
}
static void
-sp_hostinfo_source_set_writer (SpSource *source,
- SpCaptureWriter *writer)
+sysprof_hostinfo_source_set_writer (SysprofSource *source,
+ SysprofCaptureWriter *writer)
{
- SpHostinfoSource *self = (SpHostinfoSource *)source;
+ SysprofHostinfoSource *self = (SysprofHostinfoSource *)source;
- g_assert (SP_IS_HOSTINFO_SOURCE (self));
+ g_assert (SYSPROF_IS_HOSTINFO_SOURCE (self));
g_assert (writer != NULL);
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
- self->writer = sp_capture_writer_ref (writer);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
+ self->writer = sysprof_capture_writer_ref (writer);
}
static void
-sp_hostinfo_source_start (SpSource *source)
+sysprof_hostinfo_source_start (SysprofSource *source)
{
- SpHostinfoSource *self = (SpHostinfoSource *)source;
+ SysprofHostinfoSource *self = (SysprofHostinfoSource *)source;
- g_assert (SP_IS_HOSTINFO_SOURCE (self));
+ g_assert (SYSPROF_IS_HOSTINFO_SOURCE (self));
/* 20 samples per second */
self->handler = g_timeout_add (1000/20, collect_hostinfo_cb, self);
}
static void
-sp_hostinfo_source_stop (SpSource *source)
+sysprof_hostinfo_source_stop (SysprofSource *source)
{
- SpHostinfoSource *self = (SpHostinfoSource *)source;
+ SysprofHostinfoSource *self = (SysprofHostinfoSource *)source;
- g_assert (SP_IS_HOSTINFO_SOURCE (self));
+ g_assert (SYSPROF_IS_HOSTINFO_SOURCE (self));
g_source_remove (self->handler);
self->handler = 0;
@@ -315,16 +315,16 @@ sp_hostinfo_source_stop (SpSource *source)
self->stat_fd = -1;
}
- sp_source_emit_finished (SP_SOURCE (self));
+ sysprof_source_emit_finished (SYSPROF_SOURCE (self));
}
static void
-sp_hostinfo_source_prepare (SpSource *source)
+sysprof_hostinfo_source_prepare (SysprofSource *source)
{
- SpHostinfoSource *self = (SpHostinfoSource *)source;
- SpCaptureCounter *counters;
+ SysprofHostinfoSource *self = (SysprofHostinfoSource *)source;
+ SysprofCaptureCounter *counters;
- g_assert (SP_IS_HOSTINFO_SOURCE (self));
+ g_assert (SYSPROF_IS_HOSTINFO_SOURCE (self));
self->stat_fd = open ("/proc/stat", O_RDONLY);
self->n_cpu = g_get_num_processors ();
@@ -335,20 +335,20 @@ sp_hostinfo_source_prepare (SpSource *source)
for (guint i = 0; i < self->n_cpu; i++)
{
- SpCaptureCounter *ctr = &counters[i*2];
+ SysprofCaptureCounter *ctr = &counters[i*2];
CpuInfo info = { 0 };
/*
* Request 2 counter values.
* One for CPU and one for Frequency.
*/
- info.counter_base = sp_capture_writer_request_counter (self->writer, 2);
+ info.counter_base = sysprof_capture_writer_request_counter (self->writer, 2);
/*
* Define counters for capture file.
*/
ctr->id = info.counter_base;
- ctr->type = SP_CAPTURE_COUNTER_DOUBLE;
+ ctr->type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
ctr->value.vdbl = 0;
g_strlcpy (ctr->category, "CPU Percent", sizeof ctr->category);
g_snprintf (ctr->name, sizeof ctr->name, "Total CPU %d", i);
@@ -358,7 +358,7 @@ sp_hostinfo_source_prepare (SpSource *source)
ctr++;
ctr->id = info.counter_base + 1;
- ctr->type = SP_CAPTURE_COUNTER_DOUBLE;
+ ctr->type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
ctr->value.vdbl = 0;
g_strlcpy (ctr->category, "CPU Frequency", sizeof ctr->category);
g_snprintf (ctr->name, sizeof ctr->name, "CPU %d", i);
@@ -368,21 +368,21 @@ sp_hostinfo_source_prepare (SpSource *source)
g_array_append_val (self->cpu_info, info);
}
- sp_capture_writer_define_counters (self->writer,
- SP_CAPTURE_CURRENT_TIME,
+ sysprof_capture_writer_define_counters (self->writer,
+ SYSPROF_CAPTURE_CURRENT_TIME,
-1,
getpid (),
counters,
self->n_cpu * 2);
- sp_source_emit_ready (SP_SOURCE (self));
+ sysprof_source_emit_ready (SYSPROF_SOURCE (self));
}
static void
-source_iface_init (SpSourceInterface *iface)
+source_iface_init (SysprofSourceInterface *iface)
{
- iface->set_writer = sp_hostinfo_source_set_writer;
- iface->prepare = sp_hostinfo_source_prepare;
- iface->start = sp_hostinfo_source_start;
- iface->stop = sp_hostinfo_source_stop;
+ iface->set_writer = sysprof_hostinfo_source_set_writer;
+ iface->prepare = sysprof_hostinfo_source_prepare;
+ iface->start = sysprof_hostinfo_source_start;
+ iface->stop = sysprof_hostinfo_source_stop;
}
diff --git a/src/libsysprof/sp-hostinfo-source.h b/src/libsysprof/sysprof-hostinfo-source.h
similarity index 75%
rename from src/libsysprof/sp-hostinfo-source.h
rename to src/libsysprof/sysprof-hostinfo-source.h
index b4468a4..220c4bd 100644
--- a/src/libsysprof/sp-hostinfo-source.h
+++ b/src/libsysprof/sysprof-hostinfo-source.h
@@ -1,4 +1,4 @@
-/* sp-hostinfo-source.h
+/* sysprof-hostinfo-source.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,16 +22,16 @@
#include "sysprof-version-macros.h"
-#include "sp-source.h"
+#include "sysprof-source.h"
G_BEGIN_DECLS
-#define SP_TYPE_HOSTINFO_SOURCE (sp_hostinfo_source_get_type())
+#define SYSPROF_TYPE_HOSTINFO_SOURCE (sysprof_hostinfo_source_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpHostinfoSource, sp_hostinfo_source, SP, HOSTINFO_SOURCE, GObject)
+G_DECLARE_FINAL_TYPE (SysprofHostinfoSource, sysprof_hostinfo_source, SYSPROF, HOSTINFO_SOURCE, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpSource *sp_hostinfo_source_new (void);
+SysprofSource *sysprof_hostinfo_source_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sysprof-jitmap-symbol-resolver.c b/src/libsysprof/sysprof-jitmap-symbol-resolver.c
new file mode 100644
index 0000000..9c41eca
--- /dev/null
+++ b/src/libsysprof/sysprof-jitmap-symbol-resolver.c
@@ -0,0 +1,125 @@
+/* sysprof-jitmap-symbol-resolver.c
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "config.h"
+
+#include "sysprof-kernel-symbol.h"
+#include "sysprof-jitmap-symbol-resolver.h"
+
+struct _SysprofJitmapSymbolResolver
+{
+ GObject parent_instance;
+ GHashTable *jitmap;
+};
+
+static void symbol_resolver_iface_init (SysprofSymbolResolverInterface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SysprofJitmapSymbolResolver,
+ sysprof_jitmap_symbol_resolver,
+ G_TYPE_OBJECT,
+ 0,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SYMBOL_RESOLVER,
+ symbol_resolver_iface_init))
+
+static void
+sysprof_jitmap_symbol_resolver_finalize (GObject *object)
+{
+ SysprofJitmapSymbolResolver *self = (SysprofJitmapSymbolResolver *)object;
+
+ g_clear_pointer (&self->jitmap, g_hash_table_unref);
+
+ G_OBJECT_CLASS (sysprof_jitmap_symbol_resolver_parent_class)->finalize (object);
+}
+
+static void
+sysprof_jitmap_symbol_resolver_class_init (SysprofJitmapSymbolResolverClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = sysprof_jitmap_symbol_resolver_finalize;
+}
+
+static void
+sysprof_jitmap_symbol_resolver_init (SysprofJitmapSymbolResolver *self)
+{
+ self->jitmap = g_hash_table_new_full (NULL, NULL, NULL, g_free);
+}
+
+static void
+sysprof_jitmap_symbol_resolver_load (SysprofSymbolResolver *resolver,
+ SysprofCaptureReader *reader)
+{
+ SysprofJitmapSymbolResolver *self = (SysprofJitmapSymbolResolver *)resolver;
+ SysprofCaptureFrameType type;
+
+ g_assert (SYSPROF_IS_JITMAP_SYMBOL_RESOLVER (self));
+ g_assert (reader != NULL);
+
+ while (sysprof_capture_reader_peek_type (reader, &type))
+ {
+ g_autoptr(GHashTable) jitmap = NULL;
+ GHashTableIter iter;
+ SysprofCaptureAddress addr;
+ const gchar *str;
+
+ if (type != SYSPROF_CAPTURE_FRAME_JITMAP)
+ {
+ if (!sysprof_capture_reader_skip (reader))
+ return;
+ continue;
+ }
+
+ if (!(jitmap = sysprof_capture_reader_read_jitmap (reader)))
+ return;
+
+ g_hash_table_iter_init (&iter, jitmap);
+ while (g_hash_table_iter_next (&iter, (gpointer *)&addr, (gpointer *)&str))
+ g_hash_table_insert (self->jitmap, GSIZE_TO_POINTER (addr), g_strdup (str));
+ }
+}
+
+static gchar *
+sysprof_jitmap_symbol_resolver_resolve (SysprofSymbolResolver *resolver,
+ guint64 time,
+ GPid pid,
+ SysprofCaptureAddress address,
+ GQuark *tag)
+{
+ SysprofJitmapSymbolResolver *self = (SysprofJitmapSymbolResolver *)resolver;
+
+ g_assert (SYSPROF_IS_JITMAP_SYMBOL_RESOLVER (self));
+
+ *tag = 0;
+
+ return g_strdup (g_hash_table_lookup (self->jitmap, GSIZE_TO_POINTER (address)));
+}
+
+static void
+symbol_resolver_iface_init (SysprofSymbolResolverInterface *iface)
+{
+ iface->load = sysprof_jitmap_symbol_resolver_load;
+ iface->resolve = sysprof_jitmap_symbol_resolver_resolve;
+}
+
+SysprofSymbolResolver *
+sysprof_jitmap_symbol_resolver_new (void)
+{
+ return g_object_new (SYSPROF_TYPE_JITMAP_SYMBOL_RESOLVER, NULL);
+}
diff --git a/src/libsysprof/sp-jitmap-symbol-resolver.h b/src/libsysprof/sysprof-jitmap-symbol-resolver.h
similarity index 69%
rename from src/libsysprof/sp-jitmap-symbol-resolver.h
rename to src/libsysprof/sysprof-jitmap-symbol-resolver.h
index e1c6abd..ad97e0a 100644
--- a/src/libsysprof/sp-jitmap-symbol-resolver.h
+++ b/src/libsysprof/sysprof-jitmap-symbol-resolver.h
@@ -1,4 +1,4 @@
-/* sp-jitmap-symbol-resolver.h
+/* sysprof-jitmap-symbol-resolver.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,14 +20,14 @@
#pragma once
-#include "sp-symbol-resolver.h"
+#include "sysprof-symbol-resolver.h"
G_BEGIN_DECLS
-#define SP_TYPE_JITMAP_SYMBOL_RESOLVER (sp_jitmap_symbol_resolver_get_type())
+#define SYSPROF_TYPE_JITMAP_SYMBOL_RESOLVER (sysprof_jitmap_symbol_resolver_get_type())
-G_DECLARE_FINAL_TYPE (SpJitmapSymbolResolver, sp_jitmap_symbol_resolver, SP, JITMAP_SYMBOL_RESOLVER, GObject)
+G_DECLARE_FINAL_TYPE (SysprofJitmapSymbolResolver, sysprof_jitmap_symbol_resolver, SYSPROF,
JITMAP_SYMBOL_RESOLVER, GObject)
-SpSymbolResolver *sp_jitmap_symbol_resolver_new (void);
+SysprofSymbolResolver *sysprof_jitmap_symbol_resolver_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-kallsyms.c b/src/libsysprof/sysprof-kallsyms.c
similarity index 88%
rename from src/libsysprof/sp-kallsyms.c
rename to src/libsysprof/sysprof-kallsyms.c
index c8a0e05..c6080c5 100644
--- a/src/libsysprof/sp-kallsyms.c
+++ b/src/libsysprof/sysprof-kallsyms.c
@@ -1,4 +1,4 @@
-/* sp-kallsyms.c
+/* sysprof-kallsyms.c
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-kallsyms"
+#define G_LOG_DOMAIN "sysprof-kallsyms"
#include "config.h"
@@ -30,9 +30,9 @@
#include <string.h>
#include <stdio.h>
-#include "sp-kallsyms.h"
+#include "sysprof-kallsyms.h"
-struct _SpKallsyms
+struct _SysprofKallsyms
{
gchar *buf;
gsize buflen;
@@ -41,24 +41,24 @@ struct _SpKallsyms
};
void
-sp_kallsyms_free (SpKallsyms *self)
+sysprof_kallsyms_free (SysprofKallsyms *self)
{
if (self != NULL)
{
g_clear_pointer (&self->buf, g_free);
- g_slice_free (SpKallsyms, self);
+ g_slice_free (SysprofKallsyms, self);
}
}
-SpKallsyms *
-sp_kallsyms_new (const gchar *path)
+SysprofKallsyms *
+sysprof_kallsyms_new (const gchar *path)
{
- g_autoptr(SpKallsyms) self = NULL;
+ g_autoptr(SysprofKallsyms) self = NULL;
if (path == NULL)
path = "/proc/kallsyms";
- self = g_slice_new0 (SpKallsyms);
+ self = g_slice_new0 (SysprofKallsyms);
if (!g_file_get_contents (path, &self->buf, &self->buflen, NULL))
return NULL;
@@ -70,7 +70,7 @@ sp_kallsyms_new (const gchar *path)
}
gboolean
-sp_kallsyms_next (SpKallsyms *self,
+sysprof_kallsyms_next (SysprofKallsyms *self,
const gchar **name,
guint64 *address,
guint8 *type)
diff --git a/src/libsysprof/sp-kallsyms.h b/src/libsysprof/sysprof-kallsyms.h
similarity index 76%
rename from src/libsysprof/sp-kallsyms.h
rename to src/libsysprof/sysprof-kallsyms.h
index 2357d0b..99d33da 100644
--- a/src/libsysprof/sp-kallsyms.h
+++ b/src/libsysprof/sysprof-kallsyms.h
@@ -1,4 +1,4 @@
-/* sp-kallsyms.h
+/* sysprof-kallsyms.h
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -24,18 +24,18 @@
G_BEGIN_DECLS
-typedef struct _SpKallsyms SpKallsyms;
+typedef struct _SysprofKallsyms SysprofKallsyms;
SYSPROF_AVAILABLE_IN_ALL
-SpKallsyms *sp_kallsyms_new (const gchar *path);
+SysprofKallsyms *sysprof_kallsyms_new (const gchar *path);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_kallsyms_next (SpKallsyms *self,
+gboolean sysprof_kallsyms_next (SysprofKallsyms *self,
const gchar **name,
guint64 *address,
guint8 *type);
SYSPROF_AVAILABLE_IN_ALL
-void sp_kallsyms_free (SpKallsyms *self);
+void sysprof_kallsyms_free (SysprofKallsyms *self);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpKallsyms, sp_kallsyms_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofKallsyms, sysprof_kallsyms_free)
G_END_DECLS
diff --git a/src/libsysprof/sp-kernel-symbol-resolver.c b/src/libsysprof/sysprof-kernel-symbol-resolver.c
similarity index 54%
rename from src/libsysprof/sp-kernel-symbol-resolver.c
rename to src/libsysprof/sysprof-kernel-symbol-resolver.c
index 672ade1..0b109e7 100644
--- a/src/libsysprof/sp-kernel-symbol-resolver.c
+++ b/src/libsysprof/sysprof-kernel-symbol-resolver.c
@@ -1,4 +1,4 @@
-/* sp-kernel-symbol-resolver.c
+/* sysprof-kernel-symbol-resolver.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,10 +20,10 @@
#include "config.h"
-#include "sp-kernel-symbol.h"
-#include "sp-kernel-symbol-resolver.h"
+#include "sysprof-kernel-symbol.h"
+#include "sysprof-kernel-symbol-resolver.h"
-struct _SpKernelSymbolResolver
+struct _SysprofKernelSymbolResolver
{
GObject parent_instance;
};
@@ -31,21 +31,21 @@ struct _SpKernelSymbolResolver
static GQuark linux_quark;
static gchar *
-sp_kernel_symbol_resolver_resolve_with_context (SpSymbolResolver *resolver,
+sysprof_kernel_symbol_resolver_resolve_with_context (SysprofSymbolResolver *resolver,
guint64 time,
GPid pid,
- SpAddressContext context,
- SpCaptureAddress address,
+ SysprofAddressContext context,
+ SysprofCaptureAddress address,
GQuark *tag)
{
- const SpKernelSymbol *sym;
+ const SysprofKernelSymbol *sym;
- g_assert (SP_IS_SYMBOL_RESOLVER (resolver));
+ g_assert (SYSPROF_IS_SYMBOL_RESOLVER (resolver));
- if (context != SP_ADDRESS_CONTEXT_KERNEL)
+ if (context != SYSPROF_ADDRESS_CONTEXT_KERNEL)
return NULL;
- sym = sp_kernel_symbol_from_address (address);
+ sym = sysprof_kernel_symbol_from_address (address);
if (sym != NULL)
{
@@ -57,30 +57,30 @@ sp_kernel_symbol_resolver_resolve_with_context (SpSymbolResolver *resolver,
}
static void
-symbol_resolver_iface_init (SpSymbolResolverInterface *iface)
+symbol_resolver_iface_init (SysprofSymbolResolverInterface *iface)
{
- iface->resolve_with_context = sp_kernel_symbol_resolver_resolve_with_context;
+ iface->resolve_with_context = sysprof_kernel_symbol_resolver_resolve_with_context;
}
-G_DEFINE_TYPE_WITH_CODE (SpKernelSymbolResolver,
- sp_kernel_symbol_resolver,
+G_DEFINE_TYPE_WITH_CODE (SysprofKernelSymbolResolver,
+ sysprof_kernel_symbol_resolver,
G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SYMBOL_RESOLVER,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SYMBOL_RESOLVER,
symbol_resolver_iface_init))
static void
-sp_kernel_symbol_resolver_class_init (SpKernelSymbolResolverClass *klass)
+sysprof_kernel_symbol_resolver_class_init (SysprofKernelSymbolResolverClass *klass)
{
linux_quark = g_quark_from_static_string ("Kernel");
}
static void
-sp_kernel_symbol_resolver_init (SpKernelSymbolResolver *skernel)
+sysprof_kernel_symbol_resolver_init (SysprofKernelSymbolResolver *skernel)
{
}
-SpSymbolResolver *
-sp_kernel_symbol_resolver_new (void)
+SysprofSymbolResolver *
+sysprof_kernel_symbol_resolver_new (void)
{
- return g_object_new (SP_TYPE_KERNEL_SYMBOL_RESOLVER, NULL);
+ return g_object_new (SYSPROF_TYPE_KERNEL_SYMBOL_RESOLVER, NULL);
}
diff --git a/src/libsysprof/sp-kernel-symbol-resolver.h b/src/libsysprof/sysprof-kernel-symbol-resolver.h
similarity index 69%
rename from src/libsysprof/sp-kernel-symbol-resolver.h
rename to src/libsysprof/sysprof-kernel-symbol-resolver.h
index b9d722b..3761d91 100644
--- a/src/libsysprof/sp-kernel-symbol-resolver.h
+++ b/src/libsysprof/sysprof-kernel-symbol-resolver.h
@@ -1,4 +1,4 @@
-/* sp-kernel-symbol-resolver.h
+/* sysprof-kernel-symbol-resolver.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,14 +20,14 @@
#pragma once
-#include "sp-symbol-resolver.h"
+#include "sysprof-symbol-resolver.h"
G_BEGIN_DECLS
-#define SP_TYPE_KERNEL_SYMBOL_RESOLVER (sp_kernel_symbol_resolver_get_type())
+#define SYSPROF_TYPE_KERNEL_SYMBOL_RESOLVER (sysprof_kernel_symbol_resolver_get_type())
-G_DECLARE_FINAL_TYPE (SpKernelSymbolResolver, sp_kernel_symbol_resolver, SP, KERNEL_SYMBOL_RESOLVER, GObject)
+G_DECLARE_FINAL_TYPE (SysprofKernelSymbolResolver, sysprof_kernel_symbol_resolver, SYSPROF,
KERNEL_SYMBOL_RESOLVER, GObject)
-SpSymbolResolver *sp_kernel_symbol_resolver_new (void);
+SysprofSymbolResolver *sysprof_kernel_symbol_resolver_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-kernel-symbol.c b/src/libsysprof/sysprof-kernel-symbol.c
similarity index 79%
rename from src/libsysprof/sp-kernel-symbol.c
rename to src/libsysprof/sysprof-kernel-symbol.c
index ee780a3..eed8e8f 100644
--- a/src/libsysprof/sp-kernel-symbol.c
+++ b/src/libsysprof/sysprof-kernel-symbol.c
@@ -1,4 +1,4 @@
-/* sp-kernel-symbol.c
+/* sysprof-kernel-symbol.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-kernel-symbol"
+#define G_LOG_DOMAIN "sysprof-kernel-symbol"
#include "config.h"
@@ -28,8 +28,8 @@
#endif
#include <sysprof-capture.h>
-#include "sp-kallsyms.h"
-#include "sp-kernel-symbol.h"
+#include "sysprof-kallsyms.h"
+#include "sysprof-kernel-symbol.h"
static GArray *kernel_symbols;
static GStringChunk *kernel_symbol_strs;
@@ -68,11 +68,11 @@ static const gchar *kernel_symbols_skip[] = {
};
static gint
-sp_kernel_symbol_compare (gconstpointer a,
+sysprof_kernel_symbol_compare (gconstpointer a,
gconstpointer b)
{
- const SpKernelSymbol *syma = a;
- const SpKernelSymbol *symb = b;
+ const SysprofKernelSymbol *syma = a;
+ const SysprofKernelSymbol *symb = b;
if (syma->address > symb->address)
return 1;
@@ -125,7 +125,7 @@ failure:
}
static gboolean
-sp_kernel_symbol_load_from_sysprofd (void)
+sysprof_kernel_symbol_load_from_sysprofd (void)
{
g_autoptr(GDBusConnection) conn = NULL;
g_autoptr(GVariant) ret = NULL;
@@ -164,13 +164,13 @@ sp_kernel_symbol_load_from_sysprofd (void)
return FALSE;
}
- ar = g_array_new (FALSE, TRUE, sizeof (SpKernelSymbol));
+ ar = g_array_new (FALSE, TRUE, sizeof (SysprofKernelSymbol));
results = g_variant_get_child_value (ret, 0);
g_variant_iter_init (&iter, results);
while (g_variant_iter_loop (&iter, "(ty&s)", &addr, &type, &name))
{
- SpKernelSymbol sym;
+ SysprofKernelSymbol sym;
if (type_is_ignored (type))
continue;
@@ -181,12 +181,12 @@ sp_kernel_symbol_load_from_sysprofd (void)
g_array_append_val (ar, sym);
}
- g_array_sort (ar, sp_kernel_symbol_compare);
+ g_array_sort (ar, sysprof_kernel_symbol_compare);
#if 0
g_print ("First: 0x%lx Last: 0x%lx\n",
- g_array_index (ar, SpKernelSymbol, 0).address,
- g_array_index (ar, SpKernelSymbol, ar->len - 1).address);
+ g_array_index (ar, SysprofKernelSymbol, 0).address,
+ g_array_index (ar, SysprofKernelSymbol, ar->len - 1).address);
#endif
kernel_symbols = g_steal_pointer (&ar);
@@ -195,10 +195,10 @@ sp_kernel_symbol_load_from_sysprofd (void)
}
static gboolean
-sp_kernel_symbol_load (void)
+sysprof_kernel_symbol_load (void)
{
g_autoptr(GHashTable) skip = NULL;
- g_autoptr(SpKallsyms) kallsyms = NULL;
+ g_autoptr(SysprofKallsyms) kallsyms = NULL;
g_autoptr(GArray) ar = NULL;
const gchar *name;
guint64 addr;
@@ -210,14 +210,14 @@ sp_kernel_symbol_load (void)
kernel_symbols_skip_hash = g_steal_pointer (&skip);
kernel_symbol_strs = g_string_chunk_new (4096);
- ar = g_array_new (FALSE, TRUE, sizeof (SpKernelSymbol));
+ ar = g_array_new (FALSE, TRUE, sizeof (SysprofKernelSymbol));
- if (!(kallsyms = sp_kallsyms_new (NULL)))
+ if (!(kallsyms = sysprof_kallsyms_new (NULL)))
goto query_daemon;
- while (sp_kallsyms_next (kallsyms, &name, &addr, &type))
+ while (sysprof_kallsyms_next (kallsyms, &name, &addr, &type))
{
- SpKernelSymbol sym;
+ SysprofKernelSymbol sym;
if (type_is_ignored (type))
continue;
@@ -231,13 +231,13 @@ sp_kernel_symbol_load (void)
if (ar->len == 0)
goto query_daemon;
- g_array_sort (ar, sp_kernel_symbol_compare);
+ g_array_sort (ar, sysprof_kernel_symbol_compare);
kernel_symbols = g_steal_pointer (&ar);
return TRUE;
query_daemon:
- if (sp_kernel_symbol_load_from_sysprofd ())
+ if (sysprof_kernel_symbol_load_from_sysprofd ())
return TRUE;
g_warning ("Kernel symbols will not be available.");
@@ -245,9 +245,9 @@ query_daemon:
return FALSE;
}
-static const SpKernelSymbol *
-sp_kernel_symbol_lookup (SpKernelSymbol *symbols,
- SpCaptureAddress address,
+static const SysprofKernelSymbol *
+sysprof_kernel_symbol_lookup (SysprofKernelSymbol *symbols,
+ SysprofCaptureAddress address,
guint first,
guint last)
{
@@ -272,25 +272,25 @@ sp_kernel_symbol_lookup (SpKernelSymbol *symbols,
int mid = (first + last) / 2;
if (symbols [mid].address > address)
- return sp_kernel_symbol_lookup (symbols, address, first, mid);
+ return sysprof_kernel_symbol_lookup (symbols, address, first, mid);
else
- return sp_kernel_symbol_lookup (symbols, address, mid, last);
+ return sysprof_kernel_symbol_lookup (symbols, address, mid, last);
}
}
/**
- * sp_kernel_symbol_from_address:
+ * sysprof_kernel_symbol_from_address:
* @address: the address of the instruction pointer
*
* Locates the kernel symbol that contains @address.
*
- * Returns: (transfer none): An #SpKernelSymbol or %NULL.
+ * Returns: (transfer none): An #SysprofKernelSymbol or %NULL.
*/
-const SpKernelSymbol *
-sp_kernel_symbol_from_address (SpCaptureAddress address)
+const SysprofKernelSymbol *
+sysprof_kernel_symbol_from_address (SysprofCaptureAddress address)
{
- const SpKernelSymbol *first;
- const SpKernelSymbol *ret;
+ const SysprofKernelSymbol *first;
+ const SysprofKernelSymbol *ret;
if G_UNLIKELY (kernel_symbols == NULL)
{
@@ -299,7 +299,7 @@ sp_kernel_symbol_from_address (SpCaptureAddress address)
if (failed)
return NULL;
- if (!sp_kernel_symbol_load ())
+ if (!sysprof_kernel_symbol_load ())
{
failed = TRUE;
return NULL;
@@ -310,11 +310,11 @@ sp_kernel_symbol_from_address (SpCaptureAddress address)
g_assert (kernel_symbols->len > 0);
/* Short circuit if this is out of range */
- first = &g_array_index (kernel_symbols, SpKernelSymbol, 0);
+ first = &g_array_index (kernel_symbols, SysprofKernelSymbol, 0);
if (address < first->address)
return NULL;
- ret = sp_kernel_symbol_lookup ((SpKernelSymbol *)(gpointer)kernel_symbols->data,
+ ret = sysprof_kernel_symbol_lookup ((SysprofKernelSymbol *)(gpointer)kernel_symbols->data,
address,
0,
kernel_symbols->len - 1);
diff --git a/src/libsysprof/sp-kernel-symbol.h b/src/libsysprof/sysprof-kernel-symbol.h
similarity index 79%
rename from src/libsysprof/sp-kernel-symbol.h
rename to src/libsysprof/sysprof-kernel-symbol.h
index 5e83f2c..67359a6 100644
--- a/src/libsysprof/sp-kernel-symbol.h
+++ b/src/libsysprof/sysprof-kernel-symbol.h
@@ -1,4 +1,4 @@
-/* sp-kernel-symbol.h
+/* sysprof-kernel-symbol.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,16 +20,16 @@
#pragma once
-#include "sp-capture-types.h"
+#include "sysprof-capture-types.h"
G_BEGIN_DECLS
typedef struct
{
- SpCaptureAddress address;
+ SysprofCaptureAddress address;
const gchar *name;
-} SpKernelSymbol;
+} SysprofKernelSymbol;
-const SpKernelSymbol *sp_kernel_symbol_from_address (SpCaptureAddress address);
+const SysprofKernelSymbol *sysprof_kernel_symbol_from_address (SysprofCaptureAddress address);
G_END_DECLS
diff --git a/src/libsysprof/sp-line-reader.c b/src/libsysprof/sysprof-line-reader.c
similarity index 75%
rename from src/libsysprof/sp-line-reader.c
rename to src/libsysprof/sysprof-line-reader.c
index f39885f..0f10b55 100644
--- a/src/libsysprof/sp-line-reader.c
+++ b/src/libsysprof/sysprof-line-reader.c
@@ -1,4 +1,4 @@
-/* sp-line-reader.c
+/* sysprof-line-reader.c
*
* Copyright 2015-2019 Christian Hergert <christian hergert me>
*
@@ -22,9 +22,9 @@
#include <string.h>
-#include "sp-line-reader.h"
+#include "sysprof-line-reader.h"
-struct _SpLineReader
+struct _SysprofLineReader
{
const gchar *contents;
gsize length;
@@ -32,30 +32,30 @@ struct _SpLineReader
};
void
-sp_line_reader_free (SpLineReader *self)
+sysprof_line_reader_free (SysprofLineReader *self)
{
- g_slice_free (SpLineReader, self);
+ g_slice_free (SysprofLineReader, self);
}
/**
- * sp_line_reader_new:
+ * sysprof_line_reader_new:
* @contents: The buffer to read lines from
* @length: the length of @buffer in bytes
*
- * Creates a new #SpLineReader for the contents provided. @contents are not
+ * Creates a new #SysprofLineReader for the contents provided. @contents are not
* copied and therefore it is a programming error to free contents before
- * freeing the #SpLineReader structure.
+ * freeing the #SysprofLineReader structure.
*
- * Use sp_line_reader_next() to read through the lines of the buffer.
+ * Use sysprof_line_reader_next() to read through the lines of the buffer.
*
- * Returns: (transfer full): A new #SpLineReader that should be freed with
- * sp_line_reader_free() when no longer in use.
+ * Returns: (transfer full): A new #SysprofLineReader that should be freed with
+ * sysprof_line_reader_free() when no longer in use.
*/
-SpLineReader *
-sp_line_reader_new (const gchar *contents,
+SysprofLineReader *
+sysprof_line_reader_new (const gchar *contents,
gssize length)
{
- SpLineReader *self = g_slice_new (SpLineReader);
+ SysprofLineReader *self = g_slice_new (SysprofLineReader);
if (contents == NULL)
{
@@ -75,13 +75,13 @@ sp_line_reader_new (const gchar *contents,
}
/**
- * sp_line_reader_next:
- * @self: the #SpLineReader
+ * sysprof_line_reader_next:
+ * @self: the #SysprofLineReader
* @length: a location for the length of the line in bytes
*
* Moves forward to the beginning of the next line in the buffer. No changes to
* the buffer are made, and the result is a pointer within the string passed as
- * @contents in sp_line_reader_init(). Since the line most likely will not be
+ * @contents in sysprof_line_reader_init(). Since the line most likely will not be
* terminated with a NULL byte, you must provide @length to determine the
* length of the line.
*
@@ -94,7 +94,7 @@ sp_line_reader_new (const gchar *contents,
* Returns: (nullable) (transfer none): The beginning of the line within the buffer
*/
const gchar *
-sp_line_reader_next (SpLineReader *self,
+sysprof_line_reader_next (SysprofLineReader *self,
gsize *length)
{
const gchar *ret;
diff --git a/src/libsysprof/sp-line-reader.h b/src/libsysprof/sysprof-line-reader.h
similarity index 73%
rename from src/libsysprof/sp-line-reader.h
rename to src/libsysprof/sysprof-line-reader.h
index 9fa02c2..ab632f9 100644
--- a/src/libsysprof/sp-line-reader.h
+++ b/src/libsysprof/sysprof-line-reader.h
@@ -1,4 +1,4 @@
-/* sp-line-reader.h
+/* sysprof-line-reader.h
*
* Copyright 2015-2019 Christian Hergert <christian hergert me>
*
@@ -24,17 +24,17 @@
G_BEGIN_DECLS
-typedef struct _SpLineReader SpLineReader;
+typedef struct _SysprofLineReader SysprofLineReader;
G_GNUC_INTERNAL
-SpLineReader *sp_line_reader_new (const gchar *contents,
+SysprofLineReader *sysprof_line_reader_new (const gchar *contents,
gssize length);
G_GNUC_INTERNAL
-void sp_line_reader_free (SpLineReader *self);
+void sysprof_line_reader_free (SysprofLineReader *self);
G_GNUC_INTERNAL
-const gchar *sp_line_reader_next (SpLineReader *self,
+const gchar *sysprof_line_reader_next (SysprofLineReader *self,
gsize *length);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpLineReader, sp_line_reader_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofLineReader, sysprof_line_reader_free)
G_END_DECLS
diff --git a/src/libsysprof/sp-local-profiler.c b/src/libsysprof/sysprof-local-profiler.c
similarity index 60%
rename from src/libsysprof/sp-local-profiler.c
rename to src/libsysprof/sysprof-local-profiler.c
index f0460d0..324bb4d 100644
--- a/src/libsysprof/sp-local-profiler.c
+++ b/src/libsysprof/sysprof-local-profiler.c
@@ -1,4 +1,4 @@
-/* sp-local-profiler.c
+/* sysprof-local-profiler.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -25,12 +25,12 @@
#include <errno.h>
#include <unistd.h>
-#include "sp-local-profiler.h"
-#include "sp-platform.h"
+#include "sysprof-local-profiler.h"
+#include "sysprof-platform.h"
typedef struct
{
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
/* All sources added */
GPtrArray *sources;
@@ -85,13 +85,13 @@ typedef struct
* We do this to avoid a more complex state machine (for now).
*/
guint stop_after_starting : 1;
-} SpLocalProfilerPrivate;
+} SysprofLocalProfilerPrivate;
-static void profiler_iface_init (SpProfilerInterface *iface);
+static void profiler_iface_init (SysprofProfilerInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpLocalProfiler, sp_local_profiler, G_TYPE_OBJECT, 0,
- G_ADD_PRIVATE (SpLocalProfiler)
- G_IMPLEMENT_INTERFACE (SP_TYPE_PROFILER, profiler_iface_init))
+G_DEFINE_TYPE_EXTENDED (SysprofLocalProfiler, sysprof_local_profiler, G_TYPE_OBJECT, 0,
+ G_ADD_PRIVATE (SysprofLocalProfiler)
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_PROFILER, profiler_iface_init))
enum {
PROP_0,
@@ -130,11 +130,11 @@ _g_ptr_array_contains (GPtrArray *ar,
}
static void
-sp_local_profiler_clear_timer (SpLocalProfiler *self)
+sysprof_local_profiler_clear_timer (SysprofLocalProfiler *self)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_assert (SP_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
g_clear_pointer (&priv->timer, g_timer_destroy);
@@ -146,21 +146,21 @@ sp_local_profiler_clear_timer (SpLocalProfiler *self)
}
static void
-sp_local_profiler_real_stopped (SpProfiler *profiler)
+sysprof_local_profiler_real_stopped (SysprofProfiler *profiler)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
- g_assert (SP_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
- sp_local_profiler_clear_timer (self);
+ sysprof_local_profiler_clear_timer (self);
}
static gboolean
-sp_local_profiler_notify_elapsed_cb (gpointer data)
+sysprof_local_profiler_notify_elapsed_cb (gpointer data)
{
- SpLocalProfiler *self = data;
+ SysprofLocalProfiler *self = data;
- g_assert (SP_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
g_object_notify (G_OBJECT (self), "elapsed");
@@ -168,11 +168,11 @@ sp_local_profiler_notify_elapsed_cb (gpointer data)
}
static void
-sp_local_profiler_finish_stopping (SpLocalProfiler *self)
+sysprof_local_profiler_finish_stopping (SysprofLocalProfiler *self)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_assert (SP_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
g_assert (priv->is_starting == FALSE);
g_assert (priv->is_stopping == TRUE);
g_assert (priv->stopping->len == 0);
@@ -181,26 +181,26 @@ sp_local_profiler_finish_stopping (SpLocalProfiler *self)
{
const GError *error = g_ptr_array_index (priv->failures, 0);
- sp_profiler_emit_failed (SP_PROFILER (self), error);
+ sysprof_profiler_emit_failed (SYSPROF_PROFILER (self), error);
}
priv->is_running = FALSE;
priv->is_stopping = FALSE;
- sp_profiler_emit_stopped (SP_PROFILER (self));
+ sysprof_profiler_emit_stopped (SYSPROF_PROFILER (self));
g_object_notify (G_OBJECT (self), "is-mutable");
g_object_notify (G_OBJECT (self), "is-running");
}
static void
-sp_local_profiler_stop (SpProfiler *profiler)
+sysprof_local_profiler_stop (SysprofProfiler *profiler)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
guint i;
- g_return_if_fail (SP_IS_LOCAL_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
if (priv->is_starting)
{
@@ -217,13 +217,13 @@ sp_local_profiler_stop (SpProfiler *profiler)
* First we add everything to the stopping list, so that we can
* be notified of when they have completed. If everything stopped
* synchronously, the stopping list will be empty after calling
- * sp_source_stop() for every source. Otherwise, we need to delay
+ * sysprof_source_stop() for every source. Otherwise, we need to delay
* stopping for a little bit.
*/
for (i = 0; i < priv->sources->len; i++)
{
- SpSource *source = g_ptr_array_index (priv->sources, i);
+ SysprofSource *source = g_ptr_array_index (priv->sources, i);
if (!_g_ptr_array_contains (priv->finished_or_failed, source))
g_ptr_array_add (priv->stopping, g_object_ref (source));
@@ -231,40 +231,40 @@ sp_local_profiler_stop (SpProfiler *profiler)
for (i = 0; i < priv->sources->len; i++)
{
- SpSource *source = g_ptr_array_index (priv->sources, i);
+ SysprofSource *source = g_ptr_array_index (priv->sources, i);
- sp_source_stop (source);
+ sysprof_source_stop (source);
}
if (priv->is_stopping && priv->stopping->len == 0)
- sp_local_profiler_finish_stopping (self);
+ sysprof_local_profiler_finish_stopping (self);
}
static void
-sp_local_profiler_dispose (GObject *object)
+sysprof_local_profiler_dispose (GObject *object)
{
- SpLocalProfiler *self = (SpLocalProfiler *)object;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)object;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
if (priv->is_running || priv->is_starting)
{
- sp_local_profiler_stop (SP_PROFILER (self));
+ sysprof_local_profiler_stop (SYSPROF_PROFILER (self));
return;
}
- sp_local_profiler_clear_timer (self);
+ sysprof_local_profiler_clear_timer (self);
- G_OBJECT_CLASS (sp_local_profiler_parent_class)->dispose (object);
+ G_OBJECT_CLASS (sysprof_local_profiler_parent_class)->dispose (object);
}
static void
-sp_local_profiler_finalize (GObject *object)
+sysprof_local_profiler_finalize (GObject *object)
{
- SpLocalProfiler *self = (SpLocalProfiler *)object;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)object;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_clear_pointer (&priv->writer, sp_capture_writer_unref);
+ g_clear_pointer (&priv->writer, sysprof_capture_writer_unref);
g_clear_pointer (&priv->sources, g_ptr_array_unref);
g_clear_pointer (&priv->starting, g_ptr_array_unref);
g_clear_pointer (&priv->stopping, g_ptr_array_unref);
@@ -272,17 +272,17 @@ sp_local_profiler_finalize (GObject *object)
g_clear_pointer (&priv->finished_or_failed, g_ptr_array_unref);
g_clear_pointer (&priv->pids, g_array_unref);
- G_OBJECT_CLASS (sp_local_profiler_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_local_profiler_parent_class)->finalize (object);
}
static void
-sp_local_profiler_get_property (GObject *object,
+sysprof_local_profiler_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpLocalProfiler *self = SP_LOCAL_PROFILER (object);
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = SYSPROF_LOCAL_PROFILER (object);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
switch (prop_id)
{
@@ -324,13 +324,13 @@ sp_local_profiler_get_property (GObject *object,
}
static void
-sp_local_profiler_set_property (GObject *object,
+sysprof_local_profiler_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpLocalProfiler *self = SP_LOCAL_PROFILER (object);
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = SYSPROF_LOCAL_PROFILER (object);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
switch (prop_id)
{
@@ -362,14 +362,14 @@ sp_local_profiler_set_property (GObject *object,
}
static void
-sp_local_profiler_class_init (SpLocalProfilerClass *klass)
+sysprof_local_profiler_class_init (SysprofLocalProfilerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = sp_local_profiler_dispose;
- object_class->finalize = sp_local_profiler_finalize;
- object_class->get_property = sp_local_profiler_get_property;
- object_class->set_property = sp_local_profiler_set_property;
+ object_class->dispose = sysprof_local_profiler_dispose;
+ object_class->finalize = sysprof_local_profiler_finalize;
+ object_class->get_property = sysprof_local_profiler_get_property;
+ object_class->set_property = sysprof_local_profiler_set_property;
g_object_class_override_property (object_class, PROP_ELAPSED, "elapsed");
g_object_class_override_property (object_class, PROP_IS_MUTABLE, "is-mutable");
@@ -382,9 +382,9 @@ sp_local_profiler_class_init (SpLocalProfilerClass *klass)
}
static void
-sp_local_profiler_init (SpLocalProfiler *self)
+sysprof_local_profiler_init (SysprofLocalProfiler *self)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
priv->whole_system = TRUE;
@@ -396,23 +396,23 @@ sp_local_profiler_init (SpLocalProfiler *self)
priv->pids = g_array_new (FALSE, FALSE, sizeof (GPid));
}
-SpProfiler *
-sp_local_profiler_new (void)
+SysprofProfiler *
+sysprof_local_profiler_new (void)
{
- return g_object_new (SP_TYPE_LOCAL_PROFILER, NULL);
+ return g_object_new (SYSPROF_TYPE_LOCAL_PROFILER, NULL);
}
static void
-sp_local_profiler_finish_startup (SpLocalProfiler *self)
+sysprof_local_profiler_finish_startup (SysprofLocalProfiler *self)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
guint i;
- g_assert (SP_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
g_assert (priv->is_starting == TRUE);
g_assert (priv->starting->len == 0);
- sp_local_profiler_clear_timer (self);
+ sysprof_local_profiler_clear_timer (self);
priv->timer = g_timer_new ();
@@ -423,14 +423,14 @@ sp_local_profiler_finish_startup (SpLocalProfiler *self)
*/
priv->timer_notify_source =
g_timeout_add (1000,
- sp_local_profiler_notify_elapsed_cb,
+ sysprof_local_profiler_notify_elapsed_cb,
self);
for (i = 0; i < priv->sources->len; i++)
{
- SpSource *source = g_ptr_array_index (priv->sources, i);
+ SysprofSource *source = g_ptr_array_index (priv->sources, i);
- sp_source_start (source);
+ sysprof_source_start (source);
}
priv->is_starting = FALSE;
@@ -444,8 +444,8 @@ sp_local_profiler_finish_startup (SpLocalProfiler *self)
const GError *error = g_ptr_array_index (priv->failures, 0);
g_object_ref (self);
- sp_profiler_emit_failed (SP_PROFILER (self), error);
- sp_local_profiler_stop (SP_PROFILER (self));
+ sysprof_profiler_emit_failed (SYSPROF_PROFILER (self), error);
+ sysprof_local_profiler_stop (SYSPROF_PROFILER (self));
g_object_unref (self);
return;
}
@@ -462,17 +462,17 @@ sp_local_profiler_finish_startup (SpLocalProfiler *self)
* If we detect this, we stop immediately.
*/
if (priv->finished_or_failed->len == priv->sources->len || priv->stop_after_starting)
- sp_local_profiler_stop (SP_PROFILER (self));
+ sysprof_local_profiler_stop (SYSPROF_PROFILER (self));
}
static void
-sp_local_profiler_start (SpProfiler *profiler)
+sysprof_local_profiler_start (SysprofProfiler *profiler)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
guint i;
- g_return_if_fail (SP_IS_LOCAL_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
g_return_if_fail (priv->is_running == FALSE);
g_return_if_fail (priv->is_stopping == FALSE);
g_return_if_fail (priv->is_starting == FALSE);
@@ -482,11 +482,11 @@ sp_local_profiler_start (SpProfiler *profiler)
if (priv->writer == NULL)
{
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
int fd;
- if ((-1 == (fd = sp_memfd_create ("[sysprof]"))) ||
- (NULL == (writer = sp_capture_writer_new_from_fd (fd, 0))))
+ if ((-1 == (fd = sysprof_memfd_create ("[sysprof]"))) ||
+ (NULL == (writer = sysprof_capture_writer_new_from_fd (fd, 0))))
{
const GError error = {
G_FILE_ERROR,
@@ -497,13 +497,13 @@ sp_local_profiler_start (SpProfiler *profiler)
if (fd != -1)
close (fd);
- sp_profiler_emit_failed (SP_PROFILER (self), &error);
+ sysprof_profiler_emit_failed (SYSPROF_PROFILER (self), &error);
return;
}
- sp_profiler_set_writer (SP_PROFILER (self), writer);
- g_clear_pointer (&writer, sp_capture_writer_unref);
+ sysprof_profiler_set_writer (SYSPROF_PROFILER (self), writer);
+ g_clear_pointer (&writer, sysprof_capture_writer_unref);
}
priv->is_running = TRUE;
@@ -552,7 +552,7 @@ sp_local_profiler_start (SpProfiler *profiler)
for (i = 0; i < priv->sources->len; i++)
{
- SpSource *source = g_ptr_array_index (priv->sources, i);
+ SysprofSource *source = g_ptr_array_index (priv->sources, i);
guint j;
if (priv->whole_system == FALSE)
@@ -561,56 +561,56 @@ sp_local_profiler_start (SpProfiler *profiler)
{
GPid pid = g_array_index (priv->pids, GPid, j);
- sp_source_add_pid (source, pid);
+ sysprof_source_add_pid (source, pid);
}
}
- sp_source_set_writer (source, priv->writer);
- sp_source_prepare (source);
+ sysprof_source_set_writer (source, priv->writer);
+ sysprof_source_prepare (source);
}
for (i = 0; i < priv->sources->len; i++)
{
- SpSource *source = g_ptr_array_index (priv->sources, i);
+ SysprofSource *source = g_ptr_array_index (priv->sources, i);
- if (!sp_source_get_is_ready (source))
+ if (!sysprof_source_get_is_ready (source))
g_ptr_array_add (priv->starting, g_object_ref (source));
}
if (priv->starting->len == 0)
- sp_local_profiler_finish_startup (self);
+ sysprof_local_profiler_finish_startup (self);
}
static void
-sp_local_profiler_set_writer (SpProfiler *profiler,
- SpCaptureWriter *writer)
+sysprof_local_profiler_set_writer (SysprofProfiler *profiler,
+ SysprofCaptureWriter *writer)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_return_if_fail (SP_IS_LOCAL_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
g_return_if_fail (priv->is_running == FALSE);
g_return_if_fail (priv->is_stopping == FALSE);
g_return_if_fail (writer != NULL);
if (priv->writer != writer)
{
- g_clear_pointer (&priv->writer, sp_capture_writer_unref);
+ g_clear_pointer (&priv->writer, sysprof_capture_writer_unref);
if (writer != NULL)
- priv->writer = sp_capture_writer_ref (writer);
+ priv->writer = sysprof_capture_writer_ref (writer);
}
}
static void
-sp_local_profiler_track_completed (SpLocalProfiler *self,
- SpSource *source)
+sysprof_local_profiler_track_completed (SysprofLocalProfiler *self,
+ SysprofSource *source)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
gint i;
- g_assert (SP_IS_LOCAL_PROFILER (self));
- g_assert (SP_IS_SOURCE (source));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_SOURCE (source));
if (!_g_ptr_array_contains (priv->finished_or_failed, source))
g_ptr_array_add (priv->finished_or_failed, g_object_ref (source));
@@ -623,7 +623,7 @@ sp_local_profiler_track_completed (SpLocalProfiler *self,
{
g_ptr_array_remove_index (priv->starting, i);
if (priv->starting->len == 0)
- sp_local_profiler_finish_startup (self);
+ sysprof_local_profiler_finish_startup (self);
}
}
@@ -636,47 +636,47 @@ sp_local_profiler_track_completed (SpLocalProfiler *self,
g_ptr_array_remove_index_fast (priv->stopping, i);
if ((priv->is_stopping == TRUE) && (priv->stopping->len == 0))
- sp_local_profiler_finish_stopping (self);
+ sysprof_local_profiler_finish_stopping (self);
}
}
if (!priv->is_starting)
{
if (priv->finished_or_failed->len == priv->sources->len)
- sp_local_profiler_stop (SP_PROFILER (self));
+ sysprof_local_profiler_stop (SYSPROF_PROFILER (self));
}
}
static void
-sp_local_profiler_source_finished (SpLocalProfiler *self,
- SpSource *source)
+sysprof_local_profiler_source_finished (SysprofLocalProfiler *self,
+ SysprofSource *source)
{
- g_assert (SP_IS_LOCAL_PROFILER (self));
- g_assert (SP_IS_SOURCE (source));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_SOURCE (source));
- sp_local_profiler_track_completed (self, source);
+ sysprof_local_profiler_track_completed (self, source);
}
static void
-sp_local_profiler_source_ready (SpLocalProfiler *self,
- SpSource *source)
+sysprof_local_profiler_source_ready (SysprofLocalProfiler *self,
+ SysprofSource *source)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
guint i;
- g_assert (SP_IS_LOCAL_PROFILER (self));
- g_assert (SP_IS_SOURCE (source));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_SOURCE (source));
for (i = 0; i < priv->starting->len; i++)
{
- SpSource *ele = g_ptr_array_index (priv->starting, i);
+ SysprofSource *ele = g_ptr_array_index (priv->starting, i);
if (ele == source)
{
g_ptr_array_remove_index_fast (priv->starting, i);
if ((priv->is_starting == TRUE) && (priv->starting->len == 0))
- sp_local_profiler_finish_startup (self);
+ sysprof_local_profiler_finish_startup (self);
break;
}
@@ -684,17 +684,17 @@ sp_local_profiler_source_ready (SpLocalProfiler *self,
}
static void
-sp_local_profiler_source_failed (SpLocalProfiler *self,
+sysprof_local_profiler_source_failed (SysprofLocalProfiler *self,
const GError *reason,
- SpSource *source)
+ SysprofSource *source)
{
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_assert (SP_IS_LOCAL_PROFILER (self));
+ g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
g_assert (reason != NULL);
- g_assert (SP_IS_SOURCE (source));
+ g_assert (SYSPROF_IS_SOURCE (source));
- sp_local_profiler_track_completed (self, source);
+ sysprof_local_profiler_track_completed (self, source);
/* Failure emitted out of band */
if (!priv->is_starting && !priv->is_stopping && !priv->is_running)
@@ -707,37 +707,37 @@ sp_local_profiler_source_failed (SpLocalProfiler *self,
return;
if (priv->is_running)
- sp_local_profiler_stop (SP_PROFILER (self));
+ sysprof_local_profiler_stop (SYSPROF_PROFILER (self));
}
static void
-sp_local_profiler_add_source (SpProfiler *profiler,
- SpSource *source)
+sysprof_local_profiler_add_source (SysprofProfiler *profiler,
+ SysprofSource *source)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_return_if_fail (SP_IS_LOCAL_PROFILER (self));
- g_return_if_fail (SP_IS_SOURCE (source));
+ g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (source));
g_return_if_fail (priv->is_running == FALSE);
g_return_if_fail (priv->is_starting == FALSE);
g_return_if_fail (priv->is_stopping == FALSE);
g_signal_connect_object (source,
"failed",
- G_CALLBACK (sp_local_profiler_source_failed),
+ G_CALLBACK (sysprof_local_profiler_source_failed),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (source,
"finished",
- G_CALLBACK (sp_local_profiler_source_finished),
+ G_CALLBACK (sysprof_local_profiler_source_finished),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (source,
"ready",
- G_CALLBACK (sp_local_profiler_source_ready),
+ G_CALLBACK (sysprof_local_profiler_source_ready),
self,
G_CONNECT_SWAPPED);
@@ -746,13 +746,13 @@ sp_local_profiler_add_source (SpProfiler *profiler,
}
static void
-sp_local_profiler_add_pid (SpProfiler *profiler,
+sysprof_local_profiler_add_pid (SysprofProfiler *profiler,
GPid pid)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_return_if_fail (SP_IS_LOCAL_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
g_return_if_fail (pid > -1);
g_return_if_fail (priv->is_starting == FALSE);
g_return_if_fail (priv->is_stopping == FALSE);
@@ -762,14 +762,14 @@ sp_local_profiler_add_pid (SpProfiler *profiler,
}
static void
-sp_local_profiler_remove_pid (SpProfiler *profiler,
+sysprof_local_profiler_remove_pid (SysprofProfiler *profiler,
GPid pid)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
guint i;
- g_return_if_fail (SP_IS_LOCAL_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
g_return_if_fail (pid > -1);
g_return_if_fail (priv->is_starting == FALSE);
g_return_if_fail (priv->is_stopping == FALSE);
@@ -788,13 +788,13 @@ sp_local_profiler_remove_pid (SpProfiler *profiler,
}
static const GPid *
-sp_local_profiler_get_pids (SpProfiler *profiler,
+sysprof_local_profiler_get_pids (SysprofProfiler *profiler,
guint *n_pids)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_return_val_if_fail (SP_IS_LOCAL_PROFILER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_LOCAL_PROFILER (self), NULL);
g_return_val_if_fail (n_pids != NULL, NULL);
*n_pids = priv->pids->len;
@@ -802,27 +802,27 @@ sp_local_profiler_get_pids (SpProfiler *profiler,
return (GPid *)(gpointer)priv->pids->data;
}
-static SpCaptureWriter *
-sp_local_profiler_get_writer (SpProfiler *profiler)
+static SysprofCaptureWriter *
+sysprof_local_profiler_get_writer (SysprofProfiler *profiler)
{
- SpLocalProfiler *self = (SpLocalProfiler *)profiler;
- SpLocalProfilerPrivate *priv = sp_local_profiler_get_instance_private (self);
+ SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
+ SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
- g_return_val_if_fail (SP_IS_LOCAL_PROFILER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_LOCAL_PROFILER (self), NULL);
return priv->writer;
}
static void
-profiler_iface_init (SpProfilerInterface *iface)
+profiler_iface_init (SysprofProfilerInterface *iface)
{
- iface->add_pid = sp_local_profiler_add_pid;
- iface->add_source = sp_local_profiler_add_source;
- iface->get_pids = sp_local_profiler_get_pids;
- iface->get_writer = sp_local_profiler_get_writer;
- iface->remove_pid = sp_local_profiler_remove_pid;
- iface->set_writer = sp_local_profiler_set_writer;
- iface->start = sp_local_profiler_start;
- iface->stop = sp_local_profiler_stop;
- iface->stopped = sp_local_profiler_real_stopped;
+ iface->add_pid = sysprof_local_profiler_add_pid;
+ iface->add_source = sysprof_local_profiler_add_source;
+ iface->get_pids = sysprof_local_profiler_get_pids;
+ iface->get_writer = sysprof_local_profiler_get_writer;
+ iface->remove_pid = sysprof_local_profiler_remove_pid;
+ iface->set_writer = sysprof_local_profiler_set_writer;
+ iface->start = sysprof_local_profiler_start;
+ iface->stop = sysprof_local_profiler_stop;
+ iface->stopped = sysprof_local_profiler_real_stopped;
}
diff --git a/src/libsysprof/sp-local-profiler.h b/src/libsysprof/sysprof-local-profiler.h
similarity index 74%
rename from src/libsysprof/sp-local-profiler.h
rename to src/libsysprof/sysprof-local-profiler.h
index 58cd806..e1f10a2 100644
--- a/src/libsysprof/sp-local-profiler.h
+++ b/src/libsysprof/sysprof-local-profiler.h
@@ -1,4 +1,4 @@
-/* sp-local-profiler.h
+/* sysprof-local-profiler.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,24 +20,24 @@
#pragma once
-#include "sp-profiler.h"
+#include "sysprof-profiler.h"
#include "sysprof-version-macros.h"
G_BEGIN_DECLS
-#define SP_TYPE_LOCAL_PROFILER (sp_local_profiler_get_type())
+#define SYSPROF_TYPE_LOCAL_PROFILER (sysprof_local_profiler_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_DERIVABLE_TYPE (SpLocalProfiler, sp_local_profiler, SP, LOCAL_PROFILER, GObject)
+G_DECLARE_DERIVABLE_TYPE (SysprofLocalProfiler, sysprof_local_profiler, SYSPROF, LOCAL_PROFILER, GObject)
-struct _SpLocalProfilerClass
+struct _SysprofLocalProfilerClass
{
GObjectClass parent_class;
gpointer padding[8];
};
SYSPROF_AVAILABLE_IN_ALL
-SpProfiler *sp_local_profiler_new (void);
+SysprofProfiler *sysprof_local_profiler_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-map-lookaside.c b/src/libsysprof/sysprof-map-lookaside.c
similarity index 57%
rename from src/libsysprof/sp-map-lookaside.c
rename to src/libsysprof/sysprof-map-lookaside.c
index 7b634e5..57f8a4c 100644
--- a/src/libsysprof/sp-map-lookaside.c
+++ b/src/libsysprof/sysprof-map-lookaside.c
@@ -1,4 +1,4 @@
-/* sp-map-lookaside.c
+/* sysprof-map-lookaside.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,32 +20,32 @@
#include "config.h"
-#include "sp-map-lookaside.h"
+#include "sysprof-map-lookaside.h"
-struct _SpMapLookaside
+struct _SysprofMapLookaside
{
GSequence *seq;
GStringChunk *chunk;
};
static gint
-sp_map_compare (gconstpointer a,
+sysprof_map_compare (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
- const SpMap *map_a = a;
- const SpMap *map_b = b;
+ const SysprofMap *map_a = a;
+ const SysprofMap *map_b = b;
- return sp_capture_address_compare (map_a->start, map_b->start);
+ return sysprof_capture_address_compare (map_a->start, map_b->start);
}
static gint
-sp_map_compare_in_range (gconstpointer a,
+sysprof_map_compare_in_range (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
- const SpMap *map_a = a;
- const SpMap *map_b = b;
+ const SysprofMap *map_a = a;
+ const SysprofMap *map_b = b;
/*
* map_b is the needle for the search.
@@ -55,66 +55,66 @@ sp_map_compare_in_range (gconstpointer a,
if ((map_b->start >= map_a->start) && (map_b->start < map_a->end))
return 0;
- return sp_capture_address_compare (map_a->start, map_b->start);
+ return sysprof_capture_address_compare (map_a->start, map_b->start);
}
static void
-sp_map_free (gpointer data)
+sysprof_map_free (gpointer data)
{
- SpMap *map = data;
+ SysprofMap *map = data;
- g_slice_free (SpMap, map);
+ g_slice_free (SysprofMap, map);
}
-SpMapLookaside *
-sp_map_lookaside_new (void)
+SysprofMapLookaside *
+sysprof_map_lookaside_new (void)
{
- SpMapLookaside *ret;
+ SysprofMapLookaside *ret;
- ret = g_slice_new (SpMapLookaside);
- ret->seq = g_sequence_new (sp_map_free);
+ ret = g_slice_new (SysprofMapLookaside);
+ ret->seq = g_sequence_new (sysprof_map_free);
ret->chunk = g_string_chunk_new (4096);
return ret;
}
void
-sp_map_lookaside_free (SpMapLookaside *self)
+sysprof_map_lookaside_free (SysprofMapLookaside *self)
{
g_sequence_free (self->seq);
g_string_chunk_free (self->chunk);
- g_slice_free (SpMapLookaside, self);
+ g_slice_free (SysprofMapLookaside, self);
}
void
-sp_map_lookaside_insert (SpMapLookaside *self,
- const SpMap *map)
+sysprof_map_lookaside_insert (SysprofMapLookaside *self,
+ const SysprofMap *map)
{
- SpMap *copy;
+ SysprofMap *copy;
g_assert (self != NULL);
g_assert (map != NULL);
- copy = g_slice_new (SpMap);
+ copy = g_slice_new (SysprofMap);
copy->start = map->start;
copy->end = map->end;
copy->offset = map->offset;
copy->inode = map->inode;
copy->filename = g_string_chunk_insert_const (self->chunk, map->filename);
- g_sequence_insert_sorted (self->seq, copy, sp_map_compare, NULL);
+ g_sequence_insert_sorted (self->seq, copy, sysprof_map_compare, NULL);
}
-const SpMap *
-sp_map_lookaside_lookup (SpMapLookaside *self,
- SpCaptureAddress address)
+const SysprofMap *
+sysprof_map_lookaside_lookup (SysprofMapLookaside *self,
+ SysprofCaptureAddress address)
{
- SpMap map = { address };
+ SysprofMap map = { address };
GSequenceIter *iter;
g_assert (self != NULL);
- iter = g_sequence_lookup (self->seq, &map, sp_map_compare_in_range, NULL);
+ iter = g_sequence_lookup (self->seq, &map, sysprof_map_compare_in_range, NULL);
if (iter != NULL)
return g_sequence_get (iter);
diff --git a/src/libsysprof/sp-map-lookaside.h b/src/libsysprof/sysprof-map-lookaside.h
similarity index 56%
rename from src/libsysprof/sp-map-lookaside.h
rename to src/libsysprof/sysprof-map-lookaside.h
index 34c85ec..9ceaf7e 100644
--- a/src/libsysprof/sp-map-lookaside.h
+++ b/src/libsysprof/sysprof-map-lookaside.h
@@ -1,4 +1,4 @@
-/* sp-map-lookaside.h
+/* sysprof-map-lookaside.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,28 +22,28 @@
#include <glib.h>
-#include "sp-capture-types.h"
+#include "sysprof-capture-types.h"
G_BEGIN_DECLS
-typedef struct _SpMapLookaside SpMapLookaside;
+typedef struct _SysprofMapLookaside SysprofMapLookaside;
typedef struct
{
- SpCaptureAddress start;
- SpCaptureAddress end;
+ SysprofCaptureAddress start;
+ SysprofCaptureAddress end;
off_t offset;
ino_t inode;
const gchar *filename;
-} SpMap;
+} SysprofMap;
-SpMapLookaside *sp_map_lookaside_new (void);
-void sp_map_lookaside_insert (SpMapLookaside *self,
- const SpMap *map);
-const SpMap *sp_map_lookaside_lookup (SpMapLookaside *self,
- SpCaptureAddress address);
-void sp_map_lookaside_free (SpMapLookaside *self);
+SysprofMapLookaside *sysprof_map_lookaside_new (void);
+void sysprof_map_lookaside_insert (SysprofMapLookaside *self,
+ const SysprofMap *map);
+const SysprofMap *sysprof_map_lookaside_lookup (SysprofMapLookaside *self,
+ SysprofCaptureAddress address);
+void sysprof_map_lookaside_free (SysprofMapLookaside *self);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpMapLookaside, sp_map_lookaside_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofMapLookaside, sysprof_map_lookaside_free)
G_END_DECLS
diff --git a/src/libsysprof/sp-memory-source.c b/src/libsysprof/sysprof-memory-source.c
similarity index 72%
rename from src/libsysprof/sp-memory-source.c
rename to src/libsysprof/sysprof-memory-source.c
index 1347fe3..0aa79e2 100644
--- a/src/libsysprof/sp-memory-source.c
+++ b/src/libsysprof/sysprof-memory-source.c
@@ -1,4 +1,4 @@
-/* sp-memory-source.c
+/* sysprof-memory-source.c
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -18,7 +18,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-memory-source"
+#define G_LOG_DOMAIN "sysprof-memory-source"
#include "config.h"
@@ -28,16 +28,16 @@
#include <sysprof-capture.h>
#include <unistd.h>
-#include "sp-memory-source.h"
+#include "sysprof-memory-source.h"
#define BUF_SIZE 4096
-struct _SpMemorySource
+struct _SysprofMemorySource
{
GObject parent_instance;
/* Capture writer to deliver samples */
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
/* 4k stat buffer for reading proc */
gchar *stat_buf;
@@ -56,13 +56,13 @@ typedef struct
union {
struct {
- SpCaptureCounterValue used;
+ SysprofCaptureCounterValue used;
gint64 total;
gint64 avail;
gint64 free;
} sys;
struct {
- SpCaptureCounterValue used;
+ SysprofCaptureCounterValue used;
gint64 size;
gint64 resident;
gint64 shared;
@@ -74,10 +74,10 @@ typedef struct
guint counter_ids[1];
} MemStat;
-static void source_iface_init (SpSourceInterface *iface);
+static void source_iface_init (SysprofSourceInterface *iface);
-G_DEFINE_TYPE_WITH_CODE (SpMemorySource, sp_memory_source, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SOURCE, source_iface_init))
+G_DEFINE_TYPE_WITH_CODE (SysprofMemorySource, sysprof_memory_source, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
static GHashTable *keys;
@@ -221,13 +221,13 @@ mem_stat_poll (MemStat *st,
static void
mem_stat_publish (MemStat *st,
- SpCaptureWriter *writer,
+ SysprofCaptureWriter *writer,
gint64 current_time)
{
g_assert (st != NULL);
g_assert (writer != NULL);
- sp_capture_writer_set_counters (writer,
+ sysprof_capture_writer_set_counters (writer,
current_time,
-1,
st->pid,
@@ -237,27 +237,27 @@ mem_stat_publish (MemStat *st,
}
/**
- * sp_memory_source_new:
+ * sysprof_memory_source_new:
*
- * Create a new #SpMemorySource.
+ * Create a new #SysprofMemorySource.
*
* Use this source to record basic memory statistics about the system
* such as Available, Free, and Total Memory.
*
- * Returns: (transfer full): a newly created #SpMemorySource
+ * Returns: (transfer full): a newly created #SysprofMemorySource
* Since: 3.32
*/
-SpSource *
-sp_memory_source_new (void)
+SysprofSource *
+sysprof_memory_source_new (void)
{
- return g_object_new (SP_TYPE_MEMORY_SOURCE, NULL);
+ return g_object_new (SYSPROF_TYPE_MEMORY_SOURCE, NULL);
}
static void
-sp_memory_source_finalize (GObject *object)
+sysprof_memory_source_finalize (GObject *object)
{
- SpMemorySource *self = (SpMemorySource *)object;
+ SysprofMemorySource *self = (SysprofMemorySource *)object;
if (self->timer_source != 0)
{
@@ -266,18 +266,18 @@ sp_memory_source_finalize (GObject *object)
}
g_clear_pointer (&self->stat_buf, g_free);
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
g_clear_pointer (&self->mem_stats, g_array_unref);
- G_OBJECT_CLASS (sp_memory_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_memory_source_parent_class)->finalize (object);
}
static void
-sp_memory_source_class_init (SpMemorySourceClass *klass)
+sysprof_memory_source_class_init (SysprofMemorySourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_memory_source_finalize;
+ object_class->finalize = sysprof_memory_source_finalize;
keys = g_hash_table_new (g_str_hash, g_str_equal);
@@ -290,31 +290,31 @@ sp_memory_source_class_init (SpMemorySourceClass *klass)
}
static void
-sp_memory_source_init (SpMemorySource *self)
+sysprof_memory_source_init (SysprofMemorySource *self)
{
self->stat_buf = g_malloc (BUF_SIZE);
self->mem_stats = g_array_new (FALSE, FALSE, sizeof (MemStat));
}
static void
-sp_memory_source_set_writer (SpSource *source,
- SpCaptureWriter *writer)
+sysprof_memory_source_set_writer (SysprofSource *source,
+ SysprofCaptureWriter *writer)
{
- SpMemorySource *self = (SpMemorySource *)source;
+ SysprofMemorySource *self = (SysprofMemorySource *)source;
- g_assert (SP_IS_SOURCE (self));
+ g_assert (SYSPROF_IS_SOURCE (self));
g_assert (writer != NULL);
g_assert (self->writer == NULL);
- self->writer = sp_capture_writer_ref (writer);
+ self->writer = sysprof_capture_writer_ref (writer);
}
static void
-sp_memory_source_prepare (SpSource *source)
+sysprof_memory_source_prepare (SysprofSource *source)
{
- SpMemorySource *self = (SpMemorySource *)source;
+ SysprofMemorySource *self = (SysprofMemorySource *)source;
- g_assert (SP_IS_MEMORY_SOURCE (self));
+ g_assert (SYSPROF_IS_MEMORY_SOURCE (self));
g_assert (self->writer != NULL);
/* If no pids are registered, setup a system memory stat */
@@ -334,25 +334,25 @@ sp_memory_source_prepare (SpSource *source)
for (guint i = 0; i < self->mem_stats->len; i++)
{
MemStat *st = &g_array_index (self->mem_stats, MemStat, i);
- SpCaptureCounter counters[5];
+ SysprofCaptureCounter counters[5];
guint base;
mem_stat_open (st);
if (st->pid == -1)
{
- base = sp_capture_writer_request_counter (self->writer, 1);
+ base = sysprof_capture_writer_request_counter (self->writer, 1);
g_strlcpy (counters[0].category, "Memory", sizeof counters[0].category);
g_strlcpy (counters[0].name, "Used", sizeof counters[0].name);
g_strlcpy (counters[0].description, "Memory used by system", sizeof counters[0].description);
counters[0].id = st->counter_ids[0] = base;
- counters[0].type = SP_CAPTURE_COUNTER_DOUBLE;
+ counters[0].type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
counters[0].value.vdbl = 0;
- sp_capture_writer_define_counters (self->writer,
- SP_CAPTURE_CURRENT_TIME,
+ sysprof_capture_writer_define_counters (self->writer,
+ SYSPROF_CAPTURE_CURRENT_TIME,
-1,
-1,
counters,
@@ -360,18 +360,18 @@ sp_memory_source_prepare (SpSource *source)
}
else
{
- base = sp_capture_writer_request_counter (self->writer, 1);
+ base = sysprof_capture_writer_request_counter (self->writer, 1);
g_strlcpy (counters[0].category, "Memory", sizeof counters[0].category);
g_strlcpy (counters[0].name, "Used", sizeof counters[0].name);
g_strlcpy (counters[0].description, "Memory used by process", sizeof counters[0].description);
counters[0].id = st->counter_ids[0] = base;
- counters[0].type = SP_CAPTURE_COUNTER_DOUBLE;
+ counters[0].type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
counters[0].value.vdbl = 0;
- sp_capture_writer_define_counters (self->writer,
- SP_CAPTURE_CURRENT_TIME,
+ sysprof_capture_writer_define_counters (self->writer,
+ SYSPROF_CAPTURE_CURRENT_TIME,
-1,
st->pid,
counters,
@@ -379,18 +379,18 @@ sp_memory_source_prepare (SpSource *source)
}
}
- sp_source_emit_ready (SP_SOURCE (self));
+ sysprof_source_emit_ready (SYSPROF_SOURCE (self));
}
static gboolean
-sp_memory_source_timer_cb (SpMemorySource *self)
+sysprof_memory_source_timer_cb (SysprofMemorySource *self)
{
gint64 current_time;
- g_assert (SP_IS_MEMORY_SOURCE (self));
+ g_assert (SYSPROF_IS_MEMORY_SOURCE (self));
g_assert (self->writer != NULL);
- current_time = sp_clock_get_current_time ();
+ current_time = sysprof_clock_get_current_time ();
for (guint i = 0; i < self->mem_stats->len; i++)
{
@@ -404,26 +404,26 @@ sp_memory_source_timer_cb (SpMemorySource *self)
}
static void
-sp_memory_source_start (SpSource *source)
+sysprof_memory_source_start (SysprofSource *source)
{
- SpMemorySource *self = (SpMemorySource *)source;
+ SysprofMemorySource *self = (SysprofMemorySource *)source;
- g_assert (SP_IS_MEMORY_SOURCE (self));
+ g_assert (SYSPROF_IS_MEMORY_SOURCE (self));
/* Poll 4x/sec for memory stats */
self->timer_source = g_timeout_add_full (G_PRIORITY_HIGH,
1000 / 4,
- (GSourceFunc)sp_memory_source_timer_cb,
+ (GSourceFunc)sysprof_memory_source_timer_cb,
self,
NULL);
}
static void
-sp_memory_source_stop (SpSource *source)
+sysprof_memory_source_stop (SysprofSource *source)
{
- SpMemorySource *self = (SpMemorySource *)source;
+ SysprofMemorySource *self = (SysprofMemorySource *)source;
- g_assert (SP_IS_MEMORY_SOURCE (self));
+ g_assert (SYSPROF_IS_MEMORY_SOURCE (self));
if (self->timer_source != 0)
{
@@ -438,17 +438,17 @@ sp_memory_source_stop (SpSource *source)
mem_stat_close (st);
}
- sp_source_emit_finished (source);
+ sysprof_source_emit_finished (source);
}
static void
-sp_memory_source_add_pid (SpSource *source,
+sysprof_memory_source_add_pid (SysprofSource *source,
GPid pid)
{
- SpMemorySource *self = (SpMemorySource *)source;
+ SysprofMemorySource *self = (SysprofMemorySource *)source;
MemStat st = {0};
- g_assert (SP_IS_MEMORY_SOURCE (self));
+ g_assert (SYSPROF_IS_MEMORY_SOURCE (self));
st.pid = pid;
st.stat_fd = -1;
@@ -457,11 +457,11 @@ sp_memory_source_add_pid (SpSource *source,
}
static void
-source_iface_init (SpSourceInterface *iface)
+source_iface_init (SysprofSourceInterface *iface)
{
- iface->set_writer = sp_memory_source_set_writer;
- iface->prepare = sp_memory_source_prepare;
- iface->start = sp_memory_source_start;
- iface->stop = sp_memory_source_stop;
- iface->add_pid = sp_memory_source_add_pid;
+ iface->set_writer = sysprof_memory_source_set_writer;
+ iface->prepare = sysprof_memory_source_prepare;
+ iface->start = sysprof_memory_source_start;
+ iface->stop = sysprof_memory_source_stop;
+ iface->add_pid = sysprof_memory_source_add_pid;
}
diff --git a/src/libsysprof/sp-memory-source.h b/src/libsysprof/sysprof-memory-source.h
similarity index 76%
rename from src/libsysprof/sp-memory-source.h
rename to src/libsysprof/sysprof-memory-source.h
index c020392..cd02491 100644
--- a/src/libsysprof/sp-memory-source.h
+++ b/src/libsysprof/sysprof-memory-source.h
@@ -1,4 +1,4 @@
-/* sp-memory-source.h
+/* sysprof-memory-source.h
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -22,16 +22,16 @@
#include "sysprof-version-macros.h"
-#include "sp-source.h"
+#include "sysprof-source.h"
G_BEGIN_DECLS
-#define SP_TYPE_MEMORY_SOURCE (sp_memory_source_get_type())
+#define SYSPROF_TYPE_MEMORY_SOURCE (sysprof_memory_source_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpMemorySource, sp_memory_source, SP, MEMORY_SOURCE, GObject)
+G_DECLARE_FINAL_TYPE (SysprofMemorySource, sysprof_memory_source, SYSPROF, MEMORY_SOURCE, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpSource *sp_memory_source_new (void);
+SysprofSource *sysprof_memory_source_new (void);
G_END_DECLS
diff --git a/src/libsysprof/sp-perf-counter.c b/src/libsysprof/sysprof-perf-counter.c
similarity index 84%
rename from src/libsysprof/sp-perf-counter.c
rename to src/libsysprof/sysprof-perf-counter.c
index 0accf95..ca62784 100644
--- a/src/libsysprof/sp-perf-counter.c
+++ b/src/libsysprof/sysprof-perf-counter.c
@@ -1,4 +1,4 @@
-/* sp-perf-counter.c
+/* sysprof-perf-counter.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -52,7 +52,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#include "sp-perf-counter.h"
+#include "sysprof-perf-counter.h"
/*
* Number of pages to map for the ring buffer. We map one additional buffer
@@ -61,7 +61,7 @@
#define N_PAGES 32
/*
- * This represents a stream coming to us from perf. All SpPerfCounterInfo
+ * This represents a stream coming to us from perf. All SysprofPerfCounterInfo
* share a single GSource used for watching incoming G_IO_IN requests.
* The map is the mmap() zone we are using as a ring buffer for communicating
* with perf. The rest is for managing the ring buffer.
@@ -75,9 +75,9 @@ typedef struct
guint64 tail;
gint cpu;
guint in_callback : 1;
-} SpPerfCounterInfo;
+} SysprofPerfCounterInfo;
-struct _SpPerfCounter
+struct _SysprofPerfCounter
{
volatile gint ref_count;
@@ -94,7 +94,7 @@ struct _SpPerfCounter
GSource *source;
/*
- * An array of SpPerfCounterInfo, indicating all of our open
+ * An array of SysprofPerfCounterInfo, indicating all of our open
* perf stream.s
*/
GPtrArray *info;
@@ -102,7 +102,7 @@ struct _SpPerfCounter
/*
* The callback to execute for every discovered perf event.
*/
- SpPerfCounterCallback callback;
+ SysprofPerfCounterCallback callback;
gpointer callback_data;
GDestroyNotify callback_data_destroy;
@@ -115,13 +115,13 @@ struct _SpPerfCounter
typedef struct
{
GSource source;
- SpPerfCounter *counter;
+ SysprofPerfCounter *counter;
} PerfGSource;
-G_DEFINE_BOXED_TYPE (SpPerfCounter,
- sp_perf_counter,
- (GBoxedCopyFunc)sp_perf_counter_ref,
- (GBoxedFreeFunc)sp_perf_counter_unref)
+G_DEFINE_BOXED_TYPE (SysprofPerfCounter,
+ sysprof_perf_counter,
+ (GBoxedCopyFunc)sysprof_perf_counter_ref,
+ (GBoxedFreeFunc)sysprof_perf_counter_unref)
#ifdef ENABLE_POLKIT
static GDBusConnection *shared_conn;
@@ -140,7 +140,7 @@ static GSourceFuncs source_funcs = {
};
static void
-sp_perf_counter_info_free (SpPerfCounterInfo *info)
+sysprof_perf_counter_info_free (SysprofPerfCounterInfo *info)
{
if (info->map)
{
@@ -159,11 +159,11 @@ sp_perf_counter_info_free (SpPerfCounterInfo *info)
info->fd = 0;
}
- g_slice_free (SpPerfCounterInfo, info);
+ g_slice_free (SysprofPerfCounterInfo, info);
}
static void
-sp_perf_counter_finalize (SpPerfCounter *self)
+sysprof_perf_counter_finalize (SysprofPerfCounter *self)
{
guint i;
@@ -172,12 +172,12 @@ sp_perf_counter_finalize (SpPerfCounter *self)
for (i = 0; i < self->info->len; i++)
{
- SpPerfCounterInfo *info = g_ptr_array_index (self->info, i);
+ SysprofPerfCounterInfo *info = g_ptr_array_index (self->info, i);
if (info->fdtag)
g_source_remove_unix_fd (self->source, info->fdtag);
- sp_perf_counter_info_free (info);
+ sysprof_perf_counter_info_free (info);
}
if (self->callback_data_destroy)
@@ -186,21 +186,21 @@ sp_perf_counter_finalize (SpPerfCounter *self)
g_clear_pointer (&self->source, g_source_destroy);
g_clear_pointer (&self->info, g_ptr_array_unref);
g_clear_pointer (&self->context, g_main_context_unref);
- g_slice_free (SpPerfCounter, self);
+ g_slice_free (SysprofPerfCounter, self);
}
void
-sp_perf_counter_unref (SpPerfCounter *self)
+sysprof_perf_counter_unref (SysprofPerfCounter *self)
{
g_return_if_fail (self != NULL);
g_return_if_fail (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
- sp_perf_counter_finalize (self);
+ sysprof_perf_counter_finalize (self);
}
-SpPerfCounter *
-sp_perf_counter_ref (SpPerfCounter *self)
+SysprofPerfCounter *
+sysprof_perf_counter_ref (SysprofPerfCounter *self)
{
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->ref_count > 0, NULL);
@@ -211,8 +211,8 @@ sp_perf_counter_ref (SpPerfCounter *self)
}
static void
-sp_perf_counter_flush (SpPerfCounter *self,
- SpPerfCounterInfo *info)
+sysprof_perf_counter_flush (SysprofPerfCounter *self,
+ SysprofPerfCounterInfo *info)
{
guint64 head;
guint64 tail;
@@ -282,7 +282,7 @@ sp_perf_counter_flush (SpPerfCounter *self,
if (self->callback != NULL)
{
info->in_callback = TRUE;
- self->callback ((SpPerfCounterEvent *)header, info->cpu, self->callback_data);
+ self->callback ((SysprofPerfCounterEvent *)header, info->cpu, self->callback_data);
info->in_callback = FALSE;
}
@@ -296,9 +296,9 @@ sp_perf_counter_flush (SpPerfCounter *self,
}
static gboolean
-sp_perf_counter_dispatch (gpointer user_data)
+sysprof_perf_counter_dispatch (gpointer user_data)
{
- SpPerfCounter *self = user_data;
+ SysprofPerfCounter *self = user_data;
guint i;
g_assert (self != NULL);
@@ -306,17 +306,17 @@ sp_perf_counter_dispatch (gpointer user_data)
for (i = 0; i < self->info->len; i++)
{
- SpPerfCounterInfo *info = g_ptr_array_index (self->info, i);
+ SysprofPerfCounterInfo *info = g_ptr_array_index (self->info, i);
- sp_perf_counter_flush (self, info);
+ sysprof_perf_counter_flush (self, info);
}
return G_SOURCE_CONTINUE;
}
static void
-sp_perf_counter_enable_info (SpPerfCounter *self,
- SpPerfCounterInfo *info)
+sysprof_perf_counter_enable_info (SysprofPerfCounter *self,
+ SysprofPerfCounterInfo *info)
{
g_assert (self != NULL);
g_assert (info != NULL);
@@ -327,22 +327,22 @@ sp_perf_counter_enable_info (SpPerfCounter *self,
g_source_modify_unix_fd (self->source, info->fdtag, G_IO_IN);
}
-SpPerfCounter *
-sp_perf_counter_new (GMainContext *context)
+SysprofPerfCounter *
+sysprof_perf_counter_new (GMainContext *context)
{
- SpPerfCounter *ret;
+ SysprofPerfCounter *ret;
if (context == NULL)
context = g_main_context_default ();
- ret = g_slice_new0 (SpPerfCounter);
+ ret = g_slice_new0 (SysprofPerfCounter);
ret->ref_count = 1;
ret->info = g_ptr_array_new ();
ret->context = g_main_context_ref (context);
ret->source = g_source_new (&source_funcs, sizeof (PerfGSource));
((PerfGSource *)ret->source)->counter = ret;
- g_source_set_callback (ret->source, sp_perf_counter_dispatch, ret, NULL);
+ g_source_set_callback (ret->source, sysprof_perf_counter_dispatch, ret, NULL);
g_source_set_name (ret->source, "[perf]");
g_source_attach (ret->source, context);
@@ -350,7 +350,7 @@ sp_perf_counter_new (GMainContext *context)
}
void
-sp_perf_counter_close (SpPerfCounter *self,
+sysprof_perf_counter_close (SysprofPerfCounter *self,
gint fd)
{
guint i;
@@ -360,25 +360,25 @@ sp_perf_counter_close (SpPerfCounter *self,
for (i = 0; i < self->info->len; i++)
{
- SpPerfCounterInfo *info = g_ptr_array_index (self->info, i);
+ SysprofPerfCounterInfo *info = g_ptr_array_index (self->info, i);
if (info->fd == fd)
{
g_ptr_array_remove_index (self->info, i);
if (self->source)
g_source_remove_unix_fd (self->source, info->fdtag);
- sp_perf_counter_info_free (info);
+ sysprof_perf_counter_info_free (info);
return;
}
}
}
static void
-sp_perf_counter_add_info (SpPerfCounter *self,
+sysprof_perf_counter_add_info (SysprofPerfCounter *self,
int fd,
int cpu)
{
- SpPerfCounterInfo *info;
+ SysprofPerfCounterInfo *info;
guint8 *map;
gsize map_size;
@@ -394,7 +394,7 @@ sp_perf_counter_add_info (SpPerfCounter *self,
return;
}
- info = g_slice_new0 (SpPerfCounterInfo);
+ info = g_slice_new0 (SysprofPerfCounterInfo);
info->fd = fd;
info->map = (gpointer)map;
info->data = map + getpagesize ();
@@ -406,17 +406,17 @@ sp_perf_counter_add_info (SpPerfCounter *self,
info->fdtag = g_source_add_unix_fd (self->source, info->fd, G_IO_ERR);
if (self->enabled)
- sp_perf_counter_enable_info (self, info);
+ sysprof_perf_counter_enable_info (self, info);
}
void
-sp_perf_counter_take_fd (SpPerfCounter *self,
+sysprof_perf_counter_take_fd (SysprofPerfCounter *self,
int fd)
{
g_return_if_fail (self != NULL);
g_return_if_fail (fd > -1);
- sp_perf_counter_add_info (self, fd, -1);
+ sysprof_perf_counter_add_info (self, fd, -1);
}
#ifdef ENABLE_POLKIT
@@ -504,7 +504,7 @@ get_authorized_proxy (void)
}
static void
-sp_perf_counter_ping_cb (GObject *object,
+sysprof_perf_counter_ping_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
@@ -526,7 +526,7 @@ sp_perf_counter_ping_cb (GObject *object,
}
static void
-sp_perf_counter_acquire_cb (GObject *object,
+sysprof_perf_counter_acquire_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
@@ -563,12 +563,12 @@ sp_perf_counter_acquire_cb (GObject *object,
G_DBUS_CALL_FLAGS_NONE,
5000,
g_task_get_cancellable (task),
- sp_perf_counter_ping_cb,
+ sysprof_perf_counter_ping_cb,
g_object_ref (task));
}
static void
-sp_perf_counter_permission_cb (GObject *object,
+sysprof_perf_counter_permission_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
@@ -587,14 +587,14 @@ sp_perf_counter_permission_cb (GObject *object,
g_permission_acquire_async (permission,
g_task_get_cancellable (task),
- sp_perf_counter_acquire_cb,
+ sysprof_perf_counter_acquire_cb,
g_object_ref (task));
g_object_unref (permission);
}
static void
-sp_perf_counter_get_bus_cb (GObject *object,
+sysprof_perf_counter_get_bus_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
@@ -621,7 +621,7 @@ sp_perf_counter_get_bus_cb (GObject *object,
polkit_permission_new ("org.gnome.sysprof2.perf-event-open",
subject,
g_task_get_cancellable (task),
- sp_perf_counter_permission_cb,
+ sysprof_perf_counter_permission_cb,
g_object_ref (task));
g_object_unref (subject);
@@ -630,7 +630,7 @@ sp_perf_counter_get_bus_cb (GObject *object,
#endif
void
-sp_perf_counter_authorize_async (GCancellable *cancellable,
+sysprof_perf_counter_authorize_async (GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -643,7 +643,7 @@ sp_perf_counter_authorize_async (GCancellable *cancellable,
#ifdef ENABLE_POLKIT
g_bus_get (G_BUS_TYPE_SYSTEM,
cancellable,
- sp_perf_counter_get_bus_cb,
+ sysprof_perf_counter_get_bus_cb,
g_object_ref (task));
#else
g_task_return_new_error (task,
@@ -654,7 +654,7 @@ sp_perf_counter_authorize_async (GCancellable *cancellable,
}
gboolean
-sp_perf_counter_authorize_finish (GAsyncResult *result,
+sysprof_perf_counter_authorize_finish (GAsyncResult *result,
GError **error)
{
g_assert (G_IS_TASK (result));
@@ -663,7 +663,7 @@ sp_perf_counter_authorize_finish (GAsyncResult *result,
}
gint
-sp_perf_counter_open (SpPerfCounter *self,
+sysprof_perf_counter_open (SysprofPerfCounter *self,
struct perf_event_attr *attr,
GPid pid,
gint cpu,
@@ -689,7 +689,7 @@ sp_perf_counter_open (SpPerfCounter *self,
*/
if (-1 != (ret = syscall (__NR_perf_event_open, attr, pid, cpu, group_fd, flags)))
{
- sp_perf_counter_take_fd (self, ret);
+ sysprof_perf_counter_take_fd (self, ret);
return ret;
}
@@ -782,15 +782,15 @@ sp_perf_counter_open (SpPerfCounter *self,
return -1;
}
- sp_perf_counter_take_fd (self, ret);
+ sysprof_perf_counter_take_fd (self, ret);
#endif
return ret;
}
void
-sp_perf_counter_set_callback (SpPerfCounter *self,
- SpPerfCounterCallback callback,
+sysprof_perf_counter_set_callback (SysprofPerfCounter *self,
+ SysprofPerfCounterCallback callback,
gpointer callback_data,
GDestroyNotify callback_data_destroy)
{
@@ -805,7 +805,7 @@ sp_perf_counter_set_callback (SpPerfCounter *self,
}
void
-sp_perf_counter_enable (SpPerfCounter *self)
+sysprof_perf_counter_enable (SysprofPerfCounter *self)
{
g_return_if_fail (self != NULL);
@@ -815,15 +815,15 @@ sp_perf_counter_enable (SpPerfCounter *self)
for (i = 0; i < self->info->len; i++)
{
- SpPerfCounterInfo *info = g_ptr_array_index (self->info, i);
+ SysprofPerfCounterInfo *info = g_ptr_array_index (self->info, i);
- sp_perf_counter_enable_info (self, info);
+ sysprof_perf_counter_enable_info (self, info);
}
}
}
void
-sp_perf_counter_disable (SpPerfCounter *self)
+sysprof_perf_counter_disable (SysprofPerfCounter *self)
{
g_return_if_fail (self != NULL);
@@ -833,13 +833,13 @@ sp_perf_counter_disable (SpPerfCounter *self)
for (i = 0; i < self->info->len; i++)
{
- SpPerfCounterInfo *info = g_ptr_array_index (self->info, i);
+ SysprofPerfCounterInfo *info = g_ptr_array_index (self->info, i);
if (0 != ioctl (info->fd, PERF_EVENT_IOC_DISABLE))
g_warning ("Failed to disable counters");
if (!info->in_callback)
- sp_perf_counter_flush (self, info);
+ sysprof_perf_counter_flush (self, info);
g_source_modify_unix_fd (self->source, info->fdtag, G_IO_ERR);
}
diff --git a/src/libsysprof/sp-perf-counter.h b/src/libsysprof/sysprof-perf-counter.h
similarity index 63%
rename from src/libsysprof/sp-perf-counter.h
rename to src/libsysprof/sysprof-perf-counter.h
index 141c140..a325f7c 100644
--- a/src/libsysprof/sp-perf-counter.h
+++ b/src/libsysprof/sysprof-perf-counter.h
@@ -1,4 +1,4 @@
-/* sp-perf-counter.h
+/* sysprof-perf-counter.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -34,9 +34,9 @@ G_BEGIN_DECLS
* These structs are the particular layouts that sysprof requests.
*/
-#define SP_TYPE_PERF_COUNTER (sp_perf_counter_get_type())
+#define SYSPROF_TYPE_PERF_COUNTER (sysprof_perf_counter_get_type())
-typedef struct _SpPerfCounter SpPerfCounter;
+typedef struct _SysprofPerfCounter SysprofPerfCounter;
#pragma pack(push, 1)
@@ -48,7 +48,7 @@ typedef struct
guint32 tid;
guint32 ptid;
guint64 time;
-} SpPerfCounterEventFork;
+} SysprofPerfCounterEventFork;
typedef struct
{
@@ -56,7 +56,7 @@ typedef struct
guint32 pid;
guint32 tid;
gchar comm[0];
-} SpPerfCounterEventComm;
+} SysprofPerfCounterEventComm;
typedef struct
{
@@ -66,7 +66,7 @@ typedef struct
guint32 tid;
guint32 ptid;
guint64 time;
-} SpPerfCounterEventExit;
+} SysprofPerfCounterEventExit;
typedef struct
{
@@ -77,7 +77,7 @@ typedef struct
guint64 len;
guint64 pgoff;
char filename[0];
-} SpPerfCounterEventMmap;
+} SysprofPerfCounterEventMmap;
typedef struct
{
@@ -89,7 +89,7 @@ typedef struct
guint64 time;
guint64 n_ips;
guint64 ips[0];
-} SpPerfCounterEventCallchain;
+} SysprofPerfCounterEventCallchain;
typedef struct
{
@@ -101,53 +101,53 @@ typedef struct
guint64 time;
guint32 raw_size;
guchar raw[];
-} SpPerfCounterEventTracepoint;
+} SysprofPerfCounterEventTracepoint;
typedef union
{
struct perf_event_header header;
guint8 raw[0];
- SpPerfCounterEventFork fork;
- SpPerfCounterEventComm comm;
- SpPerfCounterEventExit exit;
- SpPerfCounterEventMmap mmap;
- SpPerfCounterEventCallchain callchain;
- SpPerfCounterEventTracepoint tracepoint;
-} SpPerfCounterEvent;
+ SysprofPerfCounterEventFork fork;
+ SysprofPerfCounterEventComm comm;
+ SysprofPerfCounterEventExit exit;
+ SysprofPerfCounterEventMmap mmap;
+ SysprofPerfCounterEventCallchain callchain;
+ SysprofPerfCounterEventTracepoint tracepoint;
+} SysprofPerfCounterEvent;
#pragma pack(pop)
-typedef void (*SpPerfCounterCallback) (SpPerfCounterEvent *event,
+typedef void (*SysprofPerfCounterCallback) (SysprofPerfCounterEvent *event,
guint cpu,
gpointer user_data);
-void sp_perf_counter_authorize_async (GCancellable *cancellable,
+void sysprof_perf_counter_authorize_async (GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean sp_perf_counter_authorize_finish (GAsyncResult *result,
+gboolean sysprof_perf_counter_authorize_finish (GAsyncResult *result,
GError **error);
-GType sp_perf_counter_get_type (void);
-SpPerfCounter *sp_perf_counter_new (GMainContext *context);
-void sp_perf_counter_set_callback (SpPerfCounter *self,
- SpPerfCounterCallback callback,
+GType sysprof_perf_counter_get_type (void);
+SysprofPerfCounter *sysprof_perf_counter_new (GMainContext *context);
+void sysprof_perf_counter_set_callback (SysprofPerfCounter *self,
+ SysprofPerfCounterCallback callback,
gpointer callback_data,
GDestroyNotify callback_data_destroy);
-void sp_perf_counter_add_pid (SpPerfCounter *self,
+void sysprof_perf_counter_add_pid (SysprofPerfCounter *self,
GPid pid);
-gint sp_perf_counter_open (SpPerfCounter *self,
+gint sysprof_perf_counter_open (SysprofPerfCounter *self,
struct perf_event_attr *attr,
GPid pid,
gint cpu,
gint group_fd,
gulong flags);
-void sp_perf_counter_take_fd (SpPerfCounter *self,
+void sysprof_perf_counter_take_fd (SysprofPerfCounter *self,
int fd);
-void sp_perf_counter_enable (SpPerfCounter *self);
-void sp_perf_counter_disable (SpPerfCounter *self);
-void sp_perf_counter_close (SpPerfCounter *self,
+void sysprof_perf_counter_enable (SysprofPerfCounter *self);
+void sysprof_perf_counter_disable (SysprofPerfCounter *self);
+void sysprof_perf_counter_close (SysprofPerfCounter *self,
gint fd);
-SpPerfCounter *sp_perf_counter_ref (SpPerfCounter *self);
-void sp_perf_counter_unref (SpPerfCounter *self);
+SysprofPerfCounter *sysprof_perf_counter_ref (SysprofPerfCounter *self);
+void sysprof_perf_counter_unref (SysprofPerfCounter *self);
G_END_DECLS
diff --git a/src/libsysprof/sp-perf-source.c b/src/libsysprof/sysprof-perf-source.c
similarity index 72%
rename from src/libsysprof/sp-perf-source.c
rename to src/libsysprof/sysprof-perf-source.c
index 9ae3b80..5ec5278 100644
--- a/src/libsysprof/sp-perf-source.c
+++ b/src/libsysprof/sysprof-perf-source.c
@@ -1,4 +1,4 @@
-/* sp-perf-source.c
+/* sysprof-perf-source.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -47,28 +47,28 @@
#include <sys/types.h>
#include <unistd.h>
-#include "sp-clock.h"
-#include "sp-line-reader.h"
-#include "sp-perf-counter.h"
-#include "sp-perf-source.h"
+#include "sysprof-clock.h"
+#include "sysprof-line-reader.h"
+#include "sysprof-perf-counter.h"
+#include "sysprof-perf-source.h"
#define N_WAKEUP_EVENTS 149
/* Identifiers for the various tracepoints we might watch for */
-enum SpTracepoint {
+enum SysprofTracepoint {
DRM_VBLANK,
DRM_I915_BEGIN,
DRM_I915_END,
};
typedef struct {
- enum SpTracepoint tp;
+ enum SysprofTracepoint tp;
const char *path;
const char **fields;
-} SpOptionalTracepoint;
+} SysprofOptionalTracepoint;
/* Global list of the optional tracepoints we might want to watch. */
-static const SpOptionalTracepoint optional_tracepoints[] = {
+static const SysprofOptionalTracepoint optional_tracepoints[] = {
/* This event fires just after the vblank IRQ handler starts.
*
* Note that on many platforms when nothing is waiting for vblank
@@ -104,29 +104,29 @@ static const SpOptionalTracepoint optional_tracepoints[] = {
* number and MSC.
*/
typedef struct {
- enum SpTracepoint tp;
+ enum SysprofTracepoint tp;
gsize field_offsets[0];
-} SpTracepointDesc;
+} SysprofTracepointDesc;
-struct _SpPerfSource
+struct _SysprofPerfSource
{
GObject parent_instance;
- SpCaptureWriter *writer;
- SpPerfCounter *counter;
+ SysprofCaptureWriter *writer;
+ SysprofPerfCounter *counter;
GHashTable *pids;
- /* Mapping from perf sample identifiers to SpTracepointDesc. */
+ /* Mapping from perf sample identifiers to SysprofTracepointDesc. */
GHashTable *tracepoint_event_ids;
guint running : 1;
guint is_ready : 1;
};
-static void source_iface_init (SpSourceInterface *iface);
+static void source_iface_init (SysprofSourceInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpPerfSource, sp_perf_source, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SOURCE, source_iface_init))
+G_DEFINE_TYPE_EXTENDED (SysprofPerfSource, sysprof_perf_source, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
enum {
TARGET_EXITED,
@@ -136,43 +136,43 @@ enum {
static guint signals [N_SIGNALS];
static void
-sp_perf_source_real_target_exited (SpPerfSource *self)
+sysprof_perf_source_real_target_exited (SysprofPerfSource *self)
{
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
- sp_source_emit_finished (SP_SOURCE (self));
+ sysprof_source_emit_finished (SYSPROF_SOURCE (self));
}
static void
-sp_perf_source_finalize (GObject *object)
+sysprof_perf_source_finalize (GObject *object)
{
- SpPerfSource *self = (SpPerfSource *)object;
+ SysprofPerfSource *self = (SysprofPerfSource *)object;
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
- g_clear_pointer (&self->counter, sp_perf_counter_unref);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
+ g_clear_pointer (&self->counter, sysprof_perf_counter_unref);
g_clear_pointer (&self->pids, g_hash_table_unref);
g_clear_pointer (&self->tracepoint_event_ids, g_hash_table_unref);
- G_OBJECT_CLASS (sp_perf_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_perf_source_parent_class)->finalize (object);
}
static void
-sp_perf_source_class_init (SpPerfSourceClass *klass)
+sysprof_perf_source_class_init (SysprofPerfSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_perf_source_finalize;
+ object_class->finalize = sysprof_perf_source_finalize;
signals [TARGET_EXITED] =
g_signal_new_class_handler ("target-exited",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_CALLBACK (sp_perf_source_real_target_exited),
+ G_CALLBACK (sysprof_perf_source_real_target_exited),
NULL, NULL, NULL, G_TYPE_NONE, 0);
}
static void
-sp_perf_source_init (SpPerfSource *self)
+sysprof_perf_source_init (SysprofPerfSource *self)
{
self->pids = g_hash_table_new (NULL, NULL);
self->tracepoint_event_ids = g_hash_table_new (NULL, NULL);
@@ -181,7 +181,7 @@ sp_perf_source_init (SpPerfSource *self)
static gboolean
do_emit_exited (gpointer data)
{
- g_autoptr(SpPerfSource) self = data;
+ g_autoptr(SysprofPerfSource) self = data;
g_signal_emit (self, signals [TARGET_EXITED], 0);
@@ -189,15 +189,15 @@ do_emit_exited (gpointer data)
}
static void
-sp_perf_source_handle_tracepoint (SpPerfSource *self,
+sysprof_perf_source_handle_tracepoint (SysprofPerfSource *self,
gint cpu,
- const SpPerfCounterEventTracepoint *sample,
- SpTracepointDesc *tp_desc)
+ const SysprofPerfCounterEventTracepoint *sample,
+ SysprofTracepointDesc *tp_desc)
{
gchar *message = NULL;
/* Note that field_offsets[] correspond to the
- * SpOptionalTracepoint->fields[] strings. Yes, this is gross.
+ * SysprofOptionalTracepoint->fields[] strings. Yes, this is gross.
*/
switch (tp_desc->tp)
{
@@ -208,7 +208,7 @@ sp_perf_source_handle_tracepoint (SpPerfSource *self,
*(guint *)(sample->raw +
tp_desc->field_offsets[1]));
- sp_capture_writer_add_mark (self->writer,
+ sysprof_capture_writer_add_mark (self->writer,
sample->time,
cpu,
sample->pid,
@@ -228,7 +228,7 @@ sp_perf_source_handle_tracepoint (SpPerfSource *self,
*(guint *)(sample->raw +
tp_desc->field_offsets[2]));
- sp_capture_writer_add_mark (self->writer,
+ sysprof_capture_writer_add_mark (self->writer,
sample->time,
cpu,
sample->pid,
@@ -247,15 +247,15 @@ sp_perf_source_handle_tracepoint (SpPerfSource *self,
}
static void
-sp_perf_source_handle_callchain (SpPerfSource *self,
+sysprof_perf_source_handle_callchain (SysprofPerfSource *self,
gint cpu,
- const SpPerfCounterEventCallchain *sample)
+ const SysprofPerfCounterEventCallchain *sample)
{
const guint64 *ips;
gint n_ips;
guint64 trace[3];
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
g_assert (sample != NULL);
ips = sample->ips;
@@ -282,7 +282,7 @@ sp_perf_source_handle_callchain (SpPerfSource *self,
}
}
- sp_capture_writer_add_sample (self->writer,
+ sysprof_capture_writer_add_sample (self->writer,
sample->time,
cpu,
sample->pid,
@@ -299,16 +299,16 @@ realign (gsize *pos,
}
static void
-sp_perf_source_handle_event (SpPerfCounterEvent *event,
+sysprof_perf_source_handle_event (SysprofPerfCounterEvent *event,
guint cpu,
gpointer user_data)
{
- SpPerfSource *self = user_data;
- SpTracepointDesc *tp_desc;
+ SysprofPerfSource *self = user_data;
+ SysprofTracepointDesc *tp_desc;
gsize offset;
gint64 time;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
g_assert (event != NULL);
switch (event->header.type)
@@ -319,7 +319,7 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
offset += sizeof (GPid) + sizeof (GPid);
memcpy (&time, event->comm.comm + offset, sizeof time);
- sp_capture_writer_add_process (self->writer,
+ sysprof_capture_writer_add_process (self->writer,
time,
cpu,
event->comm.pid,
@@ -328,7 +328,7 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
break;
case PERF_RECORD_EXIT:
- sp_capture_writer_add_exit (self->writer,
+ sysprof_capture_writer_add_exit (self->writer,
event->exit.time,
cpu,
event->exit.pid);
@@ -340,7 +340,7 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
if (self->running && (g_hash_table_size (self->pids) == 0))
{
self->running = FALSE;
- sp_perf_counter_disable (self->counter);
+ sysprof_perf_counter_disable (self->counter);
g_timeout_add (0, do_emit_exited, g_object_ref (self));
}
}
@@ -348,7 +348,7 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
break;
case PERF_RECORD_FORK:
- sp_capture_writer_add_fork (self->writer,
+ sysprof_capture_writer_add_fork (self->writer,
event->fork.time,
cpu,
event->fork.ppid,
@@ -370,7 +370,7 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
offset += sizeof (GPid) + sizeof (GPid);
memcpy (&time, event->mmap.filename + offset, sizeof time);
- sp_capture_writer_add_map (self->writer,
+ sysprof_capture_writer_add_map (self->writer,
time,
cpu,
event->mmap.pid,
@@ -394,12 +394,12 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
GINT_TO_POINTER (event->callchain.identifier));
if (tp_desc)
{
- sp_perf_source_handle_tracepoint (self, cpu, &event->tracepoint,
+ sysprof_perf_source_handle_tracepoint (self, cpu, &event->tracepoint,
tp_desc);
}
else
{
- sp_perf_source_handle_callchain (self, cpu, &event->callchain);
+ sysprof_perf_source_handle_callchain (self, cpu, &event->callchain);
}
break;
@@ -411,7 +411,7 @@ sp_perf_source_handle_event (SpPerfCounterEvent *event,
}
static gboolean
-sp_perf_get_tracepoint_config (const char *path, gint64 *config)
+sysprof_perf_get_tracepoint_config (const char *path, gint64 *config)
{
gchar *filename = NULL;
gchar *contents;
@@ -437,8 +437,8 @@ sp_perf_get_tracepoint_config (const char *path, gint64 *config)
}
static gboolean
-sp_perf_get_tracepoint_fields (SpTracepointDesc *tp_desc,
- const SpOptionalTracepoint *optional_tp,
+sysprof_perf_get_tracepoint_fields (SysprofTracepointDesc *tp_desc,
+ const SysprofOptionalTracepoint *optional_tp,
GError **error)
{
gchar *filename = NULL;
@@ -510,14 +510,14 @@ sp_perf_get_tracepoint_fields (SpTracepointDesc *tp_desc,
* when present, but may be kernel version or driver-specific.
*/
static void
-sp_perf_source_add_optional_tracepoint (SpPerfSource *self,
+sysprof_perf_source_add_optional_tracepoint (SysprofPerfSource *self,
GPid pid,
gint cpu,
- const SpOptionalTracepoint *optional_tracepoint,
+ const SysprofOptionalTracepoint *optional_tracepoint,
GError **error)
{
struct perf_event_attr attr = { 0 };
- SpTracepointDesc *tp_desc;
+ SysprofTracepointDesc *tp_desc;
gulong flags = 0;
gint fd;
gint64 config;
@@ -525,7 +525,7 @@ sp_perf_source_add_optional_tracepoint (SpPerfSource *self,
int ret;
gint num_fields;
- if (!sp_perf_get_tracepoint_config(optional_tracepoint->path, &config))
+ if (!sysprof_perf_get_tracepoint_config(optional_tracepoint->path, &config))
return;
attr.type = PERF_TYPE_TRACEPOINT;
@@ -539,13 +539,13 @@ sp_perf_source_add_optional_tracepoint (SpPerfSource *self,
attr.sample_period = 1;
#ifdef HAVE_PERF_CLOCKID
- attr.clockid = sp_clock;
+ attr.clockid = sysprof_clock;
attr.use_clockid = 1;
#endif
attr.size = sizeof attr;
- fd = sp_perf_counter_open (self->counter, &attr, pid, cpu, -1, flags);
+ fd = sysprof_perf_counter_open (self->counter, &attr, pid, cpu, -1, flags);
ret = ioctl (fd, PERF_EVENT_IOC_ID, &id);
if (ret != 0)
@@ -572,7 +572,7 @@ sp_perf_source_add_optional_tracepoint (SpPerfSource *self,
tp_desc->tp = optional_tracepoint->tp;
- if (!sp_perf_get_tracepoint_fields (tp_desc, optional_tracepoint, error))
+ if (!sysprof_perf_get_tracepoint_fields (tp_desc, optional_tracepoint, error))
{
free(tp_desc);
close(fd);
@@ -592,7 +592,7 @@ sp_perf_source_add_optional_tracepoint (SpPerfSource *self,
}
static gboolean
-sp_perf_source_start_pid (SpPerfSource *self,
+sysprof_perf_source_start_pid (SysprofPerfSource *self,
GPid pid,
GError **error)
{
@@ -603,7 +603,7 @@ sp_perf_source_start_pid (SpPerfSource *self,
gint fd;
gint i;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
attr.sample_type = PERF_SAMPLE_IP
| PERF_SAMPLE_TID
@@ -619,7 +619,7 @@ sp_perf_source_start_pid (SpPerfSource *self,
attr.sample_id_all = 1;
#ifdef HAVE_PERF_CLOCKID
- attr.clockid = sp_clock;
+ attr.clockid = sysprof_clock;
attr.use_clockid = 1;
#endif
@@ -640,7 +640,7 @@ sp_perf_source_start_pid (SpPerfSource *self,
attr.config = PERF_COUNT_HW_CPU_CYCLES;
attr.sample_period = 1200000;
- fd = sp_perf_counter_open (self->counter, &attr, pid, cpu, -1, flags);
+ fd = sysprof_perf_counter_open (self->counter, &attr, pid, cpu, -1, flags);
if (fd == -1)
{
@@ -654,7 +654,7 @@ sp_perf_source_start_pid (SpPerfSource *self,
errno = 0;
- fd = sp_perf_counter_open (self->counter, &attr, pid, cpu, -1, flags);
+ fd = sysprof_perf_counter_open (self->counter, &attr, pid, cpu, -1, flags);
if (fd == -1)
{
@@ -670,7 +670,7 @@ sp_perf_source_start_pid (SpPerfSource *self,
_("An error occurred while attempting to access performance counters: %s"),
g_strerror (errno));
- sp_source_stop (SP_SOURCE (self));
+ sysprof_source_stop (SYSPROF_SOURCE (self));
return FALSE;
}
@@ -678,7 +678,7 @@ sp_perf_source_start_pid (SpPerfSource *self,
for (i = 0; i < G_N_ELEMENTS(optional_tracepoints); i++)
{
- sp_perf_source_add_optional_tracepoint (self, pid, cpu,
+ sysprof_perf_source_add_optional_tracepoint (self, pid, cpu,
&optional_tracepoints[i],
error);
}
@@ -688,17 +688,17 @@ sp_perf_source_start_pid (SpPerfSource *self,
}
static void
-sp_perf_source_start (SpSource *source)
+sysprof_perf_source_start (SysprofSource *source)
{
- SpPerfSource *self = (SpPerfSource *)source;
+ SysprofPerfSource *self = (SysprofPerfSource *)source;
g_autoptr(GError) error = NULL;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
- self->counter = sp_perf_counter_new (NULL);
+ self->counter = sysprof_perf_counter_new (NULL);
- sp_perf_counter_set_callback (self->counter,
- sp_perf_source_handle_event,
+ sysprof_perf_counter_set_callback (self->counter,
+ sysprof_perf_source_handle_event,
self, NULL);
if (g_hash_table_size (self->pids) > 0)
@@ -712,66 +712,66 @@ sp_perf_source_start (SpSource *source)
{
GPid pid = GPOINTER_TO_INT (key);
- if (!sp_perf_source_start_pid (self, pid, &error))
+ if (!sysprof_perf_source_start_pid (self, pid, &error))
{
- sp_source_emit_failed (source, error);
+ sysprof_source_emit_failed (source, error);
return;
}
}
}
else
{
- if (!sp_perf_source_start_pid (self, -1, &error))
+ if (!sysprof_perf_source_start_pid (self, -1, &error))
{
- sp_source_emit_failed (source, error);
+ sysprof_source_emit_failed (source, error);
return;
}
}
self->running = TRUE;
- sp_perf_counter_enable (self->counter);
+ sysprof_perf_counter_enable (self->counter);
- sp_source_emit_ready (source);
+ sysprof_source_emit_ready (source);
}
static void
-sp_perf_source_stop (SpSource *source)
+sysprof_perf_source_stop (SysprofSource *source)
{
- SpPerfSource *self = (SpPerfSource *)source;
+ SysprofPerfSource *self = (SysprofPerfSource *)source;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
if (self->running)
{
self->running = FALSE;
- sp_perf_counter_disable (self->counter);
+ sysprof_perf_counter_disable (self->counter);
}
- g_clear_pointer (&self->counter, sp_perf_counter_unref);
+ g_clear_pointer (&self->counter, sysprof_perf_counter_unref);
- sp_source_emit_finished (source);
+ sysprof_source_emit_finished (source);
}
static void
-sp_perf_source_set_writer (SpSource *source,
- SpCaptureWriter *writer)
+sysprof_perf_source_set_writer (SysprofSource *source,
+ SysprofCaptureWriter *writer)
{
- SpPerfSource *self = (SpPerfSource *)source;
+ SysprofPerfSource *self = (SysprofPerfSource *)source;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
g_assert (writer != NULL);
- self->writer = sp_capture_writer_ref (writer);
+ self->writer = sysprof_capture_writer_ref (writer);
}
static void
-sp_perf_source_add_pid (SpSource *source,
+sysprof_perf_source_add_pid (SysprofSource *source,
GPid pid)
{
- SpPerfSource *self = (SpPerfSource *)source;
+ SysprofPerfSource *self = (SysprofPerfSource *)source;
- g_return_if_fail (SP_IS_PERF_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_PERF_SOURCE (self));
g_return_if_fail (pid >= -1);
g_return_if_fail (self->writer == NULL);
@@ -779,34 +779,34 @@ sp_perf_source_add_pid (SpSource *source,
}
static void
-sp_perf_source_emit_ready (SpPerfSource *self)
+sysprof_perf_source_emit_ready (SysprofPerfSource *self)
{
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
self->is_ready = TRUE;
- sp_source_emit_ready (SP_SOURCE (self));
+ sysprof_source_emit_ready (SYSPROF_SOURCE (self));
}
static void
-sp_perf_source_authorize_cb (GObject *object,
+sysprof_perf_source_authorize_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- g_autoptr(SpPerfSource) self = user_data;
+ g_autoptr(SysprofPerfSource) self = user_data;
g_autoptr(GError) error = NULL;
g_assert (G_IS_ASYNC_RESULT (result));
- if (!sp_perf_counter_authorize_finish (result, &error))
+ if (!sysprof_perf_counter_authorize_finish (result, &error))
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
{
- sp_source_emit_failed (SP_SOURCE (self), error);
+ sysprof_source_emit_failed (SYSPROF_SOURCE (self), error);
return;
}
}
- sp_perf_source_emit_ready (self);
+ sysprof_perf_source_emit_ready (self);
}
static gboolean
@@ -815,7 +815,7 @@ user_owns_pid (uid_t uid,
{
g_autofree gchar *contents = NULL;
g_autofree gchar *path = NULL;
- g_autoptr(SpLineReader) reader = NULL;
+ g_autoptr(SysprofLineReader) reader = NULL;
gchar *line;
gsize len;
gsize line_len;
@@ -825,9 +825,9 @@ user_owns_pid (uid_t uid,
if (!g_file_get_contents (path, &contents, &len, NULL))
return FALSE;
- reader = sp_line_reader_new (contents, len);
+ reader = sysprof_line_reader_new (contents, len);
- while (NULL != (line = (gchar *)sp_line_reader_next (reader, &line_len)))
+ while (NULL != (line = (gchar *)sysprof_line_reader_next (reader, &line_len)))
{
if (g_str_has_prefix (line, "Uid:"))
{
@@ -856,13 +856,13 @@ user_owns_pid (uid_t uid,
}
static gboolean
-sp_perf_source_needs_auth (SpPerfSource *self)
+sysprof_perf_source_needs_auth (SysprofPerfSource *self)
{
GHashTableIter iter;
gpointer key;
uid_t uid;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
if (g_hash_table_size (self->pids) == 0)
return TRUE;
@@ -883,56 +883,56 @@ sp_perf_source_needs_auth (SpPerfSource *self)
}
static void
-sp_perf_source_prepare (SpSource *source)
+sysprof_perf_source_prepare (SysprofSource *source)
{
- SpPerfSource *self = (SpPerfSource *)source;
+ SysprofPerfSource *self = (SysprofPerfSource *)source;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
- if (sp_perf_source_needs_auth (self))
- sp_perf_counter_authorize_async (NULL,
- sp_perf_source_authorize_cb,
+ if (sysprof_perf_source_needs_auth (self))
+ sysprof_perf_counter_authorize_async (NULL,
+ sysprof_perf_source_authorize_cb,
g_object_ref (self));
else
- sp_perf_source_emit_ready (self);
+ sysprof_perf_source_emit_ready (self);
}
static gboolean
-sp_perf_source_get_is_ready (SpSource *source)
+sysprof_perf_source_get_is_ready (SysprofSource *source)
{
- SpPerfSource *self = (SpPerfSource *)source;
+ SysprofPerfSource *self = (SysprofPerfSource *)source;
- g_assert (SP_IS_PERF_SOURCE (self));
+ g_assert (SYSPROF_IS_PERF_SOURCE (self));
return self->is_ready;
}
static void
-source_iface_init (SpSourceInterface *iface)
+source_iface_init (SysprofSourceInterface *iface)
{
- iface->start = sp_perf_source_start;
- iface->stop = sp_perf_source_stop;
- iface->set_writer = sp_perf_source_set_writer;
- iface->add_pid = sp_perf_source_add_pid;
- iface->prepare = sp_perf_source_prepare;
- iface->get_is_ready = sp_perf_source_get_is_ready;
+ iface->start = sysprof_perf_source_start;
+ iface->stop = sysprof_perf_source_stop;
+ iface->set_writer = sysprof_perf_source_set_writer;
+ iface->add_pid = sysprof_perf_source_add_pid;
+ iface->prepare = sysprof_perf_source_prepare;
+ iface->get_is_ready = sysprof_perf_source_get_is_ready;
}
-SpSource *
-sp_perf_source_new (void)
+SysprofSource *
+sysprof_perf_source_new (void)
{
- return g_object_new (SP_TYPE_PERF_SOURCE, NULL);
+ return g_object_new (SYSPROF_TYPE_PERF_SOURCE, NULL);
}
void
-sp_perf_source_set_target_pid (SpPerfSource *self,
+sysprof_perf_source_set_target_pid (SysprofPerfSource *self,
GPid pid)
{
- g_return_if_fail (SP_IS_PERF_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_PERF_SOURCE (self));
g_return_if_fail (pid >= -1);
if (pid == -1)
g_hash_table_remove_all (self->pids);
else
- sp_perf_source_add_pid (SP_SOURCE (self), pid);
+ sysprof_perf_source_add_pid (SYSPROF_SOURCE (self), pid);
}
diff --git a/src/libsysprof/sp-perf-source.h b/src/libsysprof/sysprof-perf-source.h
similarity index 74%
rename from src/libsysprof/sp-perf-source.h
rename to src/libsysprof/sysprof-perf-source.h
index 1be7989..11af876 100644
--- a/src/libsysprof/sp-perf-source.h
+++ b/src/libsysprof/sysprof-perf-source.h
@@ -1,4 +1,4 @@
-/* sp-perf-source.h
+/* sysprof-perf-source.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,19 +22,19 @@
#include "sysprof-version-macros.h"
-#include "sp-source.h"
+#include "sysprof-source.h"
G_BEGIN_DECLS
-#define SP_TYPE_PERF_SOURCE (sp_perf_source_get_type())
+#define SYSPROF_TYPE_PERF_SOURCE (sysprof_perf_source_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpPerfSource, sp_perf_source, SP, PERF_SOURCE, GObject)
+G_DECLARE_FINAL_TYPE (SysprofPerfSource, sysprof_perf_source, SYSPROF, PERF_SOURCE, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpSource *sp_perf_source_new (void);
+SysprofSource *sysprof_perf_source_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_perf_source_set_target_pid (SpPerfSource *self,
+void sysprof_perf_source_set_target_pid (SysprofPerfSource *self,
GPid pid);
G_END_DECLS
diff --git a/src/libsysprof/sp-proc-source.c b/src/libsysprof/sysprof-proc-source.c
similarity index 77%
rename from src/libsysprof/sp-proc-source.c
rename to src/libsysprof/sysprof-proc-source.c
index 80e48ed..8e3ec27 100644
--- a/src/libsysprof/sp-proc-source.c
+++ b/src/libsysprof/sysprof-proc-source.c
@@ -1,4 +1,4 @@
-/* sp-proc-source.c
+/* sysprof-proc-source.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -43,22 +43,22 @@
#include <stdlib.h>
#include <string.h>
-#include "sp-proc-source.h"
+#include "sysprof-proc-source.h"
-struct _SpProcSource
+struct _SysprofProcSource
{
GObject parent_instance;
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
GArray *pids;
};
-static void source_iface_init (SpSourceInterface *iface);
+static void source_iface_init (SysprofSourceInterface *iface);
static gchar **proc_readlines (const gchar *format,
...)
G_GNUC_PRINTF (1, 2);
-G_DEFINE_TYPE_EXTENDED (SpProcSource, sp_proc_source, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (SP_TYPE_SOURCE, source_iface_init))
+G_DEFINE_TYPE_EXTENDED (SysprofProcSource, sysprof_proc_source, G_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
static gchar **
proc_readlines (const gchar *format,
@@ -86,7 +86,7 @@ proc_readlines (const gchar *format,
}
gchar *
-sp_proc_source_get_command_line (GPid pid,
+sysprof_proc_source_get_command_line (GPid pid,
gboolean *is_kernel)
{
gchar *ret;
@@ -136,18 +136,18 @@ sp_proc_source_get_command_line (GPid pid,
}
static void
-sp_proc_source_populate_process (SpProcSource *self,
+sysprof_proc_source_populate_process (SysprofProcSource *self,
GPid pid)
{
gchar *cmdline;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
g_assert (pid > 0);
- if (NULL != (cmdline = sp_proc_source_get_command_line (pid, NULL)))
+ if (NULL != (cmdline = sysprof_proc_source_get_command_line (pid, NULL)))
{
- sp_capture_writer_add_process (self->writer,
- SP_CAPTURE_CURRENT_TIME,
+ sysprof_capture_writer_add_process (self->writer,
+ SYSPROF_CAPTURE_CURRENT_TIME,
-1,
pid,
cmdline);
@@ -197,7 +197,7 @@ find_mount (GStrv mounts,
}
/**
- * sp_proc_source_translate_path:
+ * sysprof_proc_source_translate_path:
* @file: the path to the file inside target mount namespace
* @mountinfo: mount info to locate translated path
* @out_file: (out): location for the translated path
@@ -210,7 +210,7 @@ find_mount (GStrv mounts,
* The result is stored in @out_file and will always be NULL terminated.
*/
static void
-sp_proc_source_translate_path (const gchar *file,
+sysprof_proc_source_translate_path (const gchar *file,
GStrv mountinfo,
GStrv mounts,
gchar *out_file,
@@ -297,7 +297,7 @@ failure:
}
static void
-sp_proc_source_populate_maps (SpProcSource *self,
+sysprof_proc_source_populate_maps (SysprofProcSource *self,
GPid pid,
GStrv mounts)
{
@@ -305,7 +305,7 @@ sp_proc_source_populate_maps (SpProcSource *self,
g_auto(GStrv) mountinfo = NULL;
guint i;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
g_assert (pid > 0);
if (NULL == (lines = proc_readlines ("/proc/%d/maps", pid)))
@@ -359,7 +359,7 @@ sp_proc_source_populate_maps (SpProcSource *self,
* look at /proc/$pid/mountinfo to locate the longest-common-prefix
* for the path.
*/
- sp_proc_source_translate_path (file,
+ sysprof_proc_source_translate_path (file,
mountinfo,
mounts,
translated,
@@ -367,8 +367,8 @@ sp_proc_source_populate_maps (SpProcSource *self,
fileptr = translated;
}
- sp_capture_writer_add_map (self->writer,
- SP_CAPTURE_CURRENT_TIME,
+ sysprof_capture_writer_add_map (self->writer,
+ SYSPROF_CAPTURE_CURRENT_TIME,
-1,
pid,
start,
@@ -380,13 +380,13 @@ sp_proc_source_populate_maps (SpProcSource *self,
}
static void
-sp_proc_source_populate (SpProcSource *self)
+sysprof_proc_source_populate (SysprofProcSource *self)
{
g_auto(GStrv) mounts = NULL;
const gchar *name;
GDir *dir;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
if (NULL == (mounts = proc_readlines ("/proc/mounts")))
return;
@@ -399,8 +399,8 @@ sp_proc_source_populate (SpProcSource *self)
{
GPid pid = g_array_index (self->pids, GPid, i);
- sp_proc_source_populate_process (self, pid);
- sp_proc_source_populate_maps (self, pid, mounts);
+ sysprof_proc_source_populate_process (self, pid);
+ sysprof_proc_source_populate_maps (self, pid, mounts);
}
return;
@@ -418,55 +418,55 @@ sp_proc_source_populate (SpProcSource *self)
if (pid <= 0 || *end != '\0')
continue;
- sp_proc_source_populate_process (self, pid);
- sp_proc_source_populate_maps (self, pid, mounts);
+ sysprof_proc_source_populate_process (self, pid);
+ sysprof_proc_source_populate_maps (self, pid, mounts);
}
g_dir_close (dir);
}
static void
-sp_proc_source_start (SpSource *source)
+sysprof_proc_source_start (SysprofSource *source)
{
- SpProcSource *self = (SpProcSource *)source;
+ SysprofProcSource *self = (SysprofProcSource *)source;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
g_assert (self->writer != NULL);
- sp_proc_source_populate (self);
- sp_source_emit_finished (source);
+ sysprof_proc_source_populate (self);
+ sysprof_source_emit_finished (source);
}
static void
-sp_proc_source_stop (SpSource *source)
+sysprof_proc_source_stop (SysprofSource *source)
{
- SpProcSource *self = (SpProcSource *)source;
+ SysprofProcSource *self = (SysprofProcSource *)source;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
}
static void
-sp_proc_source_set_writer (SpSource *source,
- SpCaptureWriter *writer)
+sysprof_proc_source_set_writer (SysprofSource *source,
+ SysprofCaptureWriter *writer)
{
- SpProcSource *self = (SpProcSource *)source;
+ SysprofProcSource *self = (SysprofProcSource *)source;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
g_assert (writer != NULL);
- self->writer = sp_capture_writer_ref (writer);
+ self->writer = sysprof_capture_writer_ref (writer);
}
static void
-sp_proc_source_add_pid (SpSource *source,
+sysprof_proc_source_add_pid (SysprofSource *source,
GPid pid)
{
- SpProcSource *self = (SpProcSource *)source;
+ SysprofProcSource *self = (SysprofProcSource *)source;
guint i;
- g_assert (SP_IS_PROC_SOURCE (self));
+ g_assert (SYSPROF_IS_PROC_SOURCE (self));
g_assert (pid > -1);
for (i = 0; i < self->pids->len; i++)
@@ -481,41 +481,41 @@ sp_proc_source_add_pid (SpSource *source,
}
static void
-source_iface_init (SpSourceInterface *iface)
+source_iface_init (SysprofSourceInterface *iface)
{
- iface->set_writer = sp_proc_source_set_writer;
- iface->start = sp_proc_source_start;
- iface->stop = sp_proc_source_stop;
- iface->add_pid = sp_proc_source_add_pid;
+ iface->set_writer = sysprof_proc_source_set_writer;
+ iface->start = sysprof_proc_source_start;
+ iface->stop = sysprof_proc_source_stop;
+ iface->add_pid = sysprof_proc_source_add_pid;
}
static void
-sp_proc_source_finalize (GObject *object)
+sysprof_proc_source_finalize (GObject *object)
{
- SpProcSource *self = (SpProcSource *)object;
+ SysprofProcSource *self = (SysprofProcSource *)object;
- g_clear_pointer (&self->writer, sp_capture_writer_unref);
+ g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
g_clear_pointer (&self->pids, g_array_unref);
- G_OBJECT_CLASS (sp_proc_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_proc_source_parent_class)->finalize (object);
}
static void
-sp_proc_source_class_init (SpProcSourceClass *klass)
+sysprof_proc_source_class_init (SysprofProcSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_proc_source_finalize;
+ object_class->finalize = sysprof_proc_source_finalize;
}
static void
-sp_proc_source_init (SpProcSource *self)
+sysprof_proc_source_init (SysprofProcSource *self)
{
self->pids = g_array_new (FALSE, FALSE, sizeof (GPid));
}
-SpSource *
-sp_proc_source_new (void)
+SysprofSource *
+sysprof_proc_source_new (void)
{
- return g_object_new (SP_TYPE_PROC_SOURCE, NULL);
+ return g_object_new (SYSPROF_TYPE_PROC_SOURCE, NULL);
}
diff --git a/src/libsysprof/sp-proc-source.h b/src/libsysprof/sysprof-proc-source.h
similarity index 74%
rename from src/libsysprof/sp-proc-source.h
rename to src/libsysprof/sysprof-proc-source.h
index bdfd7dd..6124245 100644
--- a/src/libsysprof/sp-proc-source.h
+++ b/src/libsysprof/sysprof-proc-source.h
@@ -1,4 +1,4 @@
-/* sp-proc-source.h
+/* sysprof-proc-source.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,19 +22,19 @@
#include "sysprof-version-macros.h"
-#include "sp-source.h"
+#include "sysprof-source.h"
G_BEGIN_DECLS
-#define SP_TYPE_PROC_SOURCE (sp_proc_source_get_type())
+#define SYSPROF_TYPE_PROC_SOURCE (sysprof_proc_source_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpProcSource, sp_proc_source, SP, PROC_SOURCE, GObject)
+G_DECLARE_FINAL_TYPE (SysprofProcSource, sysprof_proc_source, SYSPROF, PROC_SOURCE, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpSource *sp_proc_source_new (void);
+SysprofSource *sysprof_proc_source_new (void);
SYSPROF_AVAILABLE_IN_ALL
-gchar *sp_proc_source_get_command_line (GPid pid,
+gchar *sysprof_proc_source_get_command_line (GPid pid,
gboolean *is_kernel);
G_END_DECLS
diff --git a/src/libsysprof/sp-process-model-item.c b/src/libsysprof/sysprof-process-model-item.c
similarity index 65%
rename from src/libsysprof/sp-process-model-item.c
rename to src/libsysprof/sysprof-process-model-item.c
index 00b5b79..3b3c8f2 100644
--- a/src/libsysprof/sp-process-model-item.c
+++ b/src/libsysprof/sysprof-process-model-item.c
@@ -1,4 +1,4 @@
-/* sp-process-model-item.c
+/* sysprof-process-model-item.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,12 +22,12 @@
#include <string.h>
-#include "sp-process-model-item.h"
+#include "sysprof-process-model-item.h"
#ifdef __linux__
-# include "sp-proc-source.h"
+# include "sysprof-proc-source.h"
#endif
-struct _SpProcessModelItem
+struct _SysprofProcessModelItem
{
GObject parent_instance;
GPid pid;
@@ -36,7 +36,7 @@ struct _SpProcessModelItem
guint is_kernel : 1;
};
-G_DEFINE_TYPE (SpProcessModelItem, sp_process_model_item, G_TYPE_OBJECT)
+G_DEFINE_TYPE (SysprofProcessModelItem, sysprof_process_model_item, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -48,23 +48,23 @@ enum {
static GParamSpec *properties [N_PROPS];
static void
-sp_process_model_item_finalize (GObject *object)
+sysprof_process_model_item_finalize (GObject *object)
{
- SpProcessModelItem *self = (SpProcessModelItem *)object;
+ SysprofProcessModelItem *self = (SysprofProcessModelItem *)object;
g_clear_pointer (&self->command_line, g_free);
g_clear_pointer (&self->argv, g_strfreev);
- G_OBJECT_CLASS (sp_process_model_item_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_process_model_item_parent_class)->finalize (object);
}
static void
-sp_process_model_item_get_property (GObject *object,
+sysprof_process_model_item_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpProcessModelItem *self = SP_PROCESS_MODEL_ITEM (object);
+ SysprofProcessModelItem *self = SYSPROF_PROCESS_MODEL_ITEM (object);
switch (prop_id)
{
@@ -82,12 +82,12 @@ sp_process_model_item_get_property (GObject *object,
}
static void
-sp_process_model_item_set_property (GObject *object,
+sysprof_process_model_item_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- SpProcessModelItem *self = SP_PROCESS_MODEL_ITEM (object);
+ SysprofProcessModelItem *self = SYSPROF_PROCESS_MODEL_ITEM (object);
switch (prop_id)
{
@@ -105,13 +105,13 @@ sp_process_model_item_set_property (GObject *object,
}
static void
-sp_process_model_item_class_init (SpProcessModelItemClass *klass)
+sysprof_process_model_item_class_init (SysprofProcessModelItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_process_model_item_finalize;
- object_class->get_property = sp_process_model_item_get_property;
- object_class->set_property = sp_process_model_item_set_property;
+ object_class->finalize = sysprof_process_model_item_finalize;
+ object_class->get_property = sysprof_process_model_item_get_property;
+ object_class->set_property = sysprof_process_model_item_set_property;
properties [PROP_COMMAND_LINE] =
g_param_spec_string ("command-line",
@@ -133,22 +133,22 @@ sp_process_model_item_class_init (SpProcessModelItemClass *klass)
}
static void
-sp_process_model_item_init (SpProcessModelItem *self)
+sysprof_process_model_item_init (SysprofProcessModelItem *self)
{
}
-SpProcessModelItem *
-sp_process_model_item_new (GPid pid)
+SysprofProcessModelItem *
+sysprof_process_model_item_new (GPid pid)
{
g_autofree gchar *cmdline = NULL;
- SpProcessModelItem *ret;
+ SysprofProcessModelItem *ret;
gboolean is_kernel = FALSE;
#ifdef __linux__
- cmdline = sp_proc_source_get_command_line (pid, &is_kernel);
+ cmdline = sysprof_proc_source_get_command_line (pid, &is_kernel);
#endif
- ret = g_object_new (SP_TYPE_PROCESS_MODEL_ITEM,
+ ret = g_object_new (SYSPROF_TYPE_PROCESS_MODEL_ITEM,
"command-line", cmdline,
"pid", (int)pid,
NULL);
@@ -158,50 +158,50 @@ sp_process_model_item_new (GPid pid)
}
guint
-sp_process_model_item_hash (SpProcessModelItem *self)
+sysprof_process_model_item_hash (SysprofProcessModelItem *self)
{
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ITEM (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ITEM (self), 0);
return self->pid;
}
gboolean
-sp_process_model_item_equal (SpProcessModelItem *self,
- SpProcessModelItem *other)
+sysprof_process_model_item_equal (SysprofProcessModelItem *self,
+ SysprofProcessModelItem *other)
{
- g_assert (SP_IS_PROCESS_MODEL_ITEM (self));
- g_assert (SP_IS_PROCESS_MODEL_ITEM (other));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (self));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (other));
return ((self->pid == other->pid) &&
(g_strcmp0 (self->command_line, other->command_line) == 0));
}
GPid
-sp_process_model_item_get_pid (SpProcessModelItem *self)
+sysprof_process_model_item_get_pid (SysprofProcessModelItem *self)
{
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ITEM (self), 0);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ITEM (self), 0);
return self->pid;
}
const gchar *
-sp_process_model_item_get_command_line (SpProcessModelItem *self)
+sysprof_process_model_item_get_command_line (SysprofProcessModelItem *self)
{
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ITEM (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ITEM (self), NULL);
return self->command_line;
}
gboolean
-sp_process_model_item_is_kernel (SpProcessModelItem *self)
+sysprof_process_model_item_is_kernel (SysprofProcessModelItem *self)
{
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ITEM (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ITEM (self), FALSE);
return self->is_kernel;
}
const gchar * const *
-sp_process_model_item_get_argv (SpProcessModelItem *self)
+sysprof_process_model_item_get_argv (SysprofProcessModelItem *self)
{
g_autofree gchar *contents = NULL;
g_autofree gchar *path = NULL;
@@ -211,12 +211,12 @@ sp_process_model_item_get_argv (SpProcessModelItem *self)
gsize size = 0;
GPid pid;
- g_return_val_if_fail (SP_IS_PROCESS_MODEL_ITEM (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL_ITEM (self), NULL);
if (self->argv)
return (const gchar * const *)self->argv;
- if ((pid = sp_process_model_item_get_pid (self)) < 0)
+ if ((pid = sysprof_process_model_item_get_pid (self)) < 0)
return NULL;
path = g_strdup_printf ("/proc/%u/cmdline", (guint)pid);
diff --git a/src/libsysprof/sp-process-model-item.h b/src/libsysprof/sysprof-process-model-item.h
similarity index 51%
rename from src/libsysprof/sp-process-model-item.h
rename to src/libsysprof/sysprof-process-model-item.h
index 693b633..71f5121 100644
--- a/src/libsysprof/sp-process-model-item.h
+++ b/src/libsysprof/sysprof-process-model-item.h
@@ -1,4 +1,4 @@
-/* sp-process-model-item.h
+/* sysprof-process-model-item.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -26,25 +26,25 @@
G_BEGIN_DECLS
-#define SP_TYPE_PROCESS_MODEL_ITEM (sp_process_model_item_get_type())
+#define SYSPROF_TYPE_PROCESS_MODEL_ITEM (sysprof_process_model_item_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpProcessModelItem, sp_process_model_item, SP, PROCESS_MODEL_ITEM, GObject)
+G_DECLARE_FINAL_TYPE (SysprofProcessModelItem, sysprof_process_model_item, SYSPROF, PROCESS_MODEL_ITEM,
GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpProcessModelItem *sp_process_model_item_new (GPid pid);
+SysprofProcessModelItem *sysprof_process_model_item_new (GPid pid);
SYSPROF_AVAILABLE_IN_ALL
-guint sp_process_model_item_hash (SpProcessModelItem *self);
+guint sysprof_process_model_item_hash (SysprofProcessModelItem *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_process_model_item_equal (SpProcessModelItem *self,
- SpProcessModelItem *other);
+gboolean sysprof_process_model_item_equal (SysprofProcessModelItem *self,
+ SysprofProcessModelItem *other);
SYSPROF_AVAILABLE_IN_ALL
-GPid sp_process_model_item_get_pid (SpProcessModelItem *self);
+GPid sysprof_process_model_item_get_pid (SysprofProcessModelItem *self);
SYSPROF_AVAILABLE_IN_ALL
-const gchar *sp_process_model_item_get_command_line (SpProcessModelItem *self);
+const gchar *sysprof_process_model_item_get_command_line (SysprofProcessModelItem *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_process_model_item_is_kernel (SpProcessModelItem *self);
+gboolean sysprof_process_model_item_is_kernel (SysprofProcessModelItem *self);
SYSPROF_AVAILABLE_IN_ALL
-const gchar * const *sp_process_model_item_get_argv (SpProcessModelItem *self);
+const gchar * const *sysprof_process_model_item_get_argv (SysprofProcessModelItem *self);
G_END_DECLS
diff --git a/src/libsysprof/sp-process-model.c b/src/libsysprof/sysprof-process-model.c
similarity index 59%
rename from src/libsysprof/sp-process-model.c
rename to src/libsysprof/sysprof-process-model.c
index 44ce4e3..8a1e1e7 100644
--- a/src/libsysprof/sp-process-model.c
+++ b/src/libsysprof/sysprof-process-model.c
@@ -1,4 +1,4 @@
-/* sp-process-model.c
+/* sysprof-process-model.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -22,12 +22,12 @@
#include <stdlib.h>
-#include "sp-process-model.h"
-#include "sp-process-model-item.h"
+#include "sysprof-process-model.h"
+#include "sysprof-process-model-item.h"
#define QUEUE_RELOAD_TIMEOUT_MSEC 100
-struct _SpProcessModel
+struct _SysprofProcessModel
{
GObject parent_instance;
guint reload_source;
@@ -36,13 +36,13 @@ struct _SpProcessModel
static void list_model_iface_init (GListModelInterface *iface);
-G_DEFINE_TYPE_EXTENDED (SpProcessModel, sp_process_model, G_TYPE_OBJECT, 0,
+G_DEFINE_TYPE_EXTENDED (SysprofProcessModel, sysprof_process_model, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, list_model_iface_init))
static void
-sp_process_model_finalize (GObject *object)
+sysprof_process_model_finalize (GObject *object)
{
- SpProcessModel *self = (SpProcessModel *)object;
+ SysprofProcessModel *self = (SysprofProcessModel *)object;
if (self->reload_source)
{
@@ -52,23 +52,23 @@ sp_process_model_finalize (GObject *object)
g_clear_pointer (&self->items, g_ptr_array_unref);
- G_OBJECT_CLASS (sp_process_model_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_process_model_parent_class)->finalize (object);
}
static void
-sp_process_model_class_init (SpProcessModelClass *klass)
+sysprof_process_model_class_init (SysprofProcessModelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_process_model_finalize;
+ object_class->finalize = sysprof_process_model_finalize;
}
static void
-sp_process_model_init (SpProcessModel *self)
+sysprof_process_model_init (SysprofProcessModel *self)
{
self->items = g_ptr_array_new_with_free_func (g_object_unref);
- sp_process_model_queue_reload (self);
+ sysprof_process_model_queue_reload (self);
}
static guint
@@ -81,8 +81,8 @@ find_index (GPtrArray *ar,
for (i = 0; i < ar->len; i++)
{
- SpProcessModelItem *item = g_ptr_array_index (ar, i);
- GPid item_pid = sp_process_model_item_get_pid (item);
+ SysprofProcessModelItem *item = g_ptr_array_index (ar, i);
+ GPid item_pid = sysprof_process_model_item_get_pid (item);
g_assert (pid != item_pid);
@@ -94,18 +94,18 @@ find_index (GPtrArray *ar,
}
static void
-sp_process_model_merge_cb (GObject *object,
+sysprof_process_model_merge_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- SpProcessModel *self = (SpProcessModel *)object;
+ SysprofProcessModel *self = (SysprofProcessModel *)object;
g_autoptr(GPtrArray) ret = NULL;
g_autoptr(GHashTable) old_hash = NULL;
g_autoptr(GHashTable) new_hash = NULL;
GError *error = NULL;
guint i;
- g_assert (SP_IS_PROCESS_MODEL (self));
+ g_assert (SYSPROF_IS_PROCESS_MODEL (self));
g_assert (G_IS_TASK (result));
ret = g_task_propagate_pointer (G_TASK (result), &error);
@@ -122,21 +122,21 @@ sp_process_model_merge_cb (GObject *object,
* and do a proper 2-way merge.
*/
- old_hash = g_hash_table_new ((GHashFunc)sp_process_model_item_hash,
- (GEqualFunc)sp_process_model_item_equal);
- new_hash = g_hash_table_new ((GHashFunc)sp_process_model_item_hash,
- (GEqualFunc)sp_process_model_item_equal);
+ old_hash = g_hash_table_new ((GHashFunc)sysprof_process_model_item_hash,
+ (GEqualFunc)sysprof_process_model_item_equal);
+ new_hash = g_hash_table_new ((GHashFunc)sysprof_process_model_item_hash,
+ (GEqualFunc)sysprof_process_model_item_equal);
for (i = 0; i < self->items->len; i++)
{
- SpProcessModelItem *item = g_ptr_array_index (self->items, i);
+ SysprofProcessModelItem *item = g_ptr_array_index (self->items, i);
g_hash_table_insert (old_hash, item, NULL);
}
for (i = 0; i < ret->len; i++)
{
- SpProcessModelItem *item = g_ptr_array_index (ret, i);
+ SysprofProcessModelItem *item = g_ptr_array_index (ret, i);
g_hash_table_insert (new_hash, item, NULL);
}
@@ -144,7 +144,7 @@ sp_process_model_merge_cb (GObject *object,
for (i = self->items->len; i > 0; i--)
{
guint index = i - 1;
- SpProcessModelItem *item = g_ptr_array_index (self->items, index);
+ SysprofProcessModelItem *item = g_ptr_array_index (self->items, index);
if (!g_hash_table_contains (new_hash, item))
{
@@ -155,14 +155,14 @@ sp_process_model_merge_cb (GObject *object,
for (i = 0; i < ret->len; i++)
{
- SpProcessModelItem *item = g_ptr_array_index (ret, i);
+ SysprofProcessModelItem *item = g_ptr_array_index (ret, i);
GPid pid;
guint index;
if (g_hash_table_contains (old_hash, item))
continue;
- pid = sp_process_model_item_get_pid (item);
+ pid = sysprof_process_model_item_get_pid (item);
index = find_index (self->items, pid);
g_ptr_array_insert (self->items, index, g_object_ref (item));
@@ -174,14 +174,14 @@ static gint
compare_by_pid (gconstpointer a,
gconstpointer b)
{
- SpProcessModelItem **aitem = (SpProcessModelItem **)a;
- SpProcessModelItem **bitem = (SpProcessModelItem **)b;
+ SysprofProcessModelItem **aitem = (SysprofProcessModelItem **)a;
+ SysprofProcessModelItem **bitem = (SysprofProcessModelItem **)b;
- return sp_process_model_item_get_pid (*aitem) - sp_process_model_item_get_pid (*bitem);
+ return sysprof_process_model_item_get_pid (*aitem) - sysprof_process_model_item_get_pid (*bitem);
}
static void
-sp_process_model_reload_worker (GTask *task,
+sysprof_process_model_reload_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
@@ -191,7 +191,7 @@ sp_process_model_reload_worker (GTask *task,
GError *error = NULL;
GDir *dir;
- g_assert (SP_IS_PROCESS_MODEL (source_object));
+ g_assert (SYSPROF_IS_PROCESS_MODEL (source_object));
g_assert (G_IS_TASK (task));
dir = g_dir_open ("/proc", 0, &error);
@@ -206,7 +206,7 @@ sp_process_model_reload_worker (GTask *task,
while ((name = g_dir_read_name (dir)))
{
- SpProcessModelItem *item;
+ SysprofProcessModelItem *item;
GPid pid;
gchar *end;
@@ -214,9 +214,9 @@ sp_process_model_reload_worker (GTask *task,
if (pid <= 0 || *end != '\0')
continue;
- item = sp_process_model_item_new (pid);
+ item = sysprof_process_model_item_new (pid);
- if (sp_process_model_item_is_kernel (item))
+ if (sysprof_process_model_item_is_kernel (item))
{
g_object_unref (item);
continue;
@@ -232,32 +232,32 @@ sp_process_model_reload_worker (GTask *task,
}
static gboolean
-sp_process_model_do_reload (gpointer user_data)
+sysprof_process_model_do_reload (gpointer user_data)
{
- SpProcessModel *self = user_data;
+ SysprofProcessModel *self = user_data;
g_autoptr(GTask) task = NULL;
self->reload_source = 0;
- task = g_task_new (self, NULL, sp_process_model_merge_cb, NULL);
+ task = g_task_new (self, NULL, sysprof_process_model_merge_cb, NULL);
g_task_set_priority (task, G_PRIORITY_LOW);
- g_task_run_in_thread (task, sp_process_model_reload_worker);
+ g_task_run_in_thread (task, sysprof_process_model_reload_worker);
return G_SOURCE_REMOVE;
}
-SpProcessModel *
-sp_process_model_new (void)
+SysprofProcessModel *
+sysprof_process_model_new (void)
{
- return g_object_new (SP_TYPE_PROCESS_MODEL, NULL);
+ return g_object_new (SYSPROF_TYPE_PROCESS_MODEL, NULL);
}
void
-sp_process_model_reload (SpProcessModel *self)
+sysprof_process_model_reload (SysprofProcessModel *self)
{
g_autoptr(GTask) task = NULL;
- g_return_if_fail (SP_IS_PROCESS_MODEL (self));
+ g_return_if_fail (SYSPROF_IS_PROCESS_MODEL (self));
if (self->reload_source != 0)
{
@@ -267,43 +267,43 @@ sp_process_model_reload (SpProcessModel *self)
task = g_task_new (self, NULL, NULL, NULL);
g_task_set_priority (task, G_PRIORITY_LOW);
- g_task_run_in_thread_sync (task, sp_process_model_reload_worker);
+ g_task_run_in_thread_sync (task, sysprof_process_model_reload_worker);
- sp_process_model_merge_cb (G_OBJECT (self), G_ASYNC_RESULT (task), NULL);
+ sysprof_process_model_merge_cb (G_OBJECT (self), G_ASYNC_RESULT (task), NULL);
}
void
-sp_process_model_queue_reload (SpProcessModel *self)
+sysprof_process_model_queue_reload (SysprofProcessModel *self)
{
- g_return_if_fail (SP_IS_PROCESS_MODEL (self));
+ g_return_if_fail (SYSPROF_IS_PROCESS_MODEL (self));
if (self->reload_source == 0)
self->reload_source = g_timeout_add (QUEUE_RELOAD_TIMEOUT_MSEC,
- sp_process_model_do_reload,
+ sysprof_process_model_do_reload,
self);
}
static GType
-sp_process_model_get_item_type (GListModel *model)
+sysprof_process_model_get_item_type (GListModel *model)
{
- return SP_TYPE_PROCESS_MODEL_ITEM;
+ return SYSPROF_TYPE_PROCESS_MODEL_ITEM;
}
static guint
-sp_process_model_get_n_items (GListModel *model)
+sysprof_process_model_get_n_items (GListModel *model)
{
- SpProcessModel *self = (SpProcessModel *)model;
+ SysprofProcessModel *self = (SysprofProcessModel *)model;
return self->items->len;
}
static gpointer
-sp_process_model_get_item (GListModel *model,
+sysprof_process_model_get_item (GListModel *model,
guint position)
{
- SpProcessModel *self = (SpProcessModel *)model;
+ SysprofProcessModel *self = (SysprofProcessModel *)model;
- g_return_val_if_fail (SP_IS_PROCESS_MODEL (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROCESS_MODEL (self), NULL);
g_return_val_if_fail (position < self->items->len, NULL);
return g_object_ref (g_ptr_array_index (self->items, position));
@@ -312,7 +312,7 @@ sp_process_model_get_item (GListModel *model,
static void
list_model_iface_init (GListModelInterface *iface)
{
- iface->get_item_type = sp_process_model_get_item_type;
- iface->get_n_items = sp_process_model_get_n_items;
- iface->get_item = sp_process_model_get_item;
+ iface->get_item_type = sysprof_process_model_get_item_type;
+ iface->get_n_items = sysprof_process_model_get_n_items;
+ iface->get_item = sysprof_process_model_get_item;
}
diff --git a/src/libsysprof/sp-process-model.h b/src/libsysprof/sysprof-process-model.h
similarity index 69%
rename from src/libsysprof/sp-process-model.h
rename to src/libsysprof/sysprof-process-model.h
index ccb9a6f..593748c 100644
--- a/src/libsysprof/sp-process-model.h
+++ b/src/libsysprof/sysprof-process-model.h
@@ -1,4 +1,4 @@
-/* sp-process-model.h
+/* sysprof-process-model.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -26,16 +26,16 @@
G_BEGIN_DECLS
-#define SP_TYPE_PROCESS_MODEL (sp_process_model_get_type())
+#define SYSPROF_TYPE_PROCESS_MODEL (sysprof_process_model_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpProcessModel, sp_process_model, SP, PROCESS_MODEL, GObject)
+G_DECLARE_FINAL_TYPE (SysprofProcessModel, sysprof_process_model, SYSPROF, PROCESS_MODEL, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SpProcessModel *sp_process_model_new (void);
+SysprofProcessModel *sysprof_process_model_new (void);
SYSPROF_AVAILABLE_IN_ALL
-void sp_process_model_reload (SpProcessModel *self);
+void sysprof_process_model_reload (SysprofProcessModel *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_process_model_queue_reload (SpProcessModel *self);
+void sysprof_process_model_queue_reload (SysprofProcessModel *self);
G_END_DECLS
diff --git a/src/libsysprof/sp-profile.c b/src/libsysprof/sysprof-profile.c
similarity index 67%
rename from src/libsysprof/sp-profile.c
rename to src/libsysprof/sysprof-profile.c
index 6908601..de1d220 100644
--- a/src/libsysprof/sp-profile.c
+++ b/src/libsysprof/sysprof-profile.c
@@ -1,4 +1,4 @@
-/* sp-profile.c
+/* sysprof-profile.c
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -20,12 +20,12 @@
#include "config.h"
-#include "sp-profile.h"
+#include "sysprof-profile.h"
-G_DEFINE_INTERFACE (SpProfile, sp_profile, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (SysprofProfile, sysprof_profile, G_TYPE_OBJECT)
static void
-dummy_generate (SpProfile *self,
+dummy_generate (SysprofProfile *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -37,7 +37,7 @@ dummy_generate (SpProfile *self,
}
static gboolean
-dummy_generate_finish (SpProfile *self,
+dummy_generate_finish (SysprofProfile *self,
GAsyncResult *result,
GError **error)
{
@@ -45,41 +45,41 @@ dummy_generate_finish (SpProfile *self,
}
static void
-sp_profile_default_init (SpProfileInterface *iface)
+sysprof_profile_default_init (SysprofProfileInterface *iface)
{
iface->generate = dummy_generate;
iface->generate_finish = dummy_generate_finish;
}
void
-sp_profile_generate (SpProfile *self,
+sysprof_profile_generate (SysprofProfile *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (SP_IS_PROFILE (self));
+ g_return_if_fail (SYSPROF_IS_PROFILE (self));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
- SP_PROFILE_GET_IFACE (self)->generate (self, cancellable, callback, user_data);
+ SYSPROF_PROFILE_GET_IFACE (self)->generate (self, cancellable, callback, user_data);
}
gboolean
-sp_profile_generate_finish (SpProfile *self,
+sysprof_profile_generate_finish (SysprofProfile *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (SP_IS_PROFILE (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROFILE (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
- return SP_PROFILE_GET_IFACE (self)->generate_finish (self, result, error);
+ return SYSPROF_PROFILE_GET_IFACE (self)->generate_finish (self, result, error);
}
void
-sp_profile_set_reader (SpProfile *self,
- SpCaptureReader *reader)
+sysprof_profile_set_reader (SysprofProfile *self,
+ SysprofCaptureReader *reader)
{
- g_return_if_fail (SP_IS_PROFILE (self));
+ g_return_if_fail (SYSPROF_IS_PROFILE (self));
g_return_if_fail (reader != NULL);
- SP_PROFILE_GET_IFACE (self)->set_reader (self, reader);
+ SYSPROF_PROFILE_GET_IFACE (self)->set_reader (self, reader);
}
diff --git a/src/libsysprof/sp-profile.h b/src/libsysprof/sysprof-profile.h
similarity index 67%
rename from src/libsysprof/sp-profile.h
rename to src/libsysprof/sysprof-profile.h
index 0fa1013..4096365 100644
--- a/src/libsysprof/sp-profile.h
+++ b/src/libsysprof/sysprof-profile.h
@@ -1,4 +1,4 @@
-/* sp-profile.h
+/* sysprof-profile.h
*
* Copyright 2016-2019 Christian Hergert <christian hergert me>
*
@@ -24,40 +24,40 @@
#include "sysprof-version-macros.h"
-#include "sp-capture-reader.h"
+#include "sysprof-capture-reader.h"
G_BEGIN_DECLS
-#define SP_TYPE_PROFILE (sp_profile_get_type ())
+#define SYSPROF_TYPE_PROFILE (sysprof_profile_get_type ())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_INTERFACE (SpProfile, sp_profile, SP, PROFILE, GObject)
+G_DECLARE_INTERFACE (SysprofProfile, sysprof_profile, SYSPROF, PROFILE, GObject)
-struct _SpProfileInterface
+struct _SysprofProfileInterface
{
GTypeInterface parent;
- void (*set_reader) (SpProfile *self,
- SpCaptureReader *reader);
- void (*generate) (SpProfile *self,
+ void (*set_reader) (SysprofProfile *self,
+ SysprofCaptureReader *reader);
+ void (*generate) (SysprofProfile *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
- gboolean (*generate_finish) (SpProfile *self,
+ gboolean (*generate_finish) (SysprofProfile *self,
GAsyncResult *result,
GError **error);
};
SYSPROF_AVAILABLE_IN_ALL
-void sp_profile_set_reader (SpProfile *self,
- SpCaptureReader *reader);
+void sysprof_profile_set_reader (SysprofProfile *self,
+ SysprofCaptureReader *reader);
SYSPROF_AVAILABLE_IN_ALL
-void sp_profile_generate (SpProfile *self,
+void sysprof_profile_generate (SysprofProfile *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_profile_generate_finish (SpProfile *self,
+gboolean sysprof_profile_generate_finish (SysprofProfile *self,
GAsyncResult *result,
GError **error);
diff --git a/src/libsysprof/sp-profiler.c b/src/libsysprof/sysprof-profiler.c
similarity index 62%
rename from src/libsysprof/sp-profiler.c
rename to src/libsysprof/sysprof-profiler.c
index 0287479..6742b81 100644
--- a/src/libsysprof/sp-profiler.c
+++ b/src/libsysprof/sysprof-profiler.c
@@ -1,4 +1,4 @@
-/* sp-profiler.c
+/* sysprof-profiler.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,13 +18,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-profiler"
+#define G_LOG_DOMAIN "sysprof-profiler"
#include "config.h"
-#include "sp-profiler.h"
+#include "sysprof-profiler.h"
-G_DEFINE_INTERFACE (SpProfiler, sp_profiler, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (SysprofProfiler, sysprof_profiler, G_TYPE_OBJECT)
enum {
FAILED,
@@ -35,19 +35,19 @@ enum {
static guint signals [N_SIGNALS];
static void
-sp_profiler_default_init (SpProfilerInterface *iface)
+sysprof_profiler_default_init (SysprofProfilerInterface *iface)
{
signals [FAILED] = g_signal_new ("failed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (SpProfilerInterface, failed),
+ G_STRUCT_OFFSET (SysprofProfilerInterface, failed),
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_ERROR);
signals [STOPPED] = g_signal_new ("stopped",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (SpProfilerInterface, stopped),
+ G_STRUCT_OFFSET (SysprofProfilerInterface, stopped),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
@@ -76,7 +76,7 @@ sp_profiler_default_init (SpProfilerInterface *iface)
g_object_interface_install_property (iface,
g_param_spec_boolean ("spawn-inherit-environ",
- "Spawn Inherit Environ",
+ "Sysprofawn Inherit Environ",
"If the spawned child should inherit the parents environment",
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
@@ -90,208 +90,208 @@ sp_profiler_default_init (SpProfilerInterface *iface)
g_object_interface_install_property (iface,
g_param_spec_boolean ("spawn",
- "Spawn",
+ "Sysprofawn",
"If configured child should be spawned",
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_interface_install_property (iface,
g_param_spec_boxed ("spawn-argv",
- "Spawn Argv",
+ "Sysprofawn Argv",
"The arguments for the spawn child",
G_TYPE_STRV,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_interface_install_property (iface,
g_param_spec_boxed ("spawn-env",
- "Spawn Environment",
+ "Sysprofawn Environment",
"The environment for the spawn child",
G_TYPE_STRV,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
}
gdouble
-sp_profiler_get_elapsed (SpProfiler *self)
+sysprof_profiler_get_elapsed (SysprofProfiler *self)
{
gdouble value = 0.0;
- g_return_val_if_fail (SP_IS_PROFILER (self), 0.0);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), 0.0);
g_object_get (self, "elapsed", &value, NULL);
return value;
}
gboolean
-sp_profiler_get_is_running (SpProfiler *self)
+sysprof_profiler_get_is_running (SysprofProfiler *self)
{
gboolean is_running = FALSE;
- g_return_val_if_fail (SP_IS_PROFILER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), FALSE);
g_object_get (self, "is-running", &is_running, NULL);
return is_running;
}
gboolean
-sp_profiler_get_is_mutable (SpProfiler *self)
+sysprof_profiler_get_is_mutable (SysprofProfiler *self)
{
gboolean is_mutable = FALSE;
- g_return_val_if_fail (SP_IS_PROFILER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), FALSE);
g_object_get (self, "is-mutable", &is_mutable, NULL);
return is_mutable;
}
gboolean
-sp_profiler_get_spawn_inherit_environ (SpProfiler *self)
+sysprof_profiler_get_spawn_inherit_environ (SysprofProfiler *self)
{
gboolean spawn_inherit_environ = FALSE;
- g_return_val_if_fail (SP_IS_PROFILER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), FALSE);
g_object_get (self, "spawn-inherit-environ", &spawn_inherit_environ, NULL);
return spawn_inherit_environ;
}
void
-sp_profiler_set_spawn_inherit_environ (SpProfiler *self,
+sysprof_profiler_set_spawn_inherit_environ (SysprofProfiler *self,
gboolean spawn_inherit_environ)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_object_set (self, "spawn-inherit-environ", !!spawn_inherit_environ, NULL);
}
gboolean
-sp_profiler_get_spawn (SpProfiler *self)
+sysprof_profiler_get_spawn (SysprofProfiler *self)
{
gboolean spawn = FALSE;
- g_return_val_if_fail (SP_IS_PROFILER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), FALSE);
g_object_get (self, "spawn", &spawn, NULL);
return spawn;
}
void
-sp_profiler_set_spawn (SpProfiler *self,
+sysprof_profiler_set_spawn (SysprofProfiler *self,
gboolean spawn)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_object_set (self, "spawn", !!spawn, NULL);
}
gboolean
-sp_profiler_get_whole_system (SpProfiler *self)
+sysprof_profiler_get_whole_system (SysprofProfiler *self)
{
gboolean whole_system = FALSE;
- g_return_val_if_fail (SP_IS_PROFILER (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), FALSE);
g_object_get (self, "whole-system", &whole_system, NULL);
return whole_system;
}
void
-sp_profiler_set_whole_system (SpProfiler *self,
+sysprof_profiler_set_whole_system (SysprofProfiler *self,
gboolean whole_system)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_object_set (self, "whole-system", !!whole_system, NULL);
}
void
-sp_profiler_set_spawn_argv (SpProfiler *self,
+sysprof_profiler_set_spawn_argv (SysprofProfiler *self,
const gchar * const *spawn_argv)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_object_set (self, "spawn-argv", spawn_argv, NULL);
}
void
-sp_profiler_set_spawn_env (SpProfiler *self,
+sysprof_profiler_set_spawn_env (SysprofProfiler *self,
const gchar * const *spawn_env)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_object_set (self, "spawn-env", spawn_env, NULL);
}
void
-sp_profiler_add_source (SpProfiler *self,
- SpSource *source)
+sysprof_profiler_add_source (SysprofProfiler *self,
+ SysprofSource *source)
{
- g_return_if_fail (SP_IS_PROFILER (self));
- g_return_if_fail (SP_IS_SOURCE (source));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (source));
- SP_PROFILER_GET_IFACE (self)->add_source (self, source);
+ SYSPROF_PROFILER_GET_IFACE (self)->add_source (self, source);
}
void
-sp_profiler_set_writer (SpProfiler *self,
- SpCaptureWriter *writer)
+sysprof_profiler_set_writer (SysprofProfiler *self,
+ SysprofCaptureWriter *writer)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_return_if_fail (writer != NULL);
- SP_PROFILER_GET_IFACE (self)->set_writer (self, writer);
+ SYSPROF_PROFILER_GET_IFACE (self)->set_writer (self, writer);
}
-SpCaptureWriter *
-sp_profiler_get_writer (SpProfiler *self)
+SysprofCaptureWriter *
+sysprof_profiler_get_writer (SysprofProfiler *self)
{
- g_return_val_if_fail (SP_IS_PROFILER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), NULL);
- return SP_PROFILER_GET_IFACE (self)->get_writer (self);
+ return SYSPROF_PROFILER_GET_IFACE (self)->get_writer (self);
}
void
-sp_profiler_start (SpProfiler *self)
+sysprof_profiler_start (SysprofProfiler *self)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
- SP_PROFILER_GET_IFACE (self)->start (self);
+ SYSPROF_PROFILER_GET_IFACE (self)->start (self);
}
void
-sp_profiler_stop (SpProfiler *self)
+sysprof_profiler_stop (SysprofProfiler *self)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
- SP_PROFILER_GET_IFACE (self)->stop (self);
+ SYSPROF_PROFILER_GET_IFACE (self)->stop (self);
}
void
-sp_profiler_add_pid (SpProfiler *self,
+sysprof_profiler_add_pid (SysprofProfiler *self,
GPid pid)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_return_if_fail (pid > -1);
- SP_PROFILER_GET_IFACE (self)->add_pid (self, pid);
+ SYSPROF_PROFILER_GET_IFACE (self)->add_pid (self, pid);
}
void
-sp_profiler_remove_pid (SpProfiler *self,
+sysprof_profiler_remove_pid (SysprofProfiler *self,
GPid pid)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_return_if_fail (pid > -1);
- SP_PROFILER_GET_IFACE (self)->remove_pid (self, pid);
+ SYSPROF_PROFILER_GET_IFACE (self)->remove_pid (self, pid);
}
const GPid *
-sp_profiler_get_pids (SpProfiler *self,
+sysprof_profiler_get_pids (SysprofProfiler *self,
guint *n_pids)
{
- g_return_val_if_fail (SP_IS_PROFILER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_PROFILER (self), NULL);
g_return_val_if_fail (n_pids != NULL, NULL);
- return SP_PROFILER_GET_IFACE (self)->get_pids (self, n_pids);
+ return SYSPROF_PROFILER_GET_IFACE (self)->get_pids (self, n_pids);
}
void
-sp_profiler_emit_failed (SpProfiler *self,
+sysprof_profiler_emit_failed (SysprofProfiler *self,
const GError *error)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_return_if_fail (error != NULL);
g_signal_emit (self, signals [FAILED], 0, error);
}
void
-sp_profiler_emit_stopped (SpProfiler *self)
+sysprof_profiler_emit_stopped (SysprofProfiler *self)
{
- g_return_if_fail (SP_IS_PROFILER (self));
+ g_return_if_fail (SYSPROF_IS_PROFILER (self));
g_signal_emit (self, signals [STOPPED], 0);
}
diff --git a/src/libsysprof/sysprof-profiler.h b/src/libsysprof/sysprof-profiler.h
new file mode 100644
index 0000000..7f18734
--- /dev/null
+++ b/src/libsysprof/sysprof-profiler.h
@@ -0,0 +1,184 @@
+/* sysprof-profiler.h
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include "sysprof-version-macros.h"
+
+#include "sysprof-capture-writer.h"
+#include "sysprof-source.h"
+
+G_BEGIN_DECLS
+
+#define SYSPROF_TYPE_PROFILER (sysprof_profiler_get_type())
+
+SYSPROF_AVAILABLE_IN_ALL
+G_DECLARE_INTERFACE (SysprofProfiler, sysprof_profiler, SYSPROF, PROFILER, GObject)
+
+struct _SysprofProfilerInterface
+{
+ GTypeInterface parent_interface;
+
+ /**
+ * SysprofProfiler::failed:
+ * @self: A #SysprofProfiler
+ * @reason: A #GError representing the reason for the failure
+ *
+ * This signal is emitted if the profiler failed. Note that
+ * #SysprofProfiler::stopped will also be emitted, but does not allow for
+ * receiving the error condition.
+ */
+ void (*failed) (SysprofProfiler *self,
+ const GError *error);
+
+ /**
+ * SysprofProfiler::stopped:
+ * @self: A #SysprofProfiler
+ *
+ * This signal is emitted when a profiler is stopped. It will always be
+ * emitted after a sysprof_profiler_start() has been called, either after
+ * completion of sysprof_profiler_stop() or after a failure or after asynchronous
+ * completion of stopping.
+ */
+ void (*stopped) (SysprofProfiler *self);
+
+ /**
+ * SysprofProfiler::add_source:
+ *
+ * Adds a source to the profiler.
+ */
+ void (*add_source) (SysprofProfiler *profiler,
+ SysprofSource *source);
+
+ /**
+ * SysprofProfiler::set_writer:
+ *
+ * Sets the writer to use for the profiler.
+ */
+ void (*set_writer) (SysprofProfiler *self,
+ SysprofCaptureWriter *writer);
+
+ /**
+ * SysprofProfiler::get_writer:
+ *
+ * Gets the writer that is being used to capture.
+ *
+ * Returns: (nullable) (transfer none): A #SysprofCaptureWriter.
+ */
+ SysprofCaptureWriter *(*get_writer) (SysprofProfiler *self);
+
+ /**
+ * SysprofProfiler::start:
+ *
+ * Starts the profiler.
+ */
+ void (*start) (SysprofProfiler *self);
+
+ /**
+ * SysprofProfiler::stop:
+ *
+ * Stops the profiler.
+ */
+ void (*stop) (SysprofProfiler *self);
+
+ /**
+ * SysprofProfiler::add_pid:
+ *
+ * Add a pid to be profiled.
+ */
+ void (*add_pid) (SysprofProfiler *self,
+ GPid pid);
+
+ /**
+ * SysprofProfiler::remove_pid:
+ *
+ * Remove a pid from the profiler. This will not be called after
+ * SysprofProfiler::start has been called.
+ */
+ void (*remove_pid) (SysprofProfiler *self,
+ GPid pid);
+
+ /**
+ * SysprofProfiler::get_pids:
+ *
+ * Gets the pids that are part of this profiling session. If no pids
+ * have been specified, %NULL is returned.
+ *
+ * Returns: (nullable) (transfer none): An array of #GPid, or %NULL.
+ */
+ const GPid *(*get_pids) (SysprofProfiler *self,
+ guint *n_pids);
+};
+
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_emit_failed (SysprofProfiler *self,
+ const GError *error);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_emit_stopped (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+gdouble sysprof_profiler_get_elapsed (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_profiler_get_is_mutable (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_profiler_get_spawn_inherit_environ (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_set_spawn_inherit_environ (SysprofProfiler *self,
+ gboolean spawn_inherit_environ);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_profiler_get_whole_system (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_set_whole_system (SysprofProfiler *self,
+ gboolean whole_system);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_profiler_get_spawn (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_set_spawn (SysprofProfiler *self,
+ gboolean spawn);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_set_spawn_argv (SysprofProfiler *self,
+ const gchar * const *spawn_argv);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_set_spawn_env (SysprofProfiler *self,
+ const gchar * const *spawn_env);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_add_source (SysprofProfiler *self,
+ SysprofSource *source);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_set_writer (SysprofProfiler *self,
+ SysprofCaptureWriter *writer);
+SYSPROF_AVAILABLE_IN_ALL
+SysprofCaptureWriter *sysprof_profiler_get_writer (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+gboolean sysprof_profiler_get_is_running (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_start (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_stop (SysprofProfiler *self);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_add_pid (SysprofProfiler *self,
+ GPid pid);
+SYSPROF_AVAILABLE_IN_ALL
+void sysprof_profiler_remove_pid (SysprofProfiler *self,
+ GPid pid);
+SYSPROF_AVAILABLE_IN_ALL
+const GPid *sysprof_profiler_get_pids (SysprofProfiler *self,
+ guint *n_pids);
+
+G_END_DECLS
diff --git a/src/libsysprof/sp-selection.c b/src/libsysprof/sysprof-selection.c
similarity index 73%
rename from src/libsysprof/sp-selection.c
rename to src/libsysprof/sysprof-selection.c
index 5f7dbad..1f6fbcd 100644
--- a/src/libsysprof/sp-selection.c
+++ b/src/libsysprof/sysprof-selection.c
@@ -1,4 +1,4 @@
-/* sp-selection.c
+/* sysprof-selection.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -18,13 +18,13 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "sp-selection"
+#define G_LOG_DOMAIN "sysprof-selection"
#include "config.h"
-#include "sp-selection.h"
+#include "sysprof-selection.h"
-struct _SpSelection
+struct _SysprofSelection
{
GObject parent_instance;
GArray *ranges;
@@ -36,7 +36,7 @@ typedef struct
gint64 end;
} Range;
-G_DEFINE_TYPE (SpSelection, sp_selection, G_TYPE_OBJECT)
+G_DEFINE_TYPE (SysprofSelection, sysprof_selection, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -65,27 +65,27 @@ int64_swap (gint64 *a,
}
static void
-sp_selection_finalize (GObject *object)
+sysprof_selection_finalize (GObject *object)
{
- SpSelection *self = (SpSelection *)object;
+ SysprofSelection *self = (SysprofSelection *)object;
g_clear_pointer (&self->ranges, g_array_unref);
- G_OBJECT_CLASS (sp_selection_parent_class)->finalize (object);
+ G_OBJECT_CLASS (sysprof_selection_parent_class)->finalize (object);
}
static void
-sp_selection_get_property (GObject *object,
+sysprof_selection_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- SpSelection *self = SP_SELECTION (object);
+ SysprofSelection *self = SYSPROF_SELECTION (object);
switch (prop_id)
{
case PROP_HAS_SELECTION:
- g_value_set_boolean (value, sp_selection_get_has_selection (self));
+ g_value_set_boolean (value, sysprof_selection_get_has_selection (self));
break;
default:
@@ -94,12 +94,12 @@ sp_selection_get_property (GObject *object,
}
static void
-sp_selection_class_init (SpSelectionClass *klass)
+sysprof_selection_class_init (SysprofSelectionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = sp_selection_finalize;
- object_class->get_property = sp_selection_get_property;
+ object_class->finalize = sysprof_selection_finalize;
+ object_class->get_property = sysprof_selection_get_property;
properties [PROP_HAS_SELECTION] =
g_param_spec_boolean ("has-selection",
@@ -111,7 +111,7 @@ sp_selection_class_init (SpSelectionClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
/**
- * SpSelection::changed:
+ * SysprofSelection::changed:
*
* This signal is emitted when the selection has changed.
*/
@@ -123,33 +123,33 @@ sp_selection_class_init (SpSelectionClass *klass)
}
static void
-sp_selection_init (SpSelection *self)
+sysprof_selection_init (SysprofSelection *self)
{
self->ranges = g_array_new (FALSE, FALSE, sizeof (Range));
}
gboolean
-sp_selection_get_has_selection (SpSelection *self)
+sysprof_selection_get_has_selection (SysprofSelection *self)
{
- g_return_val_if_fail (SP_IS_SELECTION (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_SELECTION (self), FALSE);
return self->ranges->len > 0;
}
/**
- * sp_selection_foreach:
- * @self: A #SpSelection
+ * sysprof_selection_foreach:
+ * @self: A #SysprofSelection
* @foreach_func: (scope call): a callback for each range
* @user_data: user data for @foreach_func
*
* Calls @foreach_func for every selected range.
*/
void
-sp_selection_foreach (SpSelection *self,
- SpSelectionForeachFunc foreach_func,
+sysprof_selection_foreach (SysprofSelection *self,
+ SysprofSelectionForeachFunc foreach_func,
gpointer user_data)
{
- g_return_if_fail (SP_IS_SELECTION (self));
+ g_return_if_fail (SYSPROF_IS_SELECTION (self));
g_return_if_fail (foreach_func != NULL);
for (guint i = 0; i < self->ranges->len; i++)
@@ -160,13 +160,13 @@ sp_selection_foreach (SpSelection *self,
}
void
-sp_selection_select_range (SpSelection *self,
+sysprof_selection_select_range (SysprofSelection *self,
gint64 begin_time,
gint64 end_time)
{
Range range = { 0 };
- g_return_if_fail (SP_IS_SELECTION (self));
+ g_return_if_fail (SYSPROF_IS_SELECTION (self));
int64_swap (&begin_time, &end_time);
@@ -181,11 +181,11 @@ sp_selection_select_range (SpSelection *self,
}
void
-sp_selection_unselect_range (SpSelection *self,
+sysprof_selection_unselect_range (SysprofSelection *self,
gint64 begin,
gint64 end)
{
- g_return_if_fail (SP_IS_SELECTION (self));
+ g_return_if_fail (SYSPROF_IS_SELECTION (self));
int64_swap (&begin, &end);
@@ -205,9 +205,9 @@ sp_selection_unselect_range (SpSelection *self,
}
void
-sp_selection_unselect_all (SpSelection *self)
+sysprof_selection_unselect_all (SysprofSelection *self)
{
- g_return_if_fail (SP_IS_SELECTION (self));
+ g_return_if_fail (SYSPROF_IS_SELECTION (self));
if (self->ranges->len > 0)
{
@@ -218,7 +218,7 @@ sp_selection_unselect_all (SpSelection *self)
}
gboolean
-sp_selection_contains (SpSelection *self,
+sysprof_selection_contains (SysprofSelection *self,
gint64 time_at)
{
if (self == NULL || self->ranges->len == 0)
@@ -235,15 +235,15 @@ sp_selection_contains (SpSelection *self,
return FALSE;
}
-SpSelection *
-sp_selection_copy (const SpSelection *self)
+SysprofSelection *
+sysprof_selection_copy (const SysprofSelection *self)
{
- SpSelection *copy;
+ SysprofSelection *copy;
if (self == NULL)
return NULL;
- copy = g_object_new (SP_TYPE_SELECTION, NULL);
+ copy = g_object_new (SYSPROF_TYPE_SELECTION, NULL);
for (guint i = 0; i < self->ranges->len; i++)
{
diff --git a/src/libsysprof/sp-selection.h b/src/libsysprof/sysprof-selection.h
similarity index 65%
rename from src/libsysprof/sp-selection.h
rename to src/libsysprof/sysprof-selection.h
index a4f5076..e4f8c07 100644
--- a/src/libsysprof/sp-selection.h
+++ b/src/libsysprof/sysprof-selection.h
@@ -1,4 +1,4 @@
-/* sp-selection.h
+/* sysprof-selection.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -26,36 +26,36 @@
G_BEGIN_DECLS
-#define SP_TYPE_SELECTION (sp_selection_get_type())
+#define SYSPROF_TYPE_SELECTION (sysprof_selection_get_type())
SYSPROF_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (SpSelection, sp_selection, SP, SELECTION, GObject)
+G_DECLARE_FINAL_TYPE (SysprofSelection, sysprof_selection, SYSPROF, SELECTION, GObject)
-typedef void (*SpSelectionForeachFunc) (SpSelection *self,
+typedef void (*SysprofSelectionForeachFunc) (SysprofSelection *self,
gint64 begin_time,
gint64 end_time,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_selection_get_has_selection (SpSelection *self);
+gboolean sysprof_selection_get_has_selection (SysprofSelection *self);
SYSPROF_AVAILABLE_IN_ALL
-gboolean sp_selection_contains (SpSelection *self,
+gboolean sysprof_selection_contains (SysprofSelection *self,
gint64 time_at);
SYSPROF_AVAILABLE_IN_ALL
-void sp_selection_select_range (SpSelection *self,
+void sysprof_selection_select_range (SysprofSelection *self,
gint64 begin_time,
gint64 end_time);
SYSPROF_AVAILABLE_IN_ALL
-void sp_selection_unselect_range (SpSelection *self,
+void sysprof_selection_unselect_range (SysprofSelection *self,
gint64 begin,
gint64 end);
SYSPROF_AVAILABLE_IN_ALL
-void sp_selection_unselect_all (SpSelection *self);
+void sysprof_selection_unselect_all (SysprofSelection *self);
SYSPROF_AVAILABLE_IN_ALL
-void sp_selection_foreach (SpSelection *self,
- SpSelectionForeachFunc foreach_func,
+void sysprof_selection_foreach (SysprofSelection *self,
+ SysprofSelectionForeachFunc foreach_func,
gpointer user_data);
SYSPROF_AVAILABLE_IN_ALL
-SpSelection *sp_selection_copy (const SpSelection *self);
+SysprofSelection *sysprof_selection_copy (const SysprofSelection *self);
G_END_DECLS
diff --git a/src/libsysprof/sp-source-util-private.h b/src/libsysprof/sysprof-source-util-private.h
similarity index 86%
rename from src/libsysprof/sp-source-util-private.h
rename to src/libsysprof/sysprof-source-util-private.h
index 6d2756e..01e108e 100644
--- a/src/libsysprof/sp-source-util-private.h
+++ b/src/libsysprof/sysprof-source-util-private.h
@@ -1,4 +1,4 @@
-/* sp-source-util-private.h
+/* sysprof-source-util-private.h
*
* Copyright 2019 Christian Hergert <chergert redhat com>
*
@@ -24,11 +24,11 @@
G_BEGIN_DECLS
-gboolean sp_host_file_get_contents (const gchar *host_path,
+gboolean sysprof_host_file_get_contents (const gchar *host_path,
gchar **contents,
gsize *len,
GError **error);
-gchar **sp_host_list_directories (const gchar *directory,
+gchar **sysprof_host_list_directories (const gchar *directory,
GError **error);
G_END_DECLS
diff --git a/src/libsysprof/sp-source-util.c b/src/libsysprof/sysprof-source-util.c
similarity index 97%
rename from src/libsysprof/sp-source-util.c
rename to src/libsysprof/sysprof-source-util.c
index 35b9252..4c37758 100644
--- a/src/libsysprof/sp-source-util.c
+++ b/src/libsysprof/sysprof-source-util.c
@@ -1,4 +1,4 @@
-/* sp-source-util.c
+/* sysprof-source-util.c
*
* Copyright 2019 Christian Hergert <chergert redhat com>
*
@@ -23,10 +23,10 @@
#include <gio/gio.h>
#include <string.h>
-#include "sp-source-util-private.h"
+#include "sysprof-source-util-private.h"
gboolean
-sp_host_file_get_contents (const gchar *host_path,
+sysprof_host_file_get_contents (const gchar *host_path,
gchar **contents,
gsize *len,
GError **error)
@@ -96,7 +96,7 @@ sp_host_file_get_contents (const gchar *host_path,
}
gchar **
-sp_host_list_directories (const gchar *directory,
+sysprof_host_list_directories (const gchar *directory,
GError **error)
{
g_autofree gchar *alt_path = NULL;
diff --git a/src/libsysprof/sp-source.c b/src/libsysprof/sysprof-source.c
similarity index 55%
rename from src/libsysprof/sp-source.c
rename to src/libsysprof/sysprof-source.c
index 9feb606..cece9c3 100644
--- a/src/libsysprof/sp-source.c
+++ b/src/libsysprof/sysprof-source.c
@@ -1,4 +1,4 @@
-/* sp-source.c
+/* sysprof-source.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,9 +20,9 @@
#include "config.h"
-#include "sp-source.h"
+#include "sysprof-source.h"
-G_DEFINE_INTERFACE (SpSource, sp_source, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (SysprofSource, sysprof_source, G_TYPE_OBJECT)
enum {
FAILED,
@@ -34,7 +34,7 @@ enum {
static guint signals [N_SIGNALS];
static void
-sp_source_default_init (SpSourceInterface *iface)
+sysprof_source_default_init (SysprofSourceInterface *iface)
{
signals [FAILED] = g_signal_new ("failed",
G_TYPE_FROM_INTERFACE (iface),
@@ -55,87 +55,87 @@ sp_source_default_init (SpSourceInterface *iface)
}
void
-sp_source_add_pid (SpSource *self,
+sysprof_source_add_pid (SysprofSource *self,
GPid pid)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
g_return_if_fail (pid != FALSE);
- if (SP_SOURCE_GET_IFACE (self)->add_pid)
- SP_SOURCE_GET_IFACE (self)->add_pid (self, pid);
+ if (SYSPROF_SOURCE_GET_IFACE (self)->add_pid)
+ SYSPROF_SOURCE_GET_IFACE (self)->add_pid (self, pid);
}
void
-sp_source_emit_finished (SpSource *self)
+sysprof_source_emit_finished (SysprofSource *self)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
g_signal_emit (self, signals [FINISHED], 0);
}
void
-sp_source_emit_failed (SpSource *self,
+sysprof_source_emit_failed (SysprofSource *self,
const GError *error)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
g_return_if_fail (error != NULL);
g_signal_emit (self, signals [FAILED], 0, error);
}
void
-sp_source_emit_ready (SpSource *self)
+sysprof_source_emit_ready (SysprofSource *self)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
g_signal_emit (self, signals [READY], 0);
}
gboolean
-sp_source_get_is_ready (SpSource *self)
+sysprof_source_get_is_ready (SysprofSource *self)
{
- g_return_val_if_fail (SP_IS_SOURCE (self), FALSE);
+ g_return_val_if_fail (SYSPROF_IS_SOURCE (self), FALSE);
- if (SP_SOURCE_GET_IFACE (self)->get_is_ready)
- return SP_SOURCE_GET_IFACE (self)->get_is_ready (self);
+ if (SYSPROF_SOURCE_GET_IFACE (self)->get_is_ready)
+ return SYSPROF_SOURCE_GET_IFACE (self)->get_is_ready (self);
return TRUE;
}
void
-sp_source_prepare (SpSource *self)
+sysprof_source_prepare (SysprofSource *self)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
- if (SP_SOURCE_GET_IFACE (self)->prepare)
- SP_SOURCE_GET_IFACE (self)->prepare (self);
+ if (SYSPROF_SOURCE_GET_IFACE (self)->prepare)
+ SYSPROF_SOURCE_GET_IFACE (self)->prepare (self);
}
void
-sp_source_set_writer (SpSource *self,
- SpCaptureWriter *writer)
+sysprof_source_set_writer (SysprofSource *self,
+ SysprofCaptureWriter *writer)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
g_return_if_fail (writer != NULL);
- if (SP_SOURCE_GET_IFACE (self)->set_writer)
- SP_SOURCE_GET_IFACE (self)->set_writer (self, writer);
+ if (SYSPROF_SOURCE_GET_IFACE (self)->set_writer)
+ SYSPROF_SOURCE_GET_IFACE (self)->set_writer (self, writer);
}
void
-sp_source_start (SpSource *self)
+sysprof_source_start (SysprofSource *self)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
- if (SP_SOURCE_GET_IFACE (self)->start)
- SP_SOURCE_GET_IFACE (self)->start (self);
+ if (SYSPROF_SOURCE_GET_IFACE (self)->start)
+ SYSPROF_SOURCE_GET_IFACE (self)->start (self);
}
void
-sp_source_stop (SpSource *self)
+sysprof_source_stop (SysprofSource *self)
{
- g_return_if_fail (SP_IS_SOURCE (self));
+ g_return_if_fail (SYSPROF_IS_SOURCE (self));
- if (SP_SOURCE_GET_IFACE (self)->stop)
- SP_SOURCE_GET_IFACE (self)->stop (self);
+ if (SYSPROF_SOURCE_GET_IFACE (self)->stop)
+ SYSPROF_SOURCE_GET_IFACE (self)->stop (self);
}
diff --git a/src/libsysprof/sysprof-source.h b/src/libsysprof/sysprof-source.h
new file mode 100644
index 0000000..c04f850
--- /dev/null
+++ b/src/libsysprof/sysprof-source.h
@@ -0,0 +1,132 @@
+/* sysprof-source.h
+ *
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+#include "sysprof-capture-writer.h"
+
+G_BEGIN_DECLS
+
+#define SYSPROF_TYPE_SOURCE (sysprof_source_get_type())
+
+G_DECLARE_INTERFACE (SysprofSource, sysprof_source, SYSPROF, SOURCE, GObject)
+
+struct _SysprofSourceInterface
+{
+ GTypeInterface parent_iface;
+
+ /**
+ * SysprofSource::get_is_ready:
+ * @self: A SysprofSource.
+ *
+ * This function should return %TRUE if the source is ready to start
+ * profiling. If the source is not ready until after sysprof_source_start() has
+ * been called, use sysprof_source_emit_ready() to notify the profiler that the
+ * source is ready for profiling.
+ *
+ * Returns: %TRUE if the source is ready to start profiling.
+ */
+ gboolean (*get_is_ready) (SysprofSource *self);
+
+ /**
+ * SysprofSource::set_writer:
+ * @self: A #SysprofSource.
+ * @writer: A #SysprofCaptureWriter
+ *
+ * Sets the #SysprofCaptureWriter to use when profiling. @writer is only safe to
+ * use from the main thread. If you need to capture from a thread, you should
+ * create a memory-based #SysprofCaptureWriter and then splice that into this
+ * writer from the main thread when profiling completes.
+ *
+ * See sysprof_capture_writer_splice() for information on splicing writers.
+ */
+ void (*set_writer) (SysprofSource *self,
+ SysprofCaptureWriter *writer);
+
+ /**
+ * SysprofSource::prepare:
+ *
+ * This function is called before profiling has started. The source should
+ * prepare any pre-profiling setup here. It may perform this work
+ * asynchronously, but must g_object_notify() the SysprofSource::is-ready
+ * property once that asynchronous work has been performed. Until it
+ * is ready, #SysprofSource::is-ready must return FALSE.
+ */
+ void (*prepare) (SysprofSource *self);
+
+ /**
+ * SysprofSource::add_pid:
+ * @self: A #SysprofSource
+ * @pid: A pid_t > -1
+ *
+ * This function is used to notify the #SysprofSource that a new process,
+ * identified by @pid, should be profiled. By default, sources should
+ * assume all processes, and only restrict to a given set of pids if
+ * this function is called.
+ */
+ void (*add_pid) (SysprofSource *self,
+ GPid pid);
+
+ /**
+ * SysprofSource::start:
+ * @self: A #SysprofSource.
+ *
+ * Start profiling as configured.
+ *
+ * If a failure occurs while processing, the source should notify the
+ * profiling session via sysprof_source_emit_failed() from the main thread.
+ */
+ void (*start) (SysprofSource *self);
+
+ /**
+ * SysprofSource::stop:
+ * @self: A #SysprofSource.
+ *
+ * Stop capturing a profile. The source should immediately stop
+ * profiling and perform any cleanup tasks required. If doing
+ * off-main-thread capturing, this is a good time to splice your
+ * capture into the capture file set with sysprof_source_set_writer().
+ *
+ * If you need to perform asynchronous cleanup, call
+ * sysprof_source_emit_finished() once that work has completed. If you do
+ * not need to perform asynchronous cleanup, call
+ * sysprof_source_emit_finished() from this function.
+ *
+ * sysprof_source_emit_finished() must be called from the main-thread.
+ */
+ void (*stop) (SysprofSource *self);
+};
+
+void sysprof_source_add_pid (SysprofSource *self,
+ GPid pid);
+void sysprof_source_emit_ready (SysprofSource *self);
+void sysprof_source_emit_finished (SysprofSource *self);
+void sysprof_source_emit_failed (SysprofSource *self,
+ const GError *error);
+gboolean sysprof_source_get_is_ready (SysprofSource *self);
+void sysprof_source_prepare (SysprofSource *self);
+void sysprof_source_set_writer (SysprofSource *self,
+ SysprofCaptureWriter *writer);
+void sysprof_source_start (SysprofSource *self);
+void sysprof_source_stop (SysprofSource *self);
+
+G_END_DECLS
diff --git a/src/libsysprof/sp-symbol-dirs.c b/src/libsysprof/sysprof-symbol-dirs.c
similarity index 73%
rename from src/libsysprof/sp-symbol-dirs.c
rename to src/libsysprof/sysprof-symbol-dirs.c
index 9a9b49e..eabc927 100644
--- a/src/libsysprof/sp-symbol-dirs.c
+++ b/src/libsysprof/sysprof-symbol-dirs.c
@@ -1,4 +1,4 @@
-/* sp-symbol-dirs.c
+/* sysprof-symbol-dirs.c
*
* Copyright 2017-2019 Christian Hergert <chergert redhat com>
*
@@ -20,19 +20,19 @@
#include "config.h"
-#include "sp-symbol-dirs.h"
+#include "sysprof-symbol-dirs.h"
-static GPtrArray *sp_symbol_dirs;
+static GPtrArray *sysprof_symbol_dirs;
-G_LOCK_DEFINE (sp_symbol_dirs);
+G_LOCK_DEFINE (sysprof_symbol_dirs);
static GPtrArray *
-sp_get_symbol_dirs_locked (void)
+sysprof_get_symbol_dirs_locked (void)
{
- if (sp_symbol_dirs == NULL)
+ if (sysprof_symbol_dirs == NULL)
{
- sp_symbol_dirs = g_ptr_array_new ();
- g_ptr_array_add (sp_symbol_dirs, g_strdup ("/usr/lib/debug"));
+ sysprof_symbol_dirs = g_ptr_array_new ();
+ g_ptr_array_add (sysprof_symbol_dirs, g_strdup ("/usr/lib/debug"));
/* Add path to host system if we have it */
if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS))
@@ -44,22 +44,22 @@ sp_get_symbol_dirs_locked (void)
for (guint i = 0; i < G_N_ELEMENTS (tries); i++)
{
if (g_file_test (tries[i], G_FILE_TEST_EXISTS))
- g_ptr_array_add (sp_symbol_dirs, g_strdup (tries[i]));
+ g_ptr_array_add (sysprof_symbol_dirs, g_strdup (tries[i]));
}
}
}
- return sp_symbol_dirs;
+ return sysprof_symbol_dirs;
}
void
-sp_symbol_dirs_add (const gchar *path)
+sysprof_symbol_dirs_add (const gchar *path)
{
GPtrArray *ar;
- G_LOCK (sp_symbol_dirs);
+ G_LOCK (sysprof_symbol_dirs);
- ar = sp_get_symbol_dirs_locked ();
+ ar = sysprof_get_symbol_dirs_locked ();
for (guint i = 0; i < ar->len; i++)
{
@@ -72,17 +72,17 @@ sp_symbol_dirs_add (const gchar *path)
g_ptr_array_add (ar, g_strdup (path));
skip:
- G_UNLOCK (sp_symbol_dirs);
+ G_UNLOCK (sysprof_symbol_dirs);
}
void
-sp_symbol_dirs_remove (const gchar *path)
+sysprof_symbol_dirs_remove (const gchar *path)
{
GPtrArray *ar;
- G_LOCK (sp_symbol_dirs);
+ G_LOCK (sysprof_symbol_dirs);
- ar = sp_get_symbol_dirs_locked ();
+ ar = sysprof_get_symbol_dirs_locked ();
for (guint i = 0; i < ar->len; i++)
{
@@ -95,11 +95,11 @@ sp_symbol_dirs_remove (const gchar *path)
}
}
- G_UNLOCK (sp_symbol_dirs);
+ G_UNLOCK (sysprof_symbol_dirs);
}
/**
- * sp_symbol_dirs_get_paths:
+ * sysprof_symbol_dirs_get_paths:
* @dir: the directory containing the library
* @name: the name of the file in @dir
*
@@ -109,7 +109,7 @@ sp_symbol_dirs_remove (const gchar *path)
* Returns: (transfer full): A #GStrv of possible paths.
*/
gchar **
-sp_symbol_dirs_get_paths (const gchar *dir,
+sysprof_symbol_dirs_get_paths (const gchar *dir,
const gchar *name)
{
GPtrArray *ret = g_ptr_array_new ();
@@ -117,9 +117,9 @@ sp_symbol_dirs_get_paths (const gchar *dir,
g_ptr_array_add (ret, g_build_filename (dir, name, NULL));
- G_LOCK (sp_symbol_dirs);
+ G_LOCK (sysprof_symbol_dirs);
- ar = sp_get_symbol_dirs_locked ();
+ ar = sysprof_get_symbol_dirs_locked ();
for (guint i = 0; i < ar->len; i++)
{
@@ -132,7 +132,7 @@ sp_symbol_dirs_get_paths (const gchar *dir,
g_ptr_array_add (ret, g_build_filename (dir, ".debug", name, NULL));
g_ptr_array_add (ret, g_build_filename (DEBUGDIR, dir, name, NULL));
- G_UNLOCK (sp_symbol_dirs);
+ G_UNLOCK (sysprof_symbol_dirs);
g_ptr_array_add (ret, NULL);
diff --git a/src/libsysprof/sp-symbol-dirs.h b/src/libsysprof/sysprof-symbol-dirs.h
similarity index 83%
rename from src/libsysprof/sp-symbol-dirs.h
rename to src/libsysprof/sysprof-symbol-dirs.h
index ebd39fd..d721977 100644
--- a/src/libsysprof/sp-symbol-dirs.h
+++ b/src/libsysprof/sysprof-symbol-dirs.h
@@ -1,4 +1,4 @@
-/* sp-symbol-dirs.h
+/* sysprof-symbol-dirs.h
*
* Copyright 2017-2019 Christian Hergert <chergert redhat com>
*
@@ -27,11 +27,11 @@
G_BEGIN_DECLS
SYSPROF_AVAILABLE_IN_ALL
-void sp_symbol_dirs_add (const gchar *dir);
+void sysprof_symbol_dirs_add (const gchar *dir);
SYSPROF_AVAILABLE_IN_ALL
-void sp_symbol_dirs_remove (const gchar *dir);
+void sysprof_symbol_dirs_remove (const gchar *dir);
SYSPROF_AVAILABLE_IN_ALL
-gchar **sp_symbol_dirs_get_paths (const gchar *dir,
+gchar **sysprof_symbol_dirs_get_paths (const gchar *dir,
const gchar *name);
G_END_DECLS
diff --git a/src/libsysprof/sp-symbol-resolver.c b/src/libsysprof/sysprof-symbol-resolver.c
similarity index 57%
rename from src/libsysprof/sp-symbol-resolver.c
rename to src/libsysprof/sysprof-symbol-resolver.c
index 367e5ab..83da30a 100644
--- a/src/libsysprof/sp-symbol-resolver.c
+++ b/src/libsysprof/sysprof-symbol-resolver.c
@@ -1,4 +1,4 @@
-/* sp-symbol-resolver.c
+/* sysprof-symbol-resolver.c
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -20,15 +20,15 @@
#include "config.h"
-#include "sp-symbol-resolver.h"
+#include "sysprof-symbol-resolver.h"
-G_DEFINE_INTERFACE (SpSymbolResolver, sp_symbol_resolver, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (SysprofSymbolResolver, sysprof_symbol_resolver, G_TYPE_OBJECT)
static gchar *
-sp_symbol_resolver_real_resolve (SpSymbolResolver *self,
+sysprof_symbol_resolver_real_resolve (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpCaptureAddress address,
+ SysprofCaptureAddress address,
GQuark *tag)
{
*tag = 0;
@@ -36,42 +36,42 @@ sp_symbol_resolver_real_resolve (SpSymbolResolver *self,
}
static gchar *
-sp_symbol_resolver_real_resolve_with_context (SpSymbolResolver *self,
+sysprof_symbol_resolver_real_resolve_with_context (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpAddressContext context,
- SpCaptureAddress address,
+ SysprofAddressContext context,
+ SysprofCaptureAddress address,
GQuark *tag)
{
*tag = 0;
- if (SP_SYMBOL_RESOLVER_GET_IFACE (self)->resolve)
- return SP_SYMBOL_RESOLVER_GET_IFACE (self)->resolve (self, time, pid, address, tag);
+ if (SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->resolve)
+ return SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->resolve (self, time, pid, address, tag);
return NULL;
}
static void
-sp_symbol_resolver_default_init (SpSymbolResolverInterface *iface)
+sysprof_symbol_resolver_default_init (SysprofSymbolResolverInterface *iface)
{
- iface->resolve = sp_symbol_resolver_real_resolve;
- iface->resolve_with_context = sp_symbol_resolver_real_resolve_with_context;
+ iface->resolve = sysprof_symbol_resolver_real_resolve;
+ iface->resolve_with_context = sysprof_symbol_resolver_real_resolve_with_context;
}
void
-sp_symbol_resolver_load (SpSymbolResolver *self,
- SpCaptureReader *reader)
+sysprof_symbol_resolver_load (SysprofSymbolResolver *self,
+ SysprofCaptureReader *reader)
{
- g_return_if_fail (SP_IS_SYMBOL_RESOLVER (self));
+ g_return_if_fail (SYSPROF_IS_SYMBOL_RESOLVER (self));
g_return_if_fail (reader != NULL);
- if (SP_SYMBOL_RESOLVER_GET_IFACE (self)->load)
- SP_SYMBOL_RESOLVER_GET_IFACE (self)->load (self, reader);
+ if (SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->load)
+ SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->load (self, reader);
}
/**
- * sp_symbol_resolver_resolve:
- * @self: A #SpSymbolResolver
+ * sysprof_symbol_resolver_resolve:
+ * @self: A #SysprofSymbolResolver
* @time: The time of the sample
* @pid: The process generating the sample
* @address: the sample address
@@ -86,37 +86,37 @@ sp_symbol_resolver_load (SpSymbolResolver *self,
* Returns: (nullable) (transfer full): A newly allocated string, or %NULL.
*/
gchar *
-sp_symbol_resolver_resolve (SpSymbolResolver *self,
+sysprof_symbol_resolver_resolve (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpCaptureAddress address,
+ SysprofCaptureAddress address,
GQuark *tag)
{
GQuark dummy;
- g_return_val_if_fail (SP_IS_SYMBOL_RESOLVER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_SYMBOL_RESOLVER (self), NULL);
if (tag == NULL)
tag = &dummy;
*tag = 0;
- if (SP_SYMBOL_RESOLVER_GET_IFACE (self)->resolve)
- return SP_SYMBOL_RESOLVER_GET_IFACE (self)->resolve (self, time, pid, address, tag);
+ if (SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->resolve)
+ return SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->resolve (self, time, pid, address, tag);
return NULL;
}
/**
- * sp_symbol_resolver_resolve_with_context:
- * @self: A #SpSymbolResolver
+ * sysprof_symbol_resolver_resolve_with_context:
+ * @self: A #SysprofSymbolResolver
* @time: The time of the sample
* @pid: The process generating the sample
* @context: the address context
* @address: the sample address
* @tag: (out): A tag for the symbol.
*
- * This function is like sp_symbol_resolver_resolve() but allows
+ * This function is like sysprof_symbol_resolver_resolve() but allows
* access to the address context, which might be necessary to
* determine the difference between user space and kernel space
* addresses.
@@ -124,21 +124,21 @@ sp_symbol_resolver_resolve (SpSymbolResolver *self,
* Returns: (nullable) (transfer full): A newly allocated string, or %NULL.
*/
gchar *
-sp_symbol_resolver_resolve_with_context (SpSymbolResolver *self,
+sysprof_symbol_resolver_resolve_with_context (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpAddressContext context,
- SpCaptureAddress address,
+ SysprofAddressContext context,
+ SysprofCaptureAddress address,
GQuark *tag)
{
GQuark dummy;
- g_return_val_if_fail (SP_IS_SYMBOL_RESOLVER (self), NULL);
+ g_return_val_if_fail (SYSPROF_IS_SYMBOL_RESOLVER (self), NULL);
if (tag == NULL)
tag = &dummy;
*tag = 0;
- return SP_SYMBOL_RESOLVER_GET_IFACE (self)->resolve_with_context (self, time, pid, context, address, tag);
+ return SYSPROF_SYMBOL_RESOLVER_GET_IFACE (self)->resolve_with_context (self, time, pid, context, address,
tag);
}
diff --git a/src/libsysprof/sp-symbol-resolver.h b/src/libsysprof/sysprof-symbol-resolver.h
similarity index 55%
rename from src/libsysprof/sp-symbol-resolver.h
rename to src/libsysprof/sysprof-symbol-resolver.h
index a2b4761..9b9bd0e 100644
--- a/src/libsysprof/sp-symbol-resolver.h
+++ b/src/libsysprof/sysprof-symbol-resolver.h
@@ -1,4 +1,4 @@
-/* sp-symbol-resolver.h
+/* sysprof-symbol-resolver.h
*
* Copyright 2016-2019 Christian Hergert <chergert redhat com>
*
@@ -22,46 +22,46 @@
#include <glib-object.h>
-#include "sp-address.h"
-#include "sp-capture-reader.h"
+#include "sysprof-address.h"
+#include "sysprof-capture-reader.h"
G_BEGIN_DECLS
-#define SP_TYPE_SYMBOL_RESOLVER (sp_symbol_resolver_get_type())
+#define SYSPROF_TYPE_SYMBOL_RESOLVER (sysprof_symbol_resolver_get_type())
-G_DECLARE_INTERFACE (SpSymbolResolver, sp_symbol_resolver, SP, SYMBOL_RESOLVER, GObject)
+G_DECLARE_INTERFACE (SysprofSymbolResolver, sysprof_symbol_resolver, SYSPROF, SYMBOL_RESOLVER, GObject)
-struct _SpSymbolResolverInterface
+struct _SysprofSymbolResolverInterface
{
GTypeInterface parent_interface;
- void (*load) (SpSymbolResolver *self,
- SpCaptureReader *reader);
- gchar *(*resolve) (SpSymbolResolver *self,
+ void (*load) (SysprofSymbolResolver *self,
+ SysprofCaptureReader *reader);
+ gchar *(*resolve) (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpCaptureAddress address,
+ SysprofCaptureAddress address,
GQuark *tag);
- gchar *(*resolve_with_context) (SpSymbolResolver *self,
+ gchar *(*resolve_with_context) (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpAddressContext context,
- SpCaptureAddress address,
+ SysprofAddressContext context,
+ SysprofCaptureAddress address,
GQuark *tag);
};
-void sp_symbol_resolver_load (SpSymbolResolver *self,
- SpCaptureReader *reader);
-gchar *sp_symbol_resolver_resolve (SpSymbolResolver *self,
+void sysprof_symbol_resolver_load (SysprofSymbolResolver *self,
+ SysprofCaptureReader *reader);
+gchar *sysprof_symbol_resolver_resolve (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpCaptureAddress address,
+ SysprofCaptureAddress address,
GQuark *tag);
-gchar *sp_symbol_resolver_resolve_with_context (SpSymbolResolver *self,
+gchar *sysprof_symbol_resolver_resolve_with_context (SysprofSymbolResolver *self,
guint64 time,
GPid pid,
- SpAddressContext context,
- SpCaptureAddress address,
+ SysprofAddressContext context,
+ SysprofCaptureAddress address,
GQuark *tag);
G_END_DECLS
diff --git a/src/libsysprof/sysprof.h b/src/libsysprof/sysprof.h
index 844c268..7245d67 100644
--- a/src/libsysprof/sysprof.h
+++ b/src/libsysprof/sysprof.h
@@ -24,29 +24,29 @@ G_BEGIN_DECLS
#define SYSPROF_INSIDE
-# include "sp-callgraph-profile.h"
-# include "sp-capture-gobject.h"
-# include "sp-local-profiler.h"
-# include "sp-kallsyms.h"
-# include "sp-profile.h"
-# include "sp-profiler.h"
-# include "sp-map-lookaside.h"
-# include "sp-source.h"
-# include "sp-elf-symbol-resolver.h"
-# include "sp-jitmap-symbol-resolver.h"
-# include "sp-kernel-symbol-resolver.h"
-# include "sp-kernel-symbol.h"
-# include "sp-symbol-dirs.h"
-# include "sp-symbol-resolver.h"
-# include "sp-map-lookaside.h"
-# include "sp-selection.h"
+# include "sysprof-callgraph-profile.h"
+# include "sysprof-capture-gobject.h"
+# include "sysprof-local-profiler.h"
+# include "sysprof-kallsyms.h"
+# include "sysprof-profile.h"
+# include "sysprof-profiler.h"
+# include "sysprof-map-lookaside.h"
+# include "sysprof-source.h"
+# include "sysprof-elf-symbol-resolver.h"
+# include "sysprof-jitmap-symbol-resolver.h"
+# include "sysprof-kernel-symbol-resolver.h"
+# include "sysprof-kernel-symbol.h"
+# include "sysprof-symbol-dirs.h"
+# include "sysprof-symbol-resolver.h"
+# include "sysprof-map-lookaside.h"
+# include "sysprof-selection.h"
#ifdef __linux__
-# include "sp-gjs-source.h"
-# include "sp-hostinfo-source.h"
-# include "sp-memory-source.h"
-# include "sp-perf-source.h"
-# include "sp-proc-source.h"
+# include "sysprof-gjs-source.h"
+# include "sysprof-hostinfo-source.h"
+# include "sysprof-memory-source.h"
+# include "sysprof-perf-source.h"
+# include "sysprof-proc-source.h"
#endif
#undef SYSPROF_INSIDE
diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build
index df9feba..1595ed4 100644
--- a/src/sysprof/meson.build
+++ b/src/sysprof/meson.build
@@ -2,9 +2,9 @@ if get_option('enable_gtk')
sysprof_sources = [
'sysprof.c',
- 'sp-application.c',
- 'sp-window.c',
- 'sp-window-settings.c',
+ 'sysprof-application.c',
+ 'sysprof-window.c',
+ 'sysprof-window-settings.c',
]
sysprof_resources = gnome.compile_resources('sysprof-resources', 'sysprof.gresource.xml',
diff --git a/src/sysprof/sp-application.c b/src/sysprof/sysprof-application.c
similarity index 80%
rename from src/sysprof/sp-application.c
rename to src/sysprof/sysprof-application.c
index b1fb59f..2efe39e 100644
--- a/src/sysprof/sp-application.c
+++ b/src/sysprof/sysprof-application.c
@@ -1,4 +1,4 @@
-/* sp-application.c
+/* sysprof-application.c
*
* Copyright 2016 Christian Hergert <chergert redhat com>
*
@@ -21,16 +21,16 @@
#include <glib/gi18n.h>
#include <locale.h>
-#include "sp-application.h"
-#include "sp-credits.h"
-#include "sp-window.h"
+#include "sysprof-application.h"
+#include "sysprof-credits.h"
+#include "sysprof-window.h"
-struct _SpApplication
+struct _SysprofApplication
{
GtkApplication parent_instance;
};
-G_DEFINE_TYPE (SpApplication, sp_application, GTK_TYPE_APPLICATION)
+G_DEFINE_TYPE (SysprofApplication, sysprof_application, GTK_TYPE_APPLICATION)
struct {
const gchar *action_name;
@@ -43,9 +43,9 @@ struct {
};
static void
-sp_application_activate (GApplication *app)
+sysprof_application_activate (GApplication *app)
{
- SpWindow *window;
+ SysprofWindow *window;
GList *windows;
g_assert (GTK_IS_APPLICATION (app));
@@ -54,14 +54,14 @@ sp_application_activate (GApplication *app)
for (; windows != NULL; windows = windows->next)
{
- if (SP_IS_WINDOW (windows->data))
+ if (SYSPROF_IS_WINDOW (windows->data))
{
gtk_window_present (windows->data);
return;
}
}
- window = g_object_new (SP_TYPE_WINDOW,
+ window = g_object_new (SYSPROF_TYPE_WINDOW,
"application", app,
NULL);
@@ -69,7 +69,7 @@ sp_application_activate (GApplication *app)
}
static void
-sp_application_open (GApplication *app,
+sysprof_application_open (GApplication *app,
GFile **files,
gint n_files,
const gchar *hint)
@@ -77,36 +77,36 @@ sp_application_open (GApplication *app,
guint opened = 0;
gint i;
- g_assert (SP_IS_APPLICATION (app));
+ g_assert (SYSPROF_IS_APPLICATION (app));
g_assert (files != NULL || n_files == 0);
for (i = 0; i < n_files; i++)
{
- SpWindow *window;
+ SysprofWindow *window;
- window = g_object_new (SP_TYPE_WINDOW,
+ window = g_object_new (SYSPROF_TYPE_WINDOW,
"application", app,
NULL);
- sp_window_open (window, files [i]);
+ sysprof_window_open (window, files [i]);
gtk_window_present (GTK_WINDOW (window));
opened++;
}
if (opened == 0)
- sp_application_activate (app);
+ sysprof_application_activate (app);
}
static void
-sp_application_startup (GApplication *application)
+sysprof_application_startup (GApplication *application)
{
g_autoptr(GtkCssProvider) provider = NULL;
#ifdef DEVELOPMENT_BUILD
g_autoptr(GtkCssProvider) adwaita = NULL;
#endif
- g_assert (SP_IS_APPLICATION (application));
+ g_assert (SYSPROF_IS_APPLICATION (application));
- G_APPLICATION_CLASS (sp_application_parent_class)->startup (application);
+ G_APPLICATION_CLASS (sysprof_application_parent_class)->startup (application);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gnome/sysprof/theme/shared.css");
@@ -129,13 +129,13 @@ sp_application_startup (GApplication *application)
}
static void
-sp_application_class_init (SpApplicationClass *klass)
+sysprof_application_class_init (SysprofApplicationClass *klass)
{
GApplicationClass *app_class = G_APPLICATION_CLASS (klass);
- app_class->open = sp_application_open;
- app_class->startup = sp_application_startup;
- app_class->activate = sp_application_activate;
+ app_class->open = sysprof_application_open;
+ app_class->startup = sysprof_application_startup;
+ app_class->activate = sysprof_application_activate;
}
static void
@@ -170,7 +170,7 @@ sysprof_about (GSimpleAction *action,
for (; windows != NULL; windows = windows->next)
{
- if (SP_IS_WINDOW (windows->data))
+ if (SYSPROF_IS_WINDOW (windows->data))
{
best_toplevel = windows->data;
break;
@@ -208,10 +208,10 @@ sysprof_help (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- SpApplication *self = user_data;
+ SysprofApplication *self = user_data;
GtkWindow *window;
- g_assert (SP_IS_APPLICATION (self));
+ g_assert (SYSPROF_IS_APPLICATION (self));
g_assert (G_IS_SIMPLE_ACTION (action));
window = gtk_application_get_active_window (GTK_APPLICATION (self));
@@ -227,14 +227,14 @@ sysprof_new_window (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- SpApplication *self = user_data;
- SpWindow *window;
+ SysprofApplication *self = user_data;
+ SysprofWindow *window;
- g_assert (SP_IS_APPLICATION (self));
+ g_assert (SYSPROF_IS_APPLICATION (self));
g_assert (G_IS_SIMPLE_ACTION (action));
g_assert (variant == NULL);
- window = g_object_new (SP_TYPE_WINDOW,
+ window = g_object_new (SYSPROF_TYPE_WINDOW,
"application", self,
NULL);
gtk_window_present (GTK_WINDOW (window));
@@ -259,27 +259,27 @@ sysprof_open_capture (GSimpleAction *action,
{
window = list->data;
- if (SP_IS_WINDOW (window))
+ if (SYSPROF_IS_WINDOW (window))
{
- SpWindowState state;
+ SysprofWindowState state;
- state = sp_window_get_state (SP_WINDOW (window));
+ state = sysprof_window_get_state (SYSPROF_WINDOW (window));
- if (state == SP_WINDOW_STATE_EMPTY)
+ if (state == SYSPROF_WINDOW_STATE_EMPTY)
{
- sp_window_open_from_dialog (SP_WINDOW (window));
+ sysprof_window_open_from_dialog (SYSPROF_WINDOW (window));
return;
}
}
}
- window = g_object_new (SP_TYPE_WINDOW,
+ window = g_object_new (SYSPROF_TYPE_WINDOW,
"application", app,
NULL);
gtk_window_present (GTK_WINDOW (window));
- sp_window_open_from_dialog (SP_WINDOW (window));
+ sysprof_window_open_from_dialog (SYSPROF_WINDOW (window));
}
static void
@@ -288,7 +288,7 @@ sysprof_show_help_overlay (GSimpleAction *action,
gpointer user_data)
{
GtkApplication *app = user_data;
- SpWindow *window = NULL;
+ SysprofWindow *window = NULL;
g_assert (G_IS_APPLICATION (app));
g_assert (G_IS_SIMPLE_ACTION (action));
@@ -298,16 +298,16 @@ sysprof_show_help_overlay (GSimpleAction *action,
{
GtkWindow *element = list->data;
- if (SP_IS_WINDOW (element))
+ if (SYSPROF_IS_WINDOW (element))
{
- window = SP_WINDOW (element);
+ window = SYSPROF_WINDOW (element);
break;
}
}
if (window == NULL)
{
- window = g_object_new (SP_TYPE_WINDOW,
+ window = g_object_new (SYSPROF_TYPE_WINDOW,
"application", app,
NULL);
gtk_window_present (GTK_WINDOW (window));
@@ -319,7 +319,7 @@ sysprof_show_help_overlay (GSimpleAction *action,
}
static void
-sp_application_init (SpApplication *self)
+sysprof_application_init (SysprofApplication *self)
{
static const GActionEntry actions[] = {
{ "about", sysprof_about },
@@ -343,10 +343,10 @@ sp_application_init (SpApplication *self)
g_application_set_default (G_APPLICATION (self));
}
-SpApplication *
-sp_application_new (void)
+SysprofApplication *
+sysprof_application_new (void)
{
- return g_object_new (SP_TYPE_APPLICATION,
+ return g_object_new (SYSPROF_TYPE_APPLICATION,
"application-id", "org.gnome.Sysprof2",
"resource-base-path", "/org/gnome/sysprof",
"flags", G_APPLICATION_HANDLES_OPEN,
diff --git a/src/sysprof/sp-application.h b/src/sysprof/sysprof-application.h
similarity index 69%
rename from src/sysprof/sp-application.h
rename to src/sysprof/sysprof-application.h
index 4952048..a3c2f51 100644
--- a/src/sysprof/sp-application.h
+++ b/src/sysprof/sysprof-application.h
@@ -1,4 +1,4 @@
-/* sp-application.h
+/* sysprof-application.h
*
* Copyright 2016 Christian Hergert <chergert redhat com>
*
@@ -16,19 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SP_APPLICATION_H
-#define SP_APPLICATION_H
+#ifndef SYSPROF_APPLICATION_H
+#define SYSPROF_APPLICATION_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
-#define SP_TYPE_APPLICATION (sp_application_get_type())
+#define SYSPROF_TYPE_APPLICATION (sysprof_application_get_type())
-G_DECLARE_FINAL_TYPE (SpApplication, sp_application, SP, APPLICATION, GtkApplication)
+G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, GtkApplication)
-SpApplication *sp_application_new (void);
+SysprofApplication *sysprof_application_new (void);
G_END_DECLS
-#endif /* SP_APPLICATION_H */
+#endif /* SYSPROF_APPLICATION_H */
diff --git a/src/sysprof/sp-credits.h b/src/sysprof/sysprof-credits.h
similarity index 87%
rename from src/sysprof/sp-credits.h
rename to src/sysprof/sysprof-credits.h
index 21523ae..17231be 100644
--- a/src/sysprof/sp-credits.h
+++ b/src/sysprof/sysprof-credits.h
@@ -1,5 +1,5 @@
-#ifndef SP_CREDITS_H
-#define SP_CREDITS_H
+#ifndef SYSPROF_CREDITS_H
+#define SYSPROF_CREDITS_H
#include <glib.h>
@@ -35,4 +35,4 @@ static const gchar *sysprof_artists[] = {
G_END_DECLS
-#endif /* SP_CREDITS_H */
+#endif /* SYSPROF_CREDITS_H */
diff --git a/src/sysprof/sp-window-settings.c b/src/sysprof/sysprof-window-settings.c
similarity index 80%
rename from src/sysprof/sp-window-settings.c
rename to src/sysprof/sysprof-window-settings.c
index cc81e77..59c29af 100644
--- a/src/sysprof/sp-window-settings.c
+++ b/src/sysprof/sysprof-window-settings.c
@@ -1,4 +1,4 @@
-/* sp-window-settings.c
+/* sysprof-window-settings.c
*
* Copyright 2016 Christian Hergert <chergert redhat com>
*
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "sp-window.h"
-#include "sp-window-settings.h"
+#include "sysprof-window.h"
+#include "sysprof-window-settings.h"
#define WINDOW_MIN_WIDTH 1200
#define WINDOW_MIN_HEIGHT 700
@@ -26,7 +26,7 @@
static GSettings *settings;
static gboolean
-sp_window_settings__window_save_settings_cb (gpointer data)
+sysprof_window_settings__window_save_settings_cb (gpointer data)
{
GtkWindow *window = data;
GdkRectangle geom;
@@ -49,7 +49,7 @@ sp_window_settings__window_save_settings_cb (gpointer data)
}
static gboolean
-sp_window_settings__window_configure_event (GtkWindow *window,
+sysprof_window_settings__window_configure_event (GtkWindow *window,
GdkEventConfigure *event)
{
guint handler;
@@ -63,7 +63,7 @@ sp_window_settings__window_configure_event (GtkWindow *window,
if (handler == 0)
{
handler = g_timeout_add_seconds (SAVE_TIMEOUT_SECS,
- sp_window_settings__window_save_settings_cb,
+ sysprof_window_settings__window_save_settings_cb,
window);
g_object_set_data (G_OBJECT (window), "SETTINGS_HANDLER_ID", GINT_TO_POINTER (handler));
}
@@ -72,7 +72,7 @@ sp_window_settings__window_configure_event (GtkWindow *window,
}
static void
-sp_window_settings__window_realize (GtkWindow *window)
+sysprof_window_settings__window_realize (GtkWindow *window)
{
GtkApplication *app;
GdkRectangle geom = { 0 };
@@ -102,7 +102,7 @@ sp_window_settings__window_realize (GtkWindow *window)
{
GtkWindow *ele = list->data;
- if (SP_IS_WINDOW (ele) && (ele != window) &&
+ if (SYSPROF_IS_WINDOW (ele) && (ele != window) &&
gtk_widget_get_visible (GTK_WIDGET (window)))
count++;
}
@@ -115,7 +115,7 @@ sp_window_settings__window_realize (GtkWindow *window)
}
static void
-sp_window_settings__window_destroy (GtkWindow *window)
+sysprof_window_settings__window_destroy (GtkWindow *window)
{
guint handler;
@@ -131,22 +131,22 @@ sp_window_settings__window_destroy (GtkWindow *window)
}
g_signal_handlers_disconnect_by_func (window,
- G_CALLBACK (sp_window_settings__window_configure_event),
+ G_CALLBACK (sysprof_window_settings__window_configure_event),
NULL);
g_signal_handlers_disconnect_by_func (window,
- G_CALLBACK (sp_window_settings__window_destroy),
+ G_CALLBACK (sysprof_window_settings__window_destroy),
NULL);
g_signal_handlers_disconnect_by_func (window,
- G_CALLBACK (sp_window_settings__window_realize),
+ G_CALLBACK (sysprof_window_settings__window_realize),
NULL);
g_object_unref (settings);
}
void
-sp_window_settings_register (GtkWindow *window)
+sysprof_window_settings_register (GtkWindow *window)
{
if (settings == NULL)
{
@@ -160,16 +160,16 @@ sp_window_settings_register (GtkWindow *window)
g_signal_connect (window,
"configure-event",
- G_CALLBACK (sp_window_settings__window_configure_event),
+ G_CALLBACK (sysprof_window_settings__window_configure_event),
NULL);
g_signal_connect (window,
"destroy",
- G_CALLBACK (sp_window_settings__window_destroy),
+ G_CALLBACK (sysprof_window_settings__window_destroy),
NULL);
g_signal_connect (window,
"realize",
- G_CALLBACK (sp_window_settings__window_realize),
+ G_CALLBACK (sysprof_window_settings__window_realize),
NULL);
}
diff --git a/src/sysprof/sp-window-settings.h b/src/sysprof/sysprof-window-settings.h
similarity index 79%
rename from src/sysprof/sp-window-settings.h
rename to src/sysprof/sysprof-window-settings.h
index 223dc77..06b1228 100644
--- a/src/sysprof/sp-window-settings.h
+++ b/src/sysprof/sysprof-window-settings.h
@@ -1,4 +1,4 @@
-/* sp-window-settings.h
+/* sysprof-window-settings.h
*
* Copyright 2016 Christian Hergert <chergert redhat com>
*
@@ -16,15 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SP_WINDOW_SETTINGS_H
-#define SP_WINDOW_SETTINGS_H
+#ifndef SYSPROF_WINDOW_SETTINGS_H
+#define SYSPROF_WINDOW_SETTINGS_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
-void sp_window_settings_register (GtkWindow *window);
+void sysprof_window_settings_register (GtkWindow *window);
G_END_DECLS
-#endif /* SP_WINDOW_SETTINGS_H */
+#endif /* SYSPROF_WINDOW_SETTINGS_H */
diff --git a/src/sysprof/sp-window.c b/src/sysprof/sysprof-window.c
similarity index 56%
rename from src/sysprof/sp-window.c
rename to src/sysprof/sysprof-window.c
index faf6d70..239964f 100644
--- a/src/sysprof/sp-window.c
+++ b/src/sysprof/sysprof-window.c
@@ -1,4 +1,4 @@
-/* sp-window.c
+/* sysprof-window.c
*
* Copyright 2016 Christian Hergert <chergert redhat com>
*
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define G_LOG_DOMAIN "sp-window"
+#define G_LOG_DOMAIN "sysprof-window"
#include "config.h"
@@ -25,38 +25,38 @@
#include <math.h>
#include <sysprof-ui.h>
-#include "sp-application.h"
-#include "sp-window.h"
-#include "sp-window-settings.h"
+#include "sysprof-application.h"
+#include "sysprof-window.h"
+#include "sysprof-window-settings.h"
-struct _SpWindow
+struct _SysprofWindow
{
GtkApplicationWindow parent_instance;
- SpWindowState state;
+ SysprofWindowState state;
- SpProfiler *profiler;
- SpCaptureReader *reader;
+ SysprofProfiler *profiler;
+ SysprofCaptureReader *reader;
GCancellable *refilter_cancellable;
/* Gtk widget template children */
- SpCallgraphView *callgraph_view;
- SpEmptyStateView *empty_view;
+ SysprofCallgraphView *callgraph_view;
+ SysprofEmptyStateView *empty_view;
GtkMenuButton *gear_menu_button;
GtkInfoBar *info_bar;
GtkLabel *info_bar_label;
GtkRevealer *info_bar_revealer;
GtkPaned *paned;
- SpProfilerMenuButton *profiler_menu_button;
- SpRecordingStateView *recording_view;
+ SysprofProfilerMenuButton *profiler_menu_button;
+ SysprofRecordingStateView *recording_view;
GtkButton *record_button;
GtkLabel *subtitle;
GtkLabel *stat_label;
GtkLabel *title;
GtkStack *view_stack;
- SpVisualizerView *visualizers;
- SpZoomManager *zoom_manager;
+ SysprofVisualizerView *visualizers;
+ SysprofZoomManager *zoom_manager;
GtkLabel *zoom_one_label;
guint stats_handler;
@@ -64,10 +64,10 @@ struct _SpWindow
guint closing : 1;
};
-G_DEFINE_TYPE (SpWindow, sp_window, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (SysprofWindow, sysprof_window, GTK_TYPE_APPLICATION_WINDOW)
-static void sp_window_set_state (SpWindow *self,
- SpWindowState state);
+static void sysprof_window_set_state (SysprofWindow *self,
+ SysprofWindowState state);
enum {
START_RECORDING,
@@ -77,11 +77,11 @@ enum {
static guint signals [N_SIGNALS];
-static void sp_window_set_profiler (SpWindow *self,
- SpProfiler *profiler);
+static void sysprof_window_set_profiler (SysprofWindow *self,
+ SysprofProfiler *profiler);
static G_GNUC_PRINTF(3, 4) void
-sp_window_notify_user (SpWindow *self,
+sysprof_window_notify_user (SysprofWindow *self,
GtkMessageType message_type,
const gchar *format,
...)
@@ -89,7 +89,7 @@ sp_window_notify_user (SpWindow *self,
g_autofree gchar *str = NULL;
va_list args;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (format != NULL);
va_start (args, format);
@@ -102,7 +102,7 @@ sp_window_notify_user (SpWindow *self,
}
static void
-sp_window_action_set (SpWindow *self,
+sysprof_window_action_set (SysprofWindow *self,
const gchar *action_name,
const gchar *first_property,
...)
@@ -110,7 +110,7 @@ sp_window_action_set (SpWindow *self,
gpointer action;
va_list args;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (action_name != NULL);
action = g_action_map_lookup_action (G_ACTION_MAP (self), action_name);
@@ -127,25 +127,25 @@ sp_window_action_set (SpWindow *self,
}
static gboolean
-sp_window_update_stats (gpointer data)
+sysprof_window_update_stats (gpointer data)
{
- SpWindow *self = data;
+ SysprofWindow *self = data;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
if (self->profiler != NULL)
{
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
- if (NULL != (writer = sp_profiler_get_writer (self->profiler)))
+ if (NULL != (writer = sysprof_profiler_get_writer (self->profiler)))
{
g_autofree gchar *str = NULL;
- SpCaptureStat stbuf;
+ SysprofCaptureStat stbuf;
guint count;
- sp_capture_writer_stat (writer, &stbuf);
+ sysprof_capture_writer_stat (writer, &stbuf);
- count = stbuf.frame_count[SP_CAPTURE_FRAME_SAMPLE];
+ count = stbuf.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE];
/* Translators: %u is the number (amount) of samples. */
str = g_strdup_printf (_("Samples: %u"), count);
gtk_label_set_label (self->stat_label, str);
@@ -157,17 +157,17 @@ sp_window_update_stats (gpointer data)
static void
-sp_window_update_subtitle (SpWindow *self)
+sysprof_window_update_subtitle (SysprofWindow *self)
{
g_autofree gchar *relative = NULL;
const gchar *filename;
const gchar *date;
GTimeVal tv;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (self->reader != NULL);
- if (NULL != (filename = sp_capture_reader_get_filename (self->reader)))
+ if (NULL != (filename = sysprof_capture_reader_get_filename (self->reader)))
{
g_autoptr(GFile) home = NULL;
g_autoptr(GFile) file = NULL;
@@ -182,7 +182,7 @@ sp_window_update_subtitle (SpWindow *self)
if (filename == NULL)
filename = _("[Memory Capture]");
- date = sp_capture_reader_get_time (self->reader);
+ date = sysprof_capture_reader_get_time (self->reader);
if (g_time_val_from_iso8601 (date, &tv))
{
@@ -203,49 +203,49 @@ sp_window_update_subtitle (SpWindow *self)
}
static void
-sp_window_build_profile_cb (GObject *object,
+sysprof_window_build_profile_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- SpProfile *profile = (SpProfile *)object;
- g_autoptr(SpWindow) self = user_data;
+ SysprofProfile *profile = (SysprofProfile *)object;
+ g_autoptr(SysprofWindow) self = user_data;
g_autoptr(GError) error = NULL;
- g_assert (SP_IS_CALLGRAPH_PROFILE (profile));
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_CALLGRAPH_PROFILE (profile));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (G_IS_ASYNC_RESULT (result));
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), TRUE);
- if (!sp_profile_generate_finish (profile, result, &error))
+ if (!sysprof_profile_generate_finish (profile, result, &error))
{
/* If we were cancelled while updating the selection, ignore the failure */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
- (self->state == SP_WINDOW_STATE_BROWSING))
+ (self->state == SYSPROF_WINDOW_STATE_BROWSING))
return;
- sp_window_notify_user (self, GTK_MESSAGE_ERROR, "%s", error->message);
- sp_window_set_state (self, SP_WINDOW_STATE_EMPTY);
+ sysprof_window_notify_user (self, GTK_MESSAGE_ERROR, "%s", error->message);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_EMPTY);
return;
}
- sp_callgraph_view_set_profile (self->callgraph_view, SP_CALLGRAPH_PROFILE (profile));
- if (sp_callgraph_view_get_n_functions (self->callgraph_view) == 0)
- sp_window_notify_user (self,
+ sysprof_callgraph_view_set_profile (self->callgraph_view, SYSPROF_CALLGRAPH_PROFILE (profile));
+ if (sysprof_callgraph_view_get_n_functions (self->callgraph_view) == 0)
+ sysprof_window_notify_user (self,
GTK_MESSAGE_WARNING,
_("Not enough samples were collected to generate a callgraph"));
- sp_visualizer_view_set_reader (self->visualizers, self->reader);
+ sysprof_visualizer_view_set_reader (self->visualizers, self->reader);
- sp_window_set_state (self, SP_WINDOW_STATE_BROWSING);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_BROWSING);
}
static void
-sp_window_build_profile (SpWindow *self)
+sysprof_window_build_profile (SysprofWindow *self)
{
- g_autoptr(SpProfile) profile = NULL;
- SpSelection *selection;
+ g_autoptr(SysprofProfile) profile = NULL;
+ SysprofSelection *selection;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (self->reader != NULL);
if (self->refilter_cancellable != NULL)
@@ -255,18 +255,18 @@ sp_window_build_profile (SpWindow *self)
g_clear_object (&self->refilter_cancellable);
}
- selection = sp_visualizer_view_get_selection (self->visualizers);
+ selection = sysprof_visualizer_view_get_selection (self->visualizers);
- profile = sp_callgraph_profile_new_with_selection (selection);
- sp_profile_set_reader (profile, self->reader);
+ profile = sysprof_callgraph_profile_new_with_selection (selection);
+ sysprof_profile_set_reader (profile, self->reader);
self->refilter_cancellable = g_cancellable_new ();
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), FALSE);
- sp_profile_generate (profile,
+ sysprof_profile_generate (profile,
self->refilter_cancellable,
- sp_window_build_profile_cb,
+ sysprof_window_build_profile_cb,
g_object_ref (self));
}
@@ -289,12 +289,12 @@ remove_class (gpointer widget,
}
static void
-sp_window_set_state (SpWindow *self,
- SpWindowState state)
+sysprof_window_set_state (SysprofWindow *self,
+ SysprofWindowState state)
{
- g_autoptr(SpProfiler) profiler = NULL;
+ g_autoptr(SysprofProfiler) profiler = NULL;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
if (self->state == state)
return;
@@ -303,29 +303,29 @@ sp_window_set_state (SpWindow *self,
switch (state)
{
- case SP_WINDOW_STATE_EMPTY:
- case SP_WINDOW_STATE_FAILED:
+ case SYSPROF_WINDOW_STATE_EMPTY:
+ case SYSPROF_WINDOW_STATE_FAILED:
/* Translators: This is a button. */
gtk_button_set_label (self->record_button, _("Record"));
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), TRUE);
add_class (self->record_button, "suggested-action");
remove_class (self->record_button, "destructive-action");
- if (state == SP_WINDOW_STATE_FAILED)
+ if (state == SYSPROF_WINDOW_STATE_FAILED)
gtk_stack_set_visible_child_name (self->view_stack, "failed");
else
gtk_stack_set_visible_child_name (self->view_stack, "empty");
gtk_label_set_label (self->subtitle, _("Not running"));
- sp_callgraph_view_set_profile (self->callgraph_view, NULL);
+ sysprof_callgraph_view_set_profile (self->callgraph_view, NULL);
gtk_widget_set_visible (GTK_WIDGET (self->stat_label), FALSE);
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
- sp_window_action_set (self, "close-capture", "enabled", FALSE, NULL);
- sp_window_action_set (self, "save-capture", "enabled", FALSE, NULL);
- sp_window_action_set (self, "screenshot", "enabled", FALSE, NULL);
- profiler = sp_local_profiler_new ();
- sp_window_set_profiler (self, profiler);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
+ sysprof_window_action_set (self, "close-capture", "enabled", FALSE, NULL);
+ sysprof_window_action_set (self, "save-capture", "enabled", FALSE, NULL);
+ sysprof_window_action_set (self, "screenshot", "enabled", FALSE, NULL);
+ profiler = sysprof_local_profiler_new ();
+ sysprof_window_set_profiler (self, profiler);
break;
- case SP_WINDOW_STATE_RECORDING:
+ case SYSPROF_WINDOW_STATE_RECORDING:
/* Translators: This is a button. */
gtk_button_set_label (self->record_button, _("Stop"));
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), TRUE);
@@ -334,23 +334,23 @@ sp_window_set_state (SpWindow *self,
gtk_stack_set_visible_child_name (self->view_stack, "recording");
gtk_label_set_label (self->subtitle, _("Recording…"));
gtk_widget_set_visible (GTK_WIDGET (self->stat_label), TRUE);
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
- sp_callgraph_view_set_profile (self->callgraph_view, NULL);
- sp_window_action_set (self, "close-capture", "enabled", FALSE, NULL);
- sp_window_action_set (self, "save-capture", "enabled", FALSE, NULL);
- sp_window_action_set (self, "screenshot", "enabled", FALSE, NULL);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
+ sysprof_callgraph_view_set_profile (self->callgraph_view, NULL);
+ sysprof_window_action_set (self, "close-capture", "enabled", FALSE, NULL);
+ sysprof_window_action_set (self, "save-capture", "enabled", FALSE, NULL);
+ sysprof_window_action_set (self, "screenshot", "enabled", FALSE, NULL);
break;
- case SP_WINDOW_STATE_PROCESSING:
+ case SYSPROF_WINDOW_STATE_PROCESSING:
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), FALSE);
gtk_label_set_label (self->subtitle, _("Building profile…"));
- sp_window_action_set (self, "close-capture", "enabled", FALSE, NULL);
- sp_window_action_set (self, "save-capture", "enabled", FALSE, NULL);
- sp_window_action_set (self, "screenshot", "enabled", FALSE, NULL);
- sp_window_build_profile (self);
+ sysprof_window_action_set (self, "close-capture", "enabled", FALSE, NULL);
+ sysprof_window_action_set (self, "save-capture", "enabled", FALSE, NULL);
+ sysprof_window_action_set (self, "screenshot", "enabled", FALSE, NULL);
+ sysprof_window_build_profile (self);
break;
- case SP_WINDOW_STATE_BROWSING:
+ case SYSPROF_WINDOW_STATE_BROWSING:
/* Translators: This is a button. */
gtk_button_set_label (self->record_button, _("Record"));
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), TRUE);
@@ -358,16 +358,16 @@ sp_window_set_state (SpWindow *self,
remove_class (self->record_button, "destructive-action");
gtk_widget_set_visible (GTK_WIDGET (self->stat_label), TRUE);
gtk_stack_set_visible_child_name (self->view_stack, "browsing");
- sp_window_update_stats (self);
- sp_window_update_subtitle (self);
- sp_window_action_set (self, "close-capture", "enabled", TRUE, NULL);
- sp_window_action_set (self, "save-capture", "enabled", TRUE, NULL);
- sp_window_action_set (self, "screenshot", "enabled", TRUE, NULL);
- profiler = sp_local_profiler_new ();
- sp_window_set_profiler (self, profiler);
+ sysprof_window_update_stats (self);
+ sysprof_window_update_subtitle (self);
+ sysprof_window_action_set (self, "close-capture", "enabled", TRUE, NULL);
+ sysprof_window_action_set (self, "save-capture", "enabled", TRUE, NULL);
+ sysprof_window_action_set (self, "screenshot", "enabled", TRUE, NULL);
+ profiler = sysprof_local_profiler_new ();
+ sysprof_window_set_profiler (self, profiler);
break;
- case SP_WINDOW_STATE_0:
+ case SYSPROF_WINDOW_STATE_0:
default:
g_warning ("Unknown state: %0d", state);
break;
@@ -375,19 +375,19 @@ sp_window_set_state (SpWindow *self,
}
static void
-sp_window_enable_stats (SpWindow *self)
+sysprof_window_enable_stats (SysprofWindow *self)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
if (self->stats_handler == 0)
self->stats_handler =
- g_timeout_add_seconds (1, sp_window_update_stats, self);
+ g_timeout_add_seconds (1, sysprof_window_update_stats, self);
}
static void
-sp_window_disable_stats (SpWindow *self)
+sysprof_window_disable_stats (SysprofWindow *self)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
if (self->stats_handler != 0)
{
@@ -397,91 +397,91 @@ sp_window_disable_stats (SpWindow *self)
}
static void
-sp_window_add_sources (SpWindow *window,
- SpProfiler *profiler)
+sysprof_window_add_sources (SysprofWindow *window,
+ SysprofProfiler *profiler)
{
#ifdef __linux__
- g_autoptr(SpSource) host_source = NULL;
- g_autoptr(SpSource) proc_source = NULL;
- g_autoptr(SpSource) perf_source = NULL;
- g_autoptr(SpSource) memory_source = NULL;
+ g_autoptr(SysprofSource) host_source = NULL;
+ g_autoptr(SysprofSource) proc_source = NULL;
+ g_autoptr(SysprofSource) perf_source = NULL;
+ g_autoptr(SysprofSource) memory_source = NULL;
- g_assert (SP_IS_WINDOW (window));
- g_assert (SP_IS_PROFILER (profiler));
+ g_assert (SYSPROF_IS_WINDOW (window));
+ g_assert (SYSPROF_IS_PROFILER (profiler));
- proc_source = sp_proc_source_new ();
- sp_profiler_add_source (profiler, proc_source);
+ proc_source = sysprof_proc_source_new ();
+ sysprof_profiler_add_source (profiler, proc_source);
- perf_source = sp_perf_source_new ();
- sp_profiler_add_source (profiler, perf_source);
+ perf_source = sysprof_perf_source_new ();
+ sysprof_profiler_add_source (profiler, perf_source);
- host_source = sp_hostinfo_source_new ();
- sp_profiler_add_source (profiler, host_source);
+ host_source = sysprof_hostinfo_source_new ();
+ sysprof_profiler_add_source (profiler, host_source);
- memory_source = sp_memory_source_new ();
- sp_profiler_add_source (profiler, memory_source);
+ memory_source = sysprof_memory_source_new ();
+ sysprof_profiler_add_source (profiler, memory_source);
#endif
}
static void
-sp_window_start_recording (SpWindow *self)
+sysprof_window_start_recording (SysprofWindow *self)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
- if ((self->state == SP_WINDOW_STATE_EMPTY) ||
- (self->state == SP_WINDOW_STATE_FAILED) ||
- (self->state == SP_WINDOW_STATE_BROWSING))
+ if ((self->state == SYSPROF_WINDOW_STATE_EMPTY) ||
+ (self->state == SYSPROF_WINDOW_STATE_FAILED) ||
+ (self->state == SYSPROF_WINDOW_STATE_BROWSING))
{
gtk_revealer_set_reveal_child (self->info_bar_revealer, FALSE);
- sp_window_add_sources (self, self->profiler);
- sp_window_set_state (self, SP_WINDOW_STATE_RECORDING);
- sp_window_enable_stats (self);
- sp_profiler_start (self->profiler);
+ sysprof_window_add_sources (self, self->profiler);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_RECORDING);
+ sysprof_window_enable_stats (self);
+ sysprof_profiler_start (self->profiler);
return;
}
}
static void
-sp_window_stop_recording (SpWindow *self)
+sysprof_window_stop_recording (SysprofWindow *self)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
- if (self->state == SP_WINDOW_STATE_RECORDING)
+ if (self->state == SYSPROF_WINDOW_STATE_RECORDING)
{
if (self->profiler != NULL)
{
- /* SpProfiler::stopped will move us to generating */
+ /* SysprofProfiler::stopped will move us to generating */
gtk_label_set_label (self->subtitle, _("Stopping…"));
/*
* In case that ::stopped takes a while to execute,
* disable record button immediately.
*/
gtk_widget_set_sensitive (GTK_WIDGET (self->record_button), FALSE);
- sp_profiler_stop (self->profiler);
+ sysprof_profiler_stop (self->profiler);
}
}
}
static void
-sp_window_hide_info_bar_revealer (SpWindow *self)
+sysprof_window_hide_info_bar_revealer (SysprofWindow *self)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
gtk_revealer_set_reveal_child (self->info_bar_revealer, FALSE);
}
static void
-sp_window_profiler_stopped (SpWindow *self,
- SpProfiler *profiler)
+sysprof_window_profiler_stopped (SysprofWindow *self,
+ SysprofProfiler *profiler)
{
- g_autoptr(SpCaptureReader) reader = NULL;
+ g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
- SpCaptureWriter *writer;
+ SysprofCaptureWriter *writer;
- g_assert (SP_IS_WINDOW (self));
- g_assert (SP_IS_PROFILER (profiler));
+ g_assert (SYSPROF_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_PROFILER (profiler));
- sp_window_disable_stats (self);
+ sysprof_window_disable_stats (self);
if (self->closing)
{
@@ -489,59 +489,59 @@ sp_window_profiler_stopped (SpWindow *self,
return;
}
- if (self->state == SP_WINDOW_STATE_FAILED)
+ if (self->state == SYSPROF_WINDOW_STATE_FAILED)
return;
- writer = sp_profiler_get_writer (profiler);
- reader = sp_capture_writer_create_reader (writer, &error);
+ writer = sysprof_profiler_get_writer (profiler);
+ reader = sysprof_capture_writer_create_reader (writer, &error);
if (reader == NULL)
{
- sp_window_notify_user (self, GTK_MESSAGE_ERROR, "%s", error->message);
- sp_window_set_state (self, SP_WINDOW_STATE_EMPTY);
+ sysprof_window_notify_user (self, GTK_MESSAGE_ERROR, "%s", error->message);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_EMPTY);
return;
}
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
self->reader = g_steal_pointer (&reader);
- sp_window_build_profile (self);
+ sysprof_window_build_profile (self);
}
static void
-sp_window_profiler_failed (SpWindow *self,
+sysprof_window_profiler_failed (SysprofWindow *self,
const GError *reason,
- SpProfiler *profiler)
+ SysprofProfiler *profiler)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (reason != NULL);
- g_assert (SP_IS_PROFILER (profiler));
+ g_assert (SYSPROF_IS_PROFILER (profiler));
- sp_window_notify_user (self, GTK_MESSAGE_ERROR, "%s", reason->message);
- sp_window_set_state (self, SP_WINDOW_STATE_FAILED);
+ sysprof_window_notify_user (self, GTK_MESSAGE_ERROR, "%s", reason->message);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_FAILED);
}
static void
-sp_window_set_profiler (SpWindow *self,
- SpProfiler *profiler)
+sysprof_window_set_profiler (SysprofWindow *self,
+ SysprofProfiler *profiler)
{
- g_assert (SP_IS_WINDOW (self));
- g_assert (SP_IS_PROFILER (profiler));
+ g_assert (SYSPROF_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_PROFILER (profiler));
if (self->profiler != profiler)
{
if (self->profiler != NULL)
{
- if (sp_profiler_get_is_running (self->profiler))
- sp_profiler_stop (self->profiler);
- sp_profiler_menu_button_set_profiler (self->profiler_menu_button, NULL);
- sp_recording_state_view_set_profiler (self->recording_view, NULL);
+ if (sysprof_profiler_get_is_running (self->profiler))
+ sysprof_profiler_stop (self->profiler);
+ sysprof_profiler_menu_button_set_profiler (self->profiler_menu_button, NULL);
+ sysprof_recording_state_view_set_profiler (self->recording_view, NULL);
g_clear_object (&self->profiler);
}
if (profiler != NULL)
{
- if (!sp_profiler_get_is_mutable (profiler))
+ if (!sysprof_profiler_get_is_mutable (profiler))
{
g_warning ("Ignoring attempt to set profiler to an already running session!");
return;
@@ -551,49 +551,49 @@ sp_window_set_profiler (SpWindow *self,
g_signal_connect_object (profiler,
"stopped",
- G_CALLBACK (sp_window_profiler_stopped),
+ G_CALLBACK (sysprof_window_profiler_stopped),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (profiler,
"failed",
- G_CALLBACK (sp_window_profiler_failed),
+ G_CALLBACK (sysprof_window_profiler_failed),
self,
G_CONNECT_SWAPPED);
- sp_profiler_menu_button_set_profiler (self->profiler_menu_button, profiler);
- sp_recording_state_view_set_profiler (self->recording_view, profiler);
+ sysprof_profiler_menu_button_set_profiler (self->profiler_menu_button, profiler);
+ sysprof_recording_state_view_set_profiler (self->recording_view, profiler);
}
}
}
static void
-sp_window_open_capture (GSimpleAction *action,
+sysprof_window_open_capture (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- SpWindow *self = user_data;
+ SysprofWindow *self = user_data;
g_assert (G_IS_SIMPLE_ACTION (action));
g_assert (variant == NULL);
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
- sp_window_open_from_dialog (self);
+ sysprof_window_open_from_dialog (self);
}
static void
-sp_window_save_capture (GSimpleAction *action,
+sysprof_window_save_capture (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- g_autoptr(SpCaptureReader) reader = NULL;
- SpWindow *self = user_data;
+ g_autoptr(SysprofCaptureReader) reader = NULL;
+ SysprofWindow *self = user_data;
GtkFileChooserNative *dialog;
gint response;
g_assert (G_IS_SIMPLE_ACTION (action));
g_assert (variant == NULL);
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
if (self->reader == NULL)
{
@@ -601,7 +601,7 @@ sp_window_save_capture (GSimpleAction *action,
return;
}
- reader = sp_capture_reader_ref (self->reader);
+ reader = sysprof_capture_reader_ref (self->reader);
/* Translators: This is a window title. */
dialog = gtk_file_chooser_native_new (_("Save Capture As…"),
@@ -636,9 +636,9 @@ sp_window_save_capture (GSimpleAction *action,
}
/* this should really be done outside the main loop. */
- if (!sp_capture_reader_save_as (reader, filename, &error))
+ if (!sysprof_capture_reader_save_as (reader, filename, &error))
{
- sp_window_notify_user (self,
+ sysprof_window_notify_user (self,
GTK_MESSAGE_ERROR,
/* Translators: %s is the error message. */
_("An error occurred while attempting to save your capture: %s"),
@@ -652,47 +652,47 @@ failure:
}
static void
-sp_window_close_capture (GSimpleAction *action,
+sysprof_window_close_capture (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- SpWindow *self = user_data;
+ SysprofWindow *self = user_data;
g_assert (G_IS_SIMPLE_ACTION (action));
g_assert (variant == NULL);
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
- sp_window_set_state (self, SP_WINDOW_STATE_EMPTY);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_EMPTY);
}
static void
-sp_window_record_button_clicked (SpWindow *self,
+sysprof_window_record_button_clicked (SysprofWindow *self,
GtkButton *button)
{
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (GTK_IS_BUTTON (button));
- if (self->state == SP_WINDOW_STATE_RECORDING)
- sp_window_stop_recording (self);
+ if (self->state == SYSPROF_WINDOW_STATE_RECORDING)
+ sysprof_window_stop_recording (self);
else
- sp_window_start_recording (self);
+ sysprof_window_start_recording (self);
}
static void
-sp_window_screenshot (GSimpleAction *action,
+sysprof_window_screenshot (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- SpWindow *self = user_data;
+ SysprofWindow *self = user_data;
g_autofree gchar *str = NULL;
GtkWindow *window;
GtkScrolledWindow *scroller;
GtkTextView *text_view;
g_assert (G_IS_SIMPLE_ACTION (action));
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
- if (NULL == (str = sp_callgraph_view_screenshot (self->callgraph_view)))
+ if (NULL == (str = sysprof_callgraph_view_screenshot (self->callgraph_view)))
return;
window = g_object_new (GTK_TYPE_WINDOW,
@@ -720,22 +720,22 @@ sp_window_screenshot (GSimpleAction *action,
}
static gboolean
-sp_window_delete_event (GtkWidget *widget,
+sysprof_window_delete_event (GtkWidget *widget,
GdkEventAny *event)
{
- SpWindow *self = (SpWindow *)widget;
+ SysprofWindow *self = (SysprofWindow *)widget;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (event != NULL);
- if (self->state == SP_WINDOW_STATE_RECORDING)
+ if (self->state == SYSPROF_WINDOW_STATE_RECORDING)
{
if (self->profiler != NULL)
{
if (self->closing == FALSE)
{
self->closing = TRUE;
- sp_profiler_stop (self->profiler);
+ sysprof_profiler_stop (self->profiler);
return GDK_EVENT_STOP;
}
}
@@ -756,19 +756,19 @@ zoom_level_to_string (GBinding *binding,
}
static void
-sp_window_visualizers_selection_changed (SpWindow *self,
- SpSelection *selection)
+sysprof_window_visualizers_selection_changed (SysprofWindow *self,
+ SysprofSelection *selection)
{
- g_assert (SP_IS_WINDOW (self));
- g_assert (SP_IS_SELECTION (selection));
+ g_assert (SYSPROF_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_SELECTION (selection));
- sp_window_build_profile (self);
+ sysprof_window_build_profile (self);
}
static void
-sp_window_destroy (GtkWidget *widget)
+sysprof_window_destroy (GtkWidget *widget)
{
- SpWindow *self = (SpWindow *)widget;
+ SysprofWindow *self = (SysprofWindow *)widget;
if (self->refilter_cancellable != NULL)
{
@@ -778,85 +778,85 @@ sp_window_destroy (GtkWidget *widget)
}
g_clear_object (&self->profiler);
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
- sp_window_disable_stats (self);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
+ sysprof_window_disable_stats (self);
- GTK_WIDGET_CLASS (sp_window_parent_class)->destroy (widget);
+ GTK_WIDGET_CLASS (sysprof_window_parent_class)->destroy (widget);
}
static void
-sp_window_constructed (GObject *object)
+sysprof_window_constructed (GObject *object)
{
- SpWindow *self = (SpWindow *)object;
- g_autoptr(SpProfiler) profiler = NULL;
+ SysprofWindow *self = (SysprofWindow *)object;
+ g_autoptr(SysprofProfiler) profiler = NULL;
- G_OBJECT_CLASS (sp_window_parent_class)->constructed (object);
+ G_OBJECT_CLASS (sysprof_window_parent_class)->constructed (object);
- profiler = sp_local_profiler_new ();
- sp_window_set_profiler (self, profiler);
+ profiler = sysprof_local_profiler_new ();
+ sysprof_window_set_profiler (self, profiler);
- sp_window_set_state (self, SP_WINDOW_STATE_EMPTY);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_EMPTY);
}
static void
-sp_window_class_init (SpWindowClass *klass)
+sysprof_window_class_init (SysprofWindowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkBindingSet *binding_set;
- object_class->constructed = sp_window_constructed;
+ object_class->constructed = sysprof_window_constructed;
- widget_class->delete_event = sp_window_delete_event;
- widget_class->destroy = sp_window_destroy;
+ widget_class->delete_event = sysprof_window_delete_event;
+ widget_class->destroy = sysprof_window_destroy;
signals [START_RECORDING] =
g_signal_new_class_handler ("start-recording",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_CALLBACK (sp_window_start_recording),
+ G_CALLBACK (sysprof_window_start_recording),
NULL, NULL, NULL, G_TYPE_NONE, 0);
signals [STOP_RECORDING] =
g_signal_new_class_handler ("stop-recording",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_CALLBACK (sp_window_stop_recording),
+ G_CALLBACK (sysprof_window_stop_recording),
NULL, NULL, NULL, G_TYPE_NONE, 0);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "stop-recording", 0);
- gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sp-window.ui");
- gtk_widget_class_bind_template_child (widget_class, SpWindow, callgraph_view);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, empty_view);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, gear_menu_button);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar_label);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar_revealer);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, paned);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, profiler_menu_button);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, record_button);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, recording_view);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, stat_label);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, subtitle);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, title);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, view_stack);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, visualizers);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, zoom_manager);
- gtk_widget_class_bind_template_child (widget_class, SpWindow, zoom_one_label);
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-window.ui");
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, callgraph_view);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, empty_view);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, gear_menu_button);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, info_bar);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, info_bar_label);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, info_bar_revealer);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, paned);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, profiler_menu_button);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, record_button);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, recording_view);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, stat_label);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, subtitle);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, title);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, view_stack);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, visualizers);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, zoom_manager);
+ gtk_widget_class_bind_template_child (widget_class, SysprofWindow, zoom_one_label);
}
static void
-sp_window_init (SpWindow *self)
+sysprof_window_init (SysprofWindow *self)
{
static GActionEntry action_entries[] = {
- { "close-capture", sp_window_close_capture },
- { "open-capture", sp_window_open_capture },
- { "save-capture", sp_window_save_capture },
- { "screenshot", sp_window_screenshot },
+ { "close-capture", sysprof_window_close_capture },
+ { "open-capture", sysprof_window_open_capture },
+ { "save-capture", sysprof_window_save_capture },
+ { "screenshot", sysprof_window_screenshot },
};
- SpSelection *selection;
+ SysprofSelection *selection;
g_autoptr(GtkWindowGroup) window_group = NULL;
gtk_widget_init_template (GTK_WIDGET (self));
@@ -871,19 +871,19 @@ sp_window_init (SpWindow *self)
g_signal_connect_object (self->info_bar,
"response",
- G_CALLBACK (sp_window_hide_info_bar_revealer),
+ G_CALLBACK (sysprof_window_hide_info_bar_revealer),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->info_bar,
"close",
- G_CALLBACK (sp_window_hide_info_bar_revealer),
+ G_CALLBACK (sysprof_window_hide_info_bar_revealer),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->record_button,
"clicked",
- G_CALLBACK (sp_window_record_button_clicked),
+ G_CALLBACK (sysprof_window_record_button_clicked),
self,
G_CONNECT_SWAPPED);
@@ -895,11 +895,11 @@ sp_window_init (SpWindow *self)
* Wire up selections for visualizers to update callgraph.
*/
- selection = sp_visualizer_view_get_selection (self->visualizers);
+ selection = sysprof_visualizer_view_get_selection (self->visualizers);
g_signal_connect_object (selection,
"changed",
- G_CALLBACK (sp_window_visualizers_selection_changed),
+ G_CALLBACK (sysprof_window_visualizers_selection_changed),
self,
G_CONNECT_SWAPPED);
@@ -915,7 +915,7 @@ sp_window_init (SpWindow *self)
/*
* Restore previous window settings.
*/
- sp_window_settings_register (GTK_WINDOW (self));
+ sysprof_window_settings_register (GTK_WINDOW (self));
/*
* Set default focus to the record button for quick workflow of
@@ -931,98 +931,98 @@ sp_window_init (SpWindow *self)
}
static void
-sp_window_open_cb (GObject *object,
+sysprof_window_open_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- SpWindow *self = (SpWindow *)object;
- g_autoptr(SpCaptureReader) reader = NULL;
+ SysprofWindow *self = (SysprofWindow *)object;
+ g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
g_assert (G_IS_TASK (result));
reader = g_task_propagate_pointer (G_TASK (result), &error);
if (reader == NULL)
{
- sp_window_notify_user (self,
+ sysprof_window_notify_user (self,
GTK_MESSAGE_ERROR,
"%s", error->message);
return;
}
- g_clear_pointer (&self->reader, sp_capture_reader_unref);
+ g_clear_pointer (&self->reader, sysprof_capture_reader_unref);
self->reader = g_steal_pointer (&reader);
- sp_window_set_state (self, SP_WINDOW_STATE_PROCESSING);
+ sysprof_window_set_state (self, SYSPROF_WINDOW_STATE_PROCESSING);
}
static void
-sp_window_open_worker (GTask *task,
+sysprof_window_open_worker (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
g_autofree gchar *path = NULL;
- SpCaptureReader *reader;
+ SysprofCaptureReader *reader;
GFile *file = task_data;
GError *error = NULL;
g_assert (G_IS_TASK (task));
- g_assert (SP_IS_WINDOW (source_object));
+ g_assert (SYSPROF_IS_WINDOW (source_object));
g_assert (G_IS_FILE (file));
path = g_file_get_path (file);
- if (NULL == (reader = sp_capture_reader_new (path, &error)))
+ if (NULL == (reader = sysprof_capture_reader_new (path, &error)))
{
g_task_return_error (task, error);
return;
}
- g_task_return_pointer (task, reader, (GDestroyNotify)sp_capture_reader_unref);
+ g_task_return_pointer (task, reader, (GDestroyNotify)sysprof_capture_reader_unref);
}
void
-sp_window_open (SpWindow *self,
+sysprof_window_open (SysprofWindow *self,
GFile *file)
{
g_autoptr(GTask) task = NULL;
- g_return_if_fail (SP_IS_WINDOW (self));
+ g_return_if_fail (SYSPROF_IS_WINDOW (self));
g_return_if_fail (G_IS_FILE (file));
if (!g_file_is_native (file))
{
- sp_window_notify_user (self,
+ sysprof_window_notify_user (self,
GTK_MESSAGE_ERROR,
_("The file “%s” could not be opened. Only local files are supported."),
g_file_get_uri (file));
return;
}
- task = g_task_new (self, NULL, sp_window_open_cb, NULL);
+ task = g_task_new (self, NULL, sysprof_window_open_cb, NULL);
g_task_set_task_data (task, g_object_ref (file), g_object_unref);
- g_task_run_in_thread (task, sp_window_open_worker);
+ g_task_run_in_thread (task, sysprof_window_open_worker);
}
-SpWindowState
-sp_window_get_state (SpWindow *self)
+SysprofWindowState
+sysprof_window_get_state (SysprofWindow *self)
{
- g_return_val_if_fail (SP_IS_WINDOW (self), SP_WINDOW_STATE_0);
+ g_return_val_if_fail (SYSPROF_IS_WINDOW (self), SYSPROF_WINDOW_STATE_0);
return self->state;
}
void
-sp_window_open_from_dialog (SpWindow *self)
+sysprof_window_open_from_dialog (SysprofWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileFilter *filter;
gint response;
- g_assert (SP_IS_WINDOW (self));
+ g_assert (SYSPROF_IS_WINDOW (self));
/* Translators: This is a window title. */
dialog = gtk_file_chooser_native_new (_("Open Capture…"),
@@ -1050,7 +1050,7 @@ sp_window_open_from_dialog (SpWindow *self)
g_autoptr(GFile) file = NULL;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
- sp_window_open (self, file);
+ sysprof_window_open (self, file);
}
gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (dialog));
diff --git a/src/sysprof/sp-window.h b/src/sysprof/sysprof-window.h
similarity index 50%
rename from src/sysprof/sp-window.h
rename to src/sysprof/sysprof-window.h
index 689b610..ca0ceb9 100644
--- a/src/sysprof/sp-window.h
+++ b/src/sysprof/sysprof-window.h
@@ -1,4 +1,4 @@
-/* sp-window.h
+/* sysprof-window.h
*
* Copyright 2016 Christian Hergert <chergert redhat com>
*
@@ -16,37 +16,37 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SP_WINDOW_H
-#define SP_WINDOW_H
+#ifndef SYSPROF_WINDOW_H
+#define SYSPROF_WINDOW_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
-#define SP_TYPE_WINDOW (sp_window_get_type())
+#define SYSPROF_TYPE_WINDOW (sysprof_window_get_type())
-G_DECLARE_FINAL_TYPE (SpWindow, sp_window, SP, WINDOW, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (SysprofWindow, sysprof_window, SYSPROF, WINDOW, GtkApplicationWindow)
typedef enum
{
- SP_WINDOW_STATE_0,
- SP_WINDOW_STATE_EMPTY,
- SP_WINDOW_STATE_FAILED,
- SP_WINDOW_STATE_RECORDING,
- SP_WINDOW_STATE_PROCESSING,
- SP_WINDOW_STATE_BROWSING,
-} SpWindowState;
-
-SpWindowState sp_window_get_state (SpWindow *self);
-gboolean sp_window_get_recording (SpWindow *self);
-GFile *sp_window_get_capture_file (SpWindow *self);
-void sp_window_set_capture_file (SpWindow *self,
+ SYSPROF_WINDOW_STATE_0,
+ SYSPROF_WINDOW_STATE_EMPTY,
+ SYSPROF_WINDOW_STATE_FAILED,
+ SYSPROF_WINDOW_STATE_RECORDING,
+ SYSPROF_WINDOW_STATE_PROCESSING,
+ SYSPROF_WINDOW_STATE_BROWSING,
+} SysprofWindowState;
+
+SysprofWindowState sysprof_window_get_state (SysprofWindow *self);
+gboolean sysprof_window_get_recording (SysprofWindow *self);
+GFile *sysprof_window_get_capture_file (SysprofWindow *self);
+void sysprof_window_set_capture_file (SysprofWindow *self,
GFile *capture_file);
-void sp_window_open (SpWindow *self,
+void sysprof_window_open (SysprofWindow *self,
GFile *file);
-void sp_window_open_from_dialog (SpWindow *self);
+void sysprof_window_open_from_dialog (SysprofWindow *self);
G_END_DECLS
-#endif /* SP_WINDOW_H */
+#endif /* SYSPROF_WINDOW_H */
diff --git a/src/sysprof/sysprof.c b/src/sysprof/sysprof.c
index 9517807..63b76e7 100644
--- a/src/sysprof/sysprof.c
+++ b/src/sysprof/sysprof.c
@@ -20,18 +20,18 @@
#include <gtk/gtk.h>
#include <sysprof.h>
-#include "sp-application.h"
+#include "sysprof-application.h"
gint
main (gint argc,
gchar *argv[])
{
- g_autoptr(SpApplication) app = NULL;
+ g_autoptr(SysprofApplication) app = NULL;
gint ret;
- sp_clock_init ();
+ sysprof_clock_init ();
- app = sp_application_new ();
+ app = sysprof_application_new ();
ret = g_application_run (G_APPLICATION (app), argc, argv);
return ret;
diff --git a/src/sysprofd/meson.build b/src/sysprofd/meson.build
index 097c2d6..9fb793e 100644
--- a/src/sysprofd/meson.build
+++ b/src/sysprofd/meson.build
@@ -4,7 +4,7 @@ sysprofd_sources = [
'sysprofd.c',
'sd-bus-helper.c',
'sd-bus-helper.h',
- '../libsysprof/sp-kallsyms.c',
+ '../libsysprof/sysprof-kallsyms.c',
]
pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
@@ -19,7 +19,9 @@ sysprofd = executable('sysprofd', sysprofd_sources,
install: true,
install_dir: pkglibexecdir,
pie: true,
- include_directories: [include_directories('.'), '../libsysprof'],
+ include_directories: [include_directories('.'),
+ '../libsysprof',
+ libsysprof_capture_include_dirs],
)
sysprofdconf = configuration_data()
diff --git a/src/sysprofd/sysprofd.c b/src/sysprofd/sysprofd.c
index 0354983..d876fea 100644
--- a/src/sysprofd/sysprofd.c
+++ b/src/sysprofd/sysprofd.c
@@ -30,7 +30,8 @@
#include <unistd.h>
#include "sd-bus-helper.h"
-#include "sp-kallsyms.h"
+
+#include "sysprof-kallsyms.h"
#define BUS_TIMEOUT_USEC (1000000L * 10L)
@@ -48,7 +49,7 @@ sysprofd_get_kernel_symbols (sd_bus_message *msg,
void *user_data,
sd_bus_error *error)
{
- g_autoptr(SpKallsyms) kallsyms = NULL;
+ g_autoptr(SysprofKallsyms) kallsyms = NULL;
sd_bus_message *reply = NULL;
const gchar *name;
guint64 addr;
@@ -76,7 +77,7 @@ sysprofd_get_kernel_symbols (sd_bus_message *msg,
else if (r == 0)
return -EACCES;
- if (!(kallsyms = sp_kallsyms_new (NULL)))
+ if (!(kallsyms = sysprof_kallsyms_new (NULL)))
{
sd_bus_error_set (error,
SD_BUS_ERROR_FILE_NOT_FOUND,
@@ -92,7 +93,7 @@ sysprofd_get_kernel_symbols (sd_bus_message *msg,
if (r < 0)
return r;
- while (sp_kallsyms_next (kallsyms, &name, &addr, &type))
+ while (sysprof_kallsyms_next (kallsyms, &name, &addr, &type))
sd_bus_message_append (reply, "(tys)", addr, type, name);
r = sd_bus_message_close_container (reply);
diff --git a/src/tests/test-capture-cursor.c b/src/tests/test-capture-cursor.c
index c3248a4..0781fc0 100644
--- a/src/tests/test-capture-cursor.c
+++ b/src/tests/test-capture-cursor.c
@@ -22,7 +22,7 @@
#include <sysprof-capture.h>
static gboolean
-increment (const SpCaptureFrame *frame,
+increment (const SysprofCaptureFrame *frame,
gpointer user_data)
{
gint *count= user_data;
@@ -33,39 +33,39 @@ increment (const SpCaptureFrame *frame,
static void
test_cursor_basic (void)
{
- SpCaptureReader *reader;
- SpCaptureWriter *writer;
- SpCaptureCursor *cursor;
+ SysprofCaptureReader *reader;
+ SysprofCaptureWriter *writer;
+ SysprofCaptureCursor *cursor;
GError *error = NULL;
- gint64 t = SP_CAPTURE_CURRENT_TIME;
+ gint64 t = SYSPROF_CAPTURE_CURRENT_TIME;
guint i;
gint r;
gint count = 0;
- writer = sp_capture_writer_new ("capture-cursor-file", 0);
+ writer = sysprof_capture_writer_new ("capture-cursor-file", 0);
g_assert (writer != NULL);
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
- reader = sp_capture_reader_new ("capture-cursor-file", &error);
+ reader = sysprof_capture_reader_new ("capture-cursor-file", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
for (i = 0; i < 100; i++)
{
- r = sp_capture_writer_add_timestamp (writer, t, i, -1);
+ r = sysprof_capture_writer_add_timestamp (writer, t, i, -1);
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
- cursor = sp_capture_cursor_new (reader);
- sp_capture_cursor_foreach (cursor, increment, &count);
+ cursor = sysprof_capture_cursor_new (reader);
+ sysprof_capture_cursor_foreach (cursor, increment, &count);
g_assert_cmpint (count, ==, 100);
- g_clear_pointer (&cursor, sp_capture_cursor_unref);
+ g_clear_pointer (&cursor, sysprof_capture_cursor_unref);
- sp_capture_reader_unref (reader);
- sp_capture_writer_unref (writer);
+ sysprof_capture_reader_unref (reader);
+ sysprof_capture_writer_unref (writer);
g_unlink ("capture-cursor-file");
}
@@ -74,8 +74,8 @@ int
main (int argc,
char *argv[])
{
- sp_clock_init ();
+ sysprof_clock_init ();
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/SpCaptureCursor/basic", test_cursor_basic);
+ g_test_add_func ("/SysprofCaptureCursor/basic", test_cursor_basic);
return g_test_run ();
}
diff --git a/src/tests/test-capture.c b/src/tests/test-capture.c
index 543ef5a..00f468e 100644
--- a/src/tests/test-capture.c
+++ b/src/tests/test-capture.c
@@ -26,19 +26,19 @@
static void
test_reader_basic (void)
{
- SpCaptureReader *reader;
- SpCaptureWriter *writer;
+ SysprofCaptureReader *reader;
+ SysprofCaptureWriter *writer;
GError *error = NULL;
- gint64 t = SP_CAPTURE_CURRENT_TIME;
+ gint64 t = SYSPROF_CAPTURE_CURRENT_TIME;
guint i;
gint r;
- writer = sp_capture_writer_new ("capture-file", 0);
+ writer = sysprof_capture_writer_new ("capture-file", 0);
g_assert (writer != NULL);
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
- reader = sp_capture_reader_new ("capture-file", &error);
+ reader = sysprof_capture_reader_new ("capture-file", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
@@ -48,26 +48,26 @@ test_reader_basic (void)
g_snprintf (str, sizeof str, "%d", i);
- r = sp_capture_writer_add_map (writer, t, -1, -1, i, i + 1, i + 2, i + 3, str);
+ r = sysprof_capture_writer_add_map (writer, t, -1, -1, i, i + 1, i + 2, i + 3, str);
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 0; i < 100; i++)
{
- SpCaptureFrameType type = -1;
- const SpCaptureMap *map;
+ SysprofCaptureFrameType type = -1;
+ const SysprofCaptureMap *map;
gchar str[16];
g_snprintf (str, sizeof str, "%d", i);
- if (!sp_capture_reader_peek_type (reader, &type))
+ if (!sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_MAP);
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_MAP);
- map = sp_capture_reader_read_map (reader);
+ map = sysprof_capture_reader_read_map (reader);
g_assert (map != NULL);
g_assert_cmpint (map->frame.pid, ==, -1);
@@ -82,27 +82,27 @@ test_reader_basic (void)
/* Now that we have read a frame, we should start having updated
* end times with each incoming frame.
*/
- g_assert_cmpint (0, !=, sp_capture_reader_get_end_time (reader));
+ g_assert_cmpint (0, !=, sysprof_capture_reader_get_end_time (reader));
for (i = 0; i < 100; i++)
{
- r = sp_capture_writer_add_timestamp (writer, t, i, -1);
+ r = sysprof_capture_writer_add_timestamp (writer, t, i, -1);
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 0; i < 100; i++)
{
- SpCaptureFrameType type = -1;
- const SpCaptureTimestamp *ts;
+ SysprofCaptureFrameType type = -1;
+ const SysprofCaptureTimestamp *ts;
- if (!sp_capture_reader_peek_type (reader, &type))
+ if (!sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_TIMESTAMP);
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_TIMESTAMP);
- ts = sp_capture_reader_read_timestamp (reader);
+ ts = sysprof_capture_reader_read_timestamp (reader);
g_assert (ts != NULL);
g_assert_cmpint (ts->frame.cpu, ==, i);
@@ -111,23 +111,23 @@ test_reader_basic (void)
for (i = 0; i < 100; i++)
{
- r = sp_capture_writer_add_exit (writer, t, i, -1);
+ r = sysprof_capture_writer_add_exit (writer, t, i, -1);
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 0; i < 100; i++)
{
- SpCaptureFrameType type = -1;
- const SpCaptureExit *ex;
+ SysprofCaptureFrameType type = -1;
+ const SysprofCaptureExit *ex;
- if (!sp_capture_reader_peek_type (reader, &type))
+ if (!sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_EXIT);
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_EXIT);
- ex = sp_capture_reader_read_exit (reader);
+ ex = sysprof_capture_reader_read_exit (reader);
g_assert (ex != NULL);
g_assert_cmpint (ex->frame.cpu, ==, i);
@@ -139,26 +139,26 @@ test_reader_basic (void)
char cmdline[32];
g_snprintf (cmdline, sizeof cmdline, "program-%d", i);
- r = sp_capture_writer_add_process (writer, t, -1, i, cmdline);
+ r = sysprof_capture_writer_add_process (writer, t, -1, i, cmdline);
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 0; i < 100; i++)
{
- SpCaptureFrameType type = -1;
- const SpCaptureProcess *pr;
+ SysprofCaptureFrameType type = -1;
+ const SysprofCaptureProcess *pr;
char str[32];
g_snprintf (str, sizeof str, "program-%d", i);
- if (!sp_capture_reader_peek_type (reader, &type))
+ if (!sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_PROCESS);
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_PROCESS);
- pr = sp_capture_reader_read_process (reader);
+ pr = sysprof_capture_reader_read_process (reader);
g_assert (pr != NULL);
g_assert_cmpint (pr->frame.cpu, ==, -1);
@@ -168,23 +168,23 @@ test_reader_basic (void)
for (i = 0; i < 100; i++)
{
- r = sp_capture_writer_add_fork (writer, t, i, -1, i);
+ r = sysprof_capture_writer_add_fork (writer, t, i, -1, i);
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 0; i < 100; i++)
{
- SpCaptureFrameType type = -1;
- const SpCaptureFork *ex;
+ SysprofCaptureFrameType type = -1;
+ const SysprofCaptureFork *ex;
- if (!sp_capture_reader_peek_type (reader, &type))
+ if (!sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_FORK);
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_FORK);
- ex = sp_capture_reader_read_fork (reader);
+ ex = sysprof_capture_reader_read_fork (reader);
g_assert (ex != NULL);
g_assert_cmpint (ex->frame.cpu, ==, i);
@@ -193,10 +193,10 @@ test_reader_basic (void)
}
{
- SpCaptureCounter counters[10];
- guint base = sp_capture_writer_request_counter (writer, G_N_ELEMENTS (counters));
+ SysprofCaptureCounter counters[10];
+ guint base = sysprof_capture_writer_request_counter (writer, G_N_ELEMENTS (counters));
- t = SP_CAPTURE_CURRENT_TIME;
+ t = SYSPROF_CAPTURE_CURRENT_TIME;
for (i = 0; i < G_N_ELEMENTS (counters); i++)
{
@@ -208,16 +208,16 @@ test_reader_basic (void)
counters[i].value.v64 = i * G_GINT64_CONSTANT (100000000000);
}
- r = sp_capture_writer_define_counters (writer, t, -1, -1, counters, G_N_ELEMENTS (counters));
+ r = sysprof_capture_writer_define_counters (writer, t, -1, -1, counters, G_N_ELEMENTS (counters));
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
{
- const SpCaptureFrameCounterDefine *def;
+ const SysprofCaptureFrameCounterDefine *def;
- def = sp_capture_reader_read_counter_define (reader);
+ def = sysprof_capture_reader_read_counter_define (reader);
g_assert (def != NULL);
g_assert_cmpint (def->n_counters, ==, 10);
@@ -236,19 +236,19 @@ test_reader_basic (void)
for (i = 0; i < 1000; i++)
{
guint ids[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- SpCaptureCounterValue values[10] = { {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10} };
+ SysprofCaptureCounterValue values[10] = { {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10} };
- r = sp_capture_writer_set_counters (writer, t, -1, -1, ids, values, G_N_ELEMENTS (values));
+ r = sysprof_capture_writer_set_counters (writer, t, -1, -1, ids, values, G_N_ELEMENTS (values));
g_assert_cmpint (r, ==, TRUE);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 0; i < 1000; i++)
{
- const SpCaptureFrameCounterSet *set;
+ const SysprofCaptureFrameCounterSet *set;
- set = sp_capture_reader_read_counter_set (reader);
+ set = sysprof_capture_reader_read_counter_set (reader);
g_assert (set != NULL);
/* 8 per chunk */
@@ -278,30 +278,30 @@ test_reader_basic (void)
for (i = 0; i < 1000; i++)
{
- SpCaptureAddress addr;
+ SysprofCaptureAddress addr;
gchar str[32];
g_snprintf (str, sizeof str, "jitstring-%d", i);
- addr = sp_capture_writer_add_jitmap (writer, str);
- g_assert_cmpint (addr, ==, (i + 1) | SP_CAPTURE_JITMAP_MARK);
+ addr = sysprof_capture_writer_add_jitmap (writer, str);
+ g_assert_cmpint (addr, ==, (i + 1) | SYSPROF_CAPTURE_JITMAP_MARK);
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
i = 0;
for (;;)
{
- SpCaptureFrameType type = -1;
+ SysprofCaptureFrameType type = -1;
g_autoptr(GHashTable) ret = NULL;
- if (sp_capture_reader_peek_type (reader, &type))
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_JITMAP);
+ if (sysprof_capture_reader_peek_type (reader, &type))
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_JITMAP);
else
break;
- ret = sp_capture_reader_read_jitmap (reader);
+ ret = sysprof_capture_reader_read_jitmap (reader);
g_assert (ret != NULL);
i += g_hash_table_size (ret);
@@ -310,15 +310,15 @@ test_reader_basic (void)
g_assert_cmpint (1000, ==, i);
{
- SpCaptureFrameType type = -1;
+ SysprofCaptureFrameType type = -1;
- if (sp_capture_reader_peek_type (reader, &type))
+ if (sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
}
for (i = 1; i <= 1000; i++)
{
- SpCaptureAddress *addrs;
+ SysprofCaptureAddress *addrs;
guint j;
addrs = alloca (i * sizeof *addrs);
@@ -326,24 +326,24 @@ test_reader_basic (void)
for (j = 0; j < i; j++)
addrs[j] = i;
- if (!sp_capture_writer_add_sample (writer, t, -1, -1, -2, addrs, i))
+ if (!sysprof_capture_writer_add_sample (writer, t, -1, -1, -2, addrs, i))
g_assert_not_reached ();
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
for (i = 1; i <= 1000; i++)
{
- SpCaptureFrameType type = -1;
- const SpCaptureSample *sample;
+ SysprofCaptureFrameType type = -1;
+ const SysprofCaptureSample *sample;
guint j;
- if (!sp_capture_reader_peek_type (reader, &type))
+ if (!sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
- g_assert_cmpint (type, ==, SP_CAPTURE_FRAME_SAMPLE);
+ g_assert_cmpint (type, ==, SYSPROF_CAPTURE_FRAME_SAMPLE);
- sample = sp_capture_reader_read_sample (reader);
+ sample = sysprof_capture_reader_read_sample (reader);
g_assert (sample != NULL);
g_assert_cmpint (sample->frame.time, ==, t);
@@ -357,13 +357,13 @@ test_reader_basic (void)
}
{
- SpCaptureFrameType type = -1;
+ SysprofCaptureFrameType type = -1;
- if (sp_capture_reader_peek_type (reader, &type))
+ if (sysprof_capture_reader_peek_type (reader, &type))
g_assert_not_reached ();
}
- r = sp_capture_writer_save_as (writer, "capture-file.bak", &error);
+ r = sysprof_capture_writer_save_as (writer, "capture-file.bak", &error);
g_assert_no_error (error);
g_assert (r);
g_assert (g_file_test ("capture-file.bak", G_FILE_TEST_IS_REGULAR));
@@ -390,31 +390,31 @@ test_reader_basic (void)
g_assert_true (0 == memcmp (buf1, buf2, buf1len));
}
- g_clear_pointer (&writer, sp_capture_writer_unref);
- g_clear_pointer (&reader, sp_capture_reader_unref);
+ g_clear_pointer (&writer, sysprof_capture_writer_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
- reader = sp_capture_reader_new ("capture-file.bak", &error);
+ reader = sysprof_capture_reader_new ("capture-file.bak", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
for (i = 0; i < 2; i++)
{
- SpCaptureFrameType type = -1;
+ SysprofCaptureFrameType type = -1;
guint count = 0;
- while (sp_capture_reader_peek_type (reader, &type))
+ while (sysprof_capture_reader_peek_type (reader, &type))
{
count++;
- if (!sp_capture_reader_skip (reader))
+ if (!sysprof_capture_reader_skip (reader))
g_assert_not_reached ();
}
g_assert_cmpint (count, >, 1500);
- sp_capture_reader_reset (reader);
+ sysprof_capture_reader_reset (reader);
}
- sp_capture_reader_unref (reader);
+ sysprof_capture_reader_unref (reader);
g_unlink ("capture-file");
g_unlink ("capture-file.bak");
@@ -423,34 +423,34 @@ test_reader_basic (void)
static void
test_writer_splice (void)
{
- SpCaptureWriter *writer1;
- SpCaptureWriter *writer2;
- SpCaptureReader *reader;
- SpCaptureFrameType type;
+ SysprofCaptureWriter *writer1;
+ SysprofCaptureWriter *writer2;
+ SysprofCaptureReader *reader;
+ SysprofCaptureFrameType type;
GError *error = NULL;
guint i;
gint r;
- writer1 = sp_capture_writer_new ("writer1.syscap", 0);
- writer2 = sp_capture_writer_new ("writer2.syscap", 0);
+ writer1 = sysprof_capture_writer_new ("writer1.syscap", 0);
+ writer2 = sysprof_capture_writer_new ("writer2.syscap", 0);
for (i = 0; i < 1000; i++)
- sp_capture_writer_add_timestamp (writer1, SP_CAPTURE_CURRENT_TIME, -1, -1);
+ sysprof_capture_writer_add_timestamp (writer1, SYSPROF_CAPTURE_CURRENT_TIME, -1, -1);
- r = sp_capture_writer_splice (writer1, writer2, &error);
+ r = sysprof_capture_writer_splice (writer1, writer2, &error);
g_assert_no_error (error);
g_assert (r == TRUE);
- g_clear_pointer (&writer1, sp_capture_writer_unref);
- g_clear_pointer (&writer2, sp_capture_writer_unref);
+ g_clear_pointer (&writer1, sysprof_capture_writer_unref);
+ g_clear_pointer (&writer2, sysprof_capture_writer_unref);
- reader = sp_capture_reader_new ("writer2.syscap", &error);
+ reader = sysprof_capture_reader_new ("writer2.syscap", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
for (i = 0; i < 1000; i++)
{
- const SpCaptureTimestamp *ts = sp_capture_reader_read_timestamp (reader);
+ const SysprofCaptureTimestamp *ts = sysprof_capture_reader_read_timestamp (reader);
g_assert (ts != NULL);
g_assert_cmpint (ts->frame.cpu, ==, -1);
@@ -458,10 +458,10 @@ test_writer_splice (void)
g_assert_cmpint (ts->frame.time, >, 0);
}
- r = sp_capture_reader_peek_type (reader, &type);
+ r = sysprof_capture_reader_peek_type (reader, &type);
g_assert_cmpint (r, ==, FALSE);
- g_clear_pointer (&reader, sp_capture_reader_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
g_unlink ("writer1.syscap");
g_unlink ("writer2.syscap");
@@ -470,27 +470,27 @@ test_writer_splice (void)
static void
test_reader_splice (void)
{
- SpCaptureWriter *writer1;
- SpCaptureWriter *writer2;
- SpCaptureReader *reader;
- SpCaptureFrameType type;
+ SysprofCaptureWriter *writer1;
+ SysprofCaptureWriter *writer2;
+ SysprofCaptureReader *reader;
+ SysprofCaptureFrameType type;
GError *error = NULL;
guint i;
guint count;
gint r;
- writer1 = sp_capture_writer_new ("writer1.syscap", 0);
- writer2 = sp_capture_writer_new ("writer2.syscap", 0);
+ writer1 = sysprof_capture_writer_new ("writer1.syscap", 0);
+ writer2 = sysprof_capture_writer_new ("writer2.syscap", 0);
for (i = 0; i < 1000; i++)
- sp_capture_writer_add_timestamp (writer1, SP_CAPTURE_CURRENT_TIME, -1, -1);
+ sysprof_capture_writer_add_timestamp (writer1, SYSPROF_CAPTURE_CURRENT_TIME, -1, -1);
- r = sp_capture_writer_flush (writer1);
+ r = sysprof_capture_writer_flush (writer1);
g_assert_cmpint (r, ==, TRUE);
- g_clear_pointer (&writer1, sp_capture_writer_unref);
+ g_clear_pointer (&writer1, sysprof_capture_writer_unref);
- reader = sp_capture_reader_new ("writer1.syscap", &error);
+ reader = sysprof_capture_reader_new ("writer1.syscap", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
@@ -498,7 +498,7 @@ test_reader_splice (void)
for (i = 0; i < 1000; i++)
{
- const SpCaptureTimestamp *ts = sp_capture_reader_read_timestamp (reader);
+ const SysprofCaptureTimestamp *ts = sysprof_capture_reader_read_timestamp (reader);
g_assert (ts != NULL);
g_assert_cmpint (ts->frame.cpu, ==, -1);
@@ -506,21 +506,21 @@ test_reader_splice (void)
g_assert_cmpint (ts->frame.time, >, 0);
}
- r = sp_capture_reader_peek_type (reader, &type);
+ r = sysprof_capture_reader_peek_type (reader, &type);
g_assert_cmpint (r, ==, FALSE);
- r = sp_capture_reader_splice (reader, writer2, &error);
+ r = sysprof_capture_reader_splice (reader, writer2, &error);
g_assert_no_error (error);
g_assert_cmpint (r, ==, TRUE);
- g_clear_pointer (&reader, sp_capture_reader_unref);
- g_clear_pointer (&writer2, sp_capture_writer_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
+ g_clear_pointer (&writer2, sysprof_capture_writer_unref);
- reader = sp_capture_reader_new ("writer2.syscap", 0);
+ reader = sysprof_capture_reader_new ("writer2.syscap", 0);
for (i = 0; i < 1000; i++)
{
- const SpCaptureTimestamp *ts = sp_capture_reader_read_timestamp (reader);
+ const SysprofCaptureTimestamp *ts = sysprof_capture_reader_read_timestamp (reader);
g_assert (ts != NULL);
g_assert_cmpint (ts->frame.cpu, ==, -1);
@@ -528,31 +528,31 @@ test_reader_splice (void)
g_assert_cmpint (ts->frame.time, >, 0);
}
- r = sp_capture_reader_peek_type (reader, &type);
+ r = sysprof_capture_reader_peek_type (reader, &type);
g_assert_cmpint (r, ==, FALSE);
- g_clear_pointer (&reader, sp_capture_reader_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
- reader = sp_capture_reader_new ("writer2.syscap", &error);
+ reader = sysprof_capture_reader_new ("writer2.syscap", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
- r = sp_capture_reader_save_as (reader, "writer3.syscap", &error);
+ r = sysprof_capture_reader_save_as (reader, "writer3.syscap", &error);
g_assert_no_error (error);
g_assert_cmpint (r, ==, TRUE);
- g_clear_pointer (&reader, sp_capture_reader_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
- reader = sp_capture_reader_new ("writer3.syscap", &error);
+ reader = sysprof_capture_reader_new ("writer3.syscap", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
count = 0;
- while (sp_capture_reader_skip (reader))
+ while (sysprof_capture_reader_skip (reader))
count++;
g_assert_cmpint (count, ==, 1000);
- g_clear_pointer (&reader, sp_capture_reader_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
g_unlink ("writer1.syscap");
g_unlink ("writer2.syscap");
@@ -562,25 +562,25 @@ test_reader_splice (void)
static void
test_reader_writer_mark (void)
{
- SpCaptureWriter *writer;
- SpCaptureReader *reader;
- const SpCaptureMark *mark;
- SpCaptureFrameType type;
+ SysprofCaptureWriter *writer;
+ SysprofCaptureReader *reader;
+ const SysprofCaptureMark *mark;
+ SysprofCaptureFrameType type;
GError *error = NULL;
gint r;
- writer = sp_capture_writer_new ("mark1.syscap", 0);
+ writer = sysprof_capture_writer_new ("mark1.syscap", 0);
- sp_capture_writer_add_mark (writer, SP_CAPTURE_CURRENT_TIME, -1, -1, 125, "thread-0", "Draw", "hdmi-1");
- sp_capture_writer_add_mark (writer, SP_CAPTURE_CURRENT_TIME, -1, -1, 0, "thread-1", "Deadline", "hdmi-1");
+ sysprof_capture_writer_add_mark (writer, SYSPROF_CAPTURE_CURRENT_TIME, -1, -1, 125, "thread-0", "Draw",
"hdmi-1");
+ sysprof_capture_writer_add_mark (writer, SYSPROF_CAPTURE_CURRENT_TIME, -1, -1, 0, "thread-1", "Deadline",
"hdmi-1");
- g_clear_pointer (&writer, sp_capture_writer_unref);
+ g_clear_pointer (&writer, sysprof_capture_writer_unref);
- reader = sp_capture_reader_new ("mark1.syscap", &error);
+ reader = sysprof_capture_reader_new ("mark1.syscap", &error);
g_assert_no_error (error);
g_assert (reader != NULL);
- mark = sp_capture_reader_read_mark (reader);
+ mark = sysprof_capture_reader_read_mark (reader);
g_assert_nonnull (mark);
g_assert_cmpstr (mark->group, ==, "thread-0");
g_assert_cmpstr (mark->name, ==, "Draw");
@@ -589,7 +589,7 @@ test_reader_writer_mark (void)
g_assert_cmpint (mark->frame.time, >, 0);
g_assert_cmpint (mark->frame.cpu, ==, -1);
- mark = sp_capture_reader_read_mark (reader);
+ mark = sysprof_capture_reader_read_mark (reader);
g_assert_nonnull (mark);
g_assert_cmpstr (mark->group, ==, "thread-1");
g_assert_cmpstr (mark->name, ==, "Deadline");
@@ -598,10 +598,10 @@ test_reader_writer_mark (void)
g_assert_cmpint (mark->frame.time, >, 0);
g_assert_cmpint (mark->frame.cpu, ==, -1);
- r = sp_capture_reader_peek_type (reader, &type);
+ r = sysprof_capture_reader_peek_type (reader, &type);
g_assert_cmpint (r, ==, FALSE);
- g_clear_pointer (&reader, sp_capture_reader_unref);
+ g_clear_pointer (&reader, sysprof_capture_reader_unref);
g_unlink ("mark1.syscap");
}
@@ -610,11 +610,11 @@ int
main (int argc,
char *argv[])
{
- sp_clock_init ();
+ sysprof_clock_init ();
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/SpCapture/ReaderWriter", test_reader_basic);
- g_test_add_func ("/SpCapture/Writer/splice", test_writer_splice);
- g_test_add_func ("/SpCapture/Reader/splice", test_reader_splice);
- g_test_add_func ("/SpCapture/ReaderWriter/mark", test_reader_writer_mark);
+ g_test_add_func ("/SysprofCapture/ReaderWriter", test_reader_basic);
+ g_test_add_func ("/SysprofCapture/Writer/splice", test_writer_splice);
+ g_test_add_func ("/SysprofCapture/Reader/splice", test_reader_splice);
+ g_test_add_func ("/SysprofCapture/ReaderWriter/mark", test_reader_writer_mark);
return g_test_run ();
}
diff --git a/src/tests/test-kallsyms.c b/src/tests/test-kallsyms.c
index 417bf56..c7ef0bc 100644
--- a/src/tests/test-kallsyms.c
+++ b/src/tests/test-kallsyms.c
@@ -6,9 +6,9 @@ int
main (gint argc,
gchar *argv[])
{
- g_autoptr(SpKallsyms) kallsyms = NULL;
+ g_autoptr(SysprofKallsyms) kallsyms = NULL;
const gchar *name;
- SpAddress addr = 0;
+ SysprofAddress addr = 0;
guint8 type;
if (argc < 2)
@@ -17,9 +17,9 @@ main (gint argc,
return EXIT_FAILURE;
}
- kallsyms = sp_kallsyms_new (argv[1]);
+ kallsyms = sysprof_kallsyms_new (argv[1]);
- while (sp_kallsyms_next (kallsyms, &name, &addr, &type))
+ while (sysprof_kallsyms_next (kallsyms, &name, &addr, &type))
{
g_assert (name != NULL);
g_assert (addr != 0);
diff --git a/src/tests/test-model-filter.c b/src/tests/test-model-filter.c
index a1da344..4c2d0a5 100644
--- a/src/tests/test-model-filter.c
+++ b/src/tests/test-model-filter.c
@@ -51,14 +51,14 @@ static void
test_basic (void)
{
GListStore *model;
- SpModelFilter *filter;
+ SysprofModelFilter *filter;
TestItem *item;
guint i;
model = g_list_store_new (TEST_TYPE_ITEM);
g_assert (model);
- filter = sp_model_filter_new (G_LIST_MODEL (model));
+ filter = sysprof_model_filter_new (G_LIST_MODEL (model));
g_assert (filter);
for (i = 0; i < 1000; i++)
@@ -72,7 +72,7 @@ test_basic (void)
g_assert_cmpint (1000, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
g_assert_cmpint (1000, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
- sp_model_filter_set_filter_func (filter, filter_func1, NULL, NULL);
+ sysprof_model_filter_set_filter_func (filter, filter_func1, NULL, NULL);
g_assert_cmpint (500, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
for (i = 0; i < 500; i++)
@@ -89,10 +89,10 @@ test_basic (void)
g_assert_cmpint (500, ==, g_list_model_get_n_items (G_LIST_MODEL (model)));
g_assert_cmpint (0, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
- sp_model_filter_set_filter_func (filter, NULL, NULL, NULL);
+ sysprof_model_filter_set_filter_func (filter, NULL, NULL, NULL);
g_assert_cmpint (500, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
- sp_model_filter_set_filter_func (filter, filter_func2, NULL, NULL);
+ sysprof_model_filter_set_filter_func (filter, filter_func2, NULL, NULL);
g_assert_cmpint (500, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
{
@@ -106,7 +106,7 @@ test_basic (void)
g_assert_cmpint (1, ==, g_list_model_get_n_items (G_LIST_MODEL (model)));
g_assert_cmpint (1, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
- sp_model_filter_set_filter_func (filter, NULL, NULL, NULL);
+ sysprof_model_filter_set_filter_func (filter, NULL, NULL, NULL);
g_assert_cmpint (1, ==, g_list_model_get_n_items (G_LIST_MODEL (model)));
g_assert_cmpint (1, ==, g_list_model_get_n_items (G_LIST_MODEL (filter)));
@@ -124,8 +124,8 @@ static gboolean
filter_keyword_cb (GObject *object,
gpointer user_data)
{
- SpProcessModelItem *item = SP_PROCESS_MODEL_ITEM (object);
- const gchar *haystack = sp_process_model_item_get_command_line (item);
+ SysprofProcessModelItem *item = SYSPROF_PROCESS_MODEL_ITEM (object);
+ const gchar *haystack = sysprof_process_model_item_get_command_line (item);
const gchar *needle = user_data;
return strstr (haystack, needle) != NULL;
@@ -134,34 +134,34 @@ filter_keyword_cb (GObject *object,
static void
test_process (void)
{
- SpProcessModel *model = sp_process_model_new ();
- SpModelFilter *filter;
+ SysprofProcessModel *model = sysprof_process_model_new ();
+ SysprofModelFilter *filter;
static gchar *searches[] = {
"a", "b", "foo", "bar", "gnome", "gnome-test",
"libexec", "/", ":", "gsd-",
};
- filter = sp_model_filter_new (G_LIST_MODEL (model));
+ filter = sysprof_model_filter_new (G_LIST_MODEL (model));
- sp_process_model_reload (model);
+ sysprof_process_model_reload (model);
for (guint i = 0; i < G_N_ELEMENTS (searches); i++)
{
const gchar *needle = searches[i];
guint n_items;
- sp_model_filter_set_filter_func (filter, filter_keyword_cb, g_strdup (needle), g_free);
+ sysprof_model_filter_set_filter_func (filter, filter_keyword_cb, g_strdup (needle), g_free);
n_items = g_list_model_get_n_items (G_LIST_MODEL (filter));
for (guint j = 0; j < n_items; j++)
{
- g_autoptr(SpProcessModelItem) item = g_list_model_get_item (G_LIST_MODEL (filter), j);
+ g_autoptr(SysprofProcessModelItem) item = g_list_model_get_item (G_LIST_MODEL (filter), j);
- g_assert (SP_IS_PROCESS_MODEL_ITEM (item));
+ g_assert (SYSPROF_IS_PROCESS_MODEL_ITEM (item));
g_assert (filter_keyword_cb (G_OBJECT (item), (gchar *)needle));
- //g_print ("%s: %s\n", needle, sp_process_model_item_get_command_line (item));
+ //g_print ("%s: %s\n", needle, sysprof_process_model_item_get_command_line (item));
}
}
@@ -174,7 +174,7 @@ static guint last_n_removed = 0;
static guint last_changed_position = 0;
static void
-model_items_changed_cb (SpModelFilter *filter,
+model_items_changed_cb (SysprofModelFilter *filter,
guint position,
guint n_removed,
guint n_added,
@@ -187,7 +187,7 @@ model_items_changed_cb (SpModelFilter *filter,
static void
-filter_items_changed_cb (SpModelFilter *filter,
+filter_items_changed_cb (SysprofModelFilter *filter,
guint position,
guint n_removed,
guint n_added,
@@ -201,7 +201,7 @@ filter_items_changed_cb (SpModelFilter *filter,
static void
test_items_changed (void)
{
- SpModelFilter *filter;
+ SysprofModelFilter *filter;
GListStore *model;
guint i;
@@ -210,7 +210,7 @@ test_items_changed (void)
g_signal_connect (model, "items-changed", G_CALLBACK (model_items_changed_cb), NULL);
- filter = sp_model_filter_new (G_LIST_MODEL (model));
+ filter = sysprof_model_filter_new (G_LIST_MODEL (model));
g_assert (filter);
g_signal_connect_after (filter, "items-changed", G_CALLBACK (filter_items_changed_cb), model);
@@ -240,8 +240,8 @@ main (gint argc,
gchar *argv[])
{
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/SpModelFilter/basic", test_basic);
- g_test_add_func ("/SpModelFilter/process", test_process);
- g_test_add_func ("/SpModelFilter/items-changed", test_items_changed);
+ g_test_add_func ("/SysprofModelFilter/basic", test_basic);
+ g_test_add_func ("/SysprofModelFilter/process", test_process);
+ g_test_add_func ("/SysprofModelFilter/items-changed", test_items_changed);
return g_test_run ();
}
diff --git a/src/tests/test-process-model.c b/src/tests/test-process-model.c
index f18111f..ca42e56 100644
--- a/src/tests/test-process-model.c
+++ b/src/tests/test-process-model.c
@@ -8,7 +8,7 @@ static GtkWidget *
create_row (gpointer item,
gpointer user_data)
{
- return sp_process_model_row_new (item);
+ return sysprof_process_model_row_new (item);
}
static gboolean
@@ -16,22 +16,22 @@ filter_cb (GObject *object,
gpointer user_data)
{
const gchar *needle = user_data;
- const gchar *command = sp_process_model_item_get_command_line (SP_PROCESS_MODEL_ITEM (object));
+ const gchar *command = sysprof_process_model_item_get_command_line (SYSPROF_PROCESS_MODEL_ITEM (object));
return !!strstr (command, needle);
}
static void
on_entry_changed (GtkEntry *entry,
- SpModelFilter *filter)
+ SysprofModelFilter *filter)
{
const gchar *text;
g_assert (GTK_IS_ENTRY (entry));
- g_assert (SP_IS_MODEL_FILTER (filter));
+ g_assert (SYSPROF_IS_MODEL_FILTER (filter));
text = gtk_entry_get_text (entry);
- sp_model_filter_set_filter_func (filter, filter_cb, g_strdup (text), g_free);
+ sysprof_model_filter_set_filter_func (filter, filter_cb, g_strdup (text), g_free);
//gtk_list_box_bind_model (GTK_LIST_BOX (list), G_LIST_MODEL (filter), create_row, NULL, NULL);
}
@@ -40,8 +40,8 @@ gint
main (gint argc,
gchar *argv[])
{
- SpProcessModel *model;
- SpModelFilter *filter;
+ SysprofProcessModel *model;
+ SysprofModelFilter *filter;
GtkWidget *window;
GtkWidget *box;
GtkWidget *scroller;
@@ -77,8 +77,8 @@ main (gint argc,
NULL);
gtk_container_add (GTK_CONTAINER (scroller), list);
- model = sp_process_model_new ();
- filter = sp_model_filter_new (G_LIST_MODEL (model));
+ model = sysprof_process_model_new ();
+ filter = sysprof_model_filter_new (G_LIST_MODEL (model));
gtk_list_box_bind_model (GTK_LIST_BOX (list), G_LIST_MODEL (filter), create_row, NULL, NULL);
g_signal_connect (entry,
diff --git a/src/tests/test-zoom.c b/src/tests/test-zoom.c
index 519445d..f6b8093 100644
--- a/src/tests/test-zoom.c
+++ b/src/tests/test-zoom.c
@@ -1,36 +1,36 @@
-#include "sp-zoom-manager.h"
+#include "sysprof-zoom-manager.h"
static void
test_zoom_manager (void)
{
- SpZoomManager *zoom;
+ SysprofZoomManager *zoom;
- zoom = sp_zoom_manager_new ();
- g_assert_cmpfloat (1.0, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_in (zoom);
- g_assert_cmpfloat (1.1, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_in (zoom);
- g_assert_cmpfloat (1.2, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_in (zoom);
- g_assert_cmpfloat (1.33, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (1.2, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (1.1, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (1.0, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (.9, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (.8, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (.67, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (.5, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (.3, ==, sp_zoom_manager_get_zoom (zoom));
- sp_zoom_manager_zoom_out (zoom);
- g_assert_cmpfloat (.3 / 2, ==, sp_zoom_manager_get_zoom (zoom));
+ zoom = sysprof_zoom_manager_new ();
+ g_assert_cmpfloat (1.0, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_in (zoom);
+ g_assert_cmpfloat (1.1, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_in (zoom);
+ g_assert_cmpfloat (1.2, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_in (zoom);
+ g_assert_cmpfloat (1.33, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (1.2, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (1.1, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (1.0, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (.9, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (.8, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (.67, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (.5, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (.3, ==, sysprof_zoom_manager_get_zoom (zoom));
+ sysprof_zoom_manager_zoom_out (zoom);
+ g_assert_cmpfloat (.3 / 2, ==, sysprof_zoom_manager_get_zoom (zoom));
g_object_unref (zoom);
}
diff --git a/src/tools/sysprof-cat.c b/src/tools/sysprof-cat.c
index 68c1bb5..f72718d 100644
--- a/src/tools/sysprof-cat.c
+++ b/src/tools/sysprof-cat.c
@@ -105,7 +105,7 @@ gint
main (gint argc,
gchar *argv[])
{
- g_autoptr(SpCaptureWriter) writer = NULL;
+ g_autoptr(SysprofCaptureWriter) writer = NULL;
g_autofree gchar *contents = NULL;
g_autofree gchar *tmpname = NULL;
gint64 first_start_time = G_MAXINT64;
@@ -137,13 +137,13 @@ main (gint argc,
return EXIT_FAILURE;
}
- writer = sp_capture_writer_new_from_fd (fd, 4096*4);
+ writer = sysprof_capture_writer_new_from_fd (fd, 4096*4);
for (guint i = 1; i < argc; i++)
{
g_autoptr(GError) error = NULL;
- g_autoptr(SpCaptureReader) reader = sp_capture_reader_new (argv[i], &error);
- SpCaptureFrameType type;
+ g_autoptr(SysprofCaptureReader) reader = sysprof_capture_reader_new (argv[i], &error);
+ SysprofCaptureFrameType type;
gint64 start_time;
if (reader == NULL)
@@ -156,16 +156,16 @@ main (gint argc,
translate_table_clear (TRANSLATE_CTR);
translate_table_clear (TRANSLATE_ADDR);
- start_time = sp_capture_reader_get_start_time (reader);
+ start_time = sysprof_capture_reader_get_start_time (reader);
if (start_time < first_start_time)
first_start_time = start_time;
- while (sp_capture_reader_peek_type (reader, &type))
+ while (sysprof_capture_reader_peek_type (reader, &type))
{
- SpCaptureFrame fr;
+ SysprofCaptureFrame fr;
- if (sp_capture_reader_peek_frame (reader, &fr))
+ if (sysprof_capture_reader_peek_frame (reader, &fr))
{
if (fr.time > end_time)
end_time = fr.time;
@@ -173,28 +173,28 @@ main (gint argc,
switch (type)
{
- case SP_CAPTURE_FRAME_TIMESTAMP:
+ case SYSPROF_CAPTURE_FRAME_TIMESTAMP:
{
- const SpCaptureTimestamp *frame;
+ const SysprofCaptureTimestamp *frame;
- if (!(frame = sp_capture_reader_read_timestamp (reader)))
+ if (!(frame = sysprof_capture_reader_read_timestamp (reader)))
goto panic;
- sp_capture_writer_add_timestamp (writer,
+ sysprof_capture_writer_add_timestamp (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid);
break;
}
- case SP_CAPTURE_FRAME_MAP:
+ case SYSPROF_CAPTURE_FRAME_MAP:
{
- const SpCaptureMap *frame;
+ const SysprofCaptureMap *frame;
- if (!(frame = sp_capture_reader_read_map (reader)))
+ if (!(frame = sysprof_capture_reader_read_map (reader)))
goto panic;
- sp_capture_writer_add_map (writer,
+ sysprof_capture_writer_add_map (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
@@ -206,14 +206,14 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_MARK:
+ case SYSPROF_CAPTURE_FRAME_MARK:
{
- const SpCaptureMark *frame;
+ const SysprofCaptureMark *frame;
- if (!(frame = sp_capture_reader_read_mark (reader)))
+ if (!(frame = sysprof_capture_reader_read_mark (reader)))
goto panic;
- sp_capture_writer_add_mark (writer,
+ sysprof_capture_writer_add_mark (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
@@ -228,14 +228,14 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_PROCESS:
+ case SYSPROF_CAPTURE_FRAME_PROCESS:
{
- const SpCaptureProcess *frame;
+ const SysprofCaptureProcess *frame;
- if (!(frame = sp_capture_reader_read_process (reader)))
+ if (!(frame = sysprof_capture_reader_read_process (reader)))
goto panic;
- sp_capture_writer_add_process (writer,
+ sysprof_capture_writer_add_process (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
@@ -243,14 +243,14 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_FORK:
+ case SYSPROF_CAPTURE_FRAME_FORK:
{
- const SpCaptureFork *frame;
+ const SysprofCaptureFork *frame;
- if (!(frame = sp_capture_reader_read_fork (reader)))
+ if (!(frame = sysprof_capture_reader_read_fork (reader)))
goto panic;
- sp_capture_writer_add_fork (writer,
+ sysprof_capture_writer_add_fork (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
@@ -258,34 +258,34 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_EXIT:
+ case SYSPROF_CAPTURE_FRAME_EXIT:
{
- const SpCaptureExit *frame;
+ const SysprofCaptureExit *frame;
- if (!(frame = sp_capture_reader_read_exit (reader)))
+ if (!(frame = sysprof_capture_reader_read_exit (reader)))
goto panic;
- sp_capture_writer_add_exit (writer,
+ sysprof_capture_writer_add_exit (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid);
break;
}
- case SP_CAPTURE_FRAME_JITMAP:
+ case SYSPROF_CAPTURE_FRAME_JITMAP:
{
GHashTable *jitmap;
GHashTableIter iter;
const gchar *name;
guint64 addr;
- if (!(jitmap = sp_capture_reader_read_jitmap (reader)))
+ if (!(jitmap = sysprof_capture_reader_read_jitmap (reader)))
goto panic;
g_hash_table_iter_init (&iter, jitmap);
while (g_hash_table_iter_next (&iter, (gpointer *)&addr, (gpointer *)&name))
{
- guint64 replace = sp_capture_writer_add_jitmap (writer, name);
+ guint64 replace = sysprof_capture_writer_add_jitmap (writer, name);
/* We need to keep a table of replacement addresses so that
* we can translate the samples into the destination address
* space that we synthesized for the address identifier.
@@ -300,20 +300,20 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_SAMPLE:
+ case SYSPROF_CAPTURE_FRAME_SAMPLE:
{
- const SpCaptureSample *frame;
+ const SysprofCaptureSample *frame;
- if (!(frame = sp_capture_reader_read_sample (reader)))
+ if (!(frame = sysprof_capture_reader_read_sample (reader)))
goto panic;
{
- SpCaptureAddress addrs[frame->n_addrs];
+ SysprofCaptureAddress addrs[frame->n_addrs];
for (guint z = 0; z < frame->n_addrs; z++)
addrs[z] = translate_table_translate (TRANSLATE_ADDR, frame->addrs[z]);
- sp_capture_writer_add_sample (writer,
+ sysprof_capture_writer_add_sample (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
@@ -325,22 +325,22 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_CTRDEF:
+ case SYSPROF_CAPTURE_FRAME_CTRDEF:
{
- const SpCaptureFrameCounterDefine *frame;
+ const SysprofCaptureFrameCounterDefine *frame;
- if (!(frame = sp_capture_reader_read_counter_define (reader)))
+ if (!(frame = sysprof_capture_reader_read_counter_define (reader)))
goto panic;
{
- g_autoptr(GArray) counter = g_array_new (FALSE, FALSE, sizeof (SpCaptureCounter));
+ g_autoptr(GArray) counter = g_array_new (FALSE, FALSE, sizeof (SysprofCaptureCounter));
for (guint z = 0; z < frame->n_counters; z++)
{
- SpCaptureCounter c = frame->counters[z];
+ SysprofCaptureCounter c = frame->counters[z];
guint src = c.id;
- c.id = sp_capture_writer_request_counter (writer, 1);
+ c.id = sysprof_capture_writer_request_counter (writer, 1);
if (c.id != src)
translate_table_add (TRANSLATE_CTR, src, c.id);
@@ -348,7 +348,7 @@ main (gint argc,
g_array_append_val (counter, c);
}
- sp_capture_writer_define_counters (writer,
+ sysprof_capture_writer_define_counters (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
@@ -361,27 +361,27 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_CTRSET:
+ case SYSPROF_CAPTURE_FRAME_CTRSET:
{
- const SpCaptureFrameCounterSet *frame;
+ const SysprofCaptureFrameCounterSet *frame;
- if (!(frame = sp_capture_reader_read_counter_set (reader)))
+ if (!(frame = sysprof_capture_reader_read_counter_set (reader)))
goto panic;
{
g_autoptr(GArray) ids = g_array_new (FALSE, FALSE, sizeof (guint));
- g_autoptr(GArray) values = g_array_new (FALSE, FALSE, sizeof (SpCaptureCounterValue));
+ g_autoptr(GArray) values = g_array_new (FALSE, FALSE, sizeof (SysprofCaptureCounterValue));
for (guint z = 0; z < frame->n_values; z++)
{
- const SpCaptureCounterValues *v = &frame->values[z];
+ const SysprofCaptureCounterValues *v = &frame->values[z];
for (guint y = 0; y < G_N_ELEMENTS (v->ids); y++)
{
if (v->ids[y])
{
guint dst = translate_table_translate (TRANSLATE_CTR, v->ids[y]);
- SpCaptureCounterValue value = v->values[y];
+ SysprofCaptureCounterValue value = v->values[y];
g_array_append_val (ids, dst);
g_array_append_val (values, value);
@@ -391,12 +391,12 @@ main (gint argc,
g_assert (ids->len == values->len);
- sp_capture_writer_set_counters (writer,
+ sysprof_capture_writer_set_counters (writer,
frame->frame.time,
frame->frame.cpu,
frame->frame.pid,
(const guint *)(gpointer)ids->data,
- (const SpCaptureCounterValue *)(gpointer)values->data,
+ (const SysprofCaptureCounterValue *)(gpointer)values->data,
ids->len);
}
@@ -409,10 +409,10 @@ main (gint argc,
}
}
- sp_capture_writer_flush (writer);
+ sysprof_capture_writer_flush (writer);
/* do this after flushing as it uses pwrite() to replace data */
- _sp_capture_writer_set_time_range (writer, first_start_time, end_time);
+ _sysprof_capture_writer_set_time_range (writer, first_start_time, end_time);
if (g_file_get_contents (tmpname, &contents, &len, NULL))
write (STDOUT_FILENO, contents, len);
diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c
index b535971..0dc2f2f 100644
--- a/src/tools/sysprof-cli.c
+++ b/src/tools/sysprof-cli.c
@@ -31,7 +31,7 @@
#include <sysprof.h>
static GMainLoop *main_loop;
-static SpProfiler *profiler;
+static SysprofProfiler *profiler;
static int efd = -1;
static int exit_code = EXIT_SUCCESS;
@@ -48,7 +48,7 @@ dispatch (GSource *source,
GSourceFunc callback,
gpointer callback_data)
{
- sp_profiler_stop (profiler);
+ sysprof_profiler_stop (profiler);
g_main_loop_quit (main_loop);
return G_SOURCE_REMOVE;
}
@@ -58,18 +58,18 @@ static GSourceFuncs source_funcs = {
};
static void
-profiler_stopped (SpProfiler *profiler_,
+profiler_stopped (SysprofProfiler *profiler_,
GMainLoop *main_loop_)
{
g_main_loop_quit (main_loop_);
}
static void
-profiler_failed (SpProfiler *profiler_,
+profiler_failed (SysprofProfiler *profiler_,
const GError *reason,
GMainLoop *main_loop_)
{
- g_assert (SP_IS_PROFILER (profiler_));
+ g_assert (SYSPROF_IS_PROFILER (profiler_));
g_assert (reason != NULL);
g_printerr ("Failure: %s\n", reason->message);
@@ -80,8 +80,8 @@ gint
main (gint argc,
gchar *argv[])
{
- SpCaptureWriter *writer;
- SpSource *source;
+ SysprofCaptureWriter *writer;
+ SysprofSource *source;
GMainContext *main_context;
GOptionContext *context;
const gchar *filename = "capture.syscap";
@@ -105,7 +105,7 @@ main (gint argc,
{ NULL }
};
- sp_clock_init ();
+ sysprof_clock_init ();
context = g_option_context_new (_("[CAPTURE_FILE] — Sysprof"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
@@ -143,7 +143,7 @@ main (gint argc,
g_source_add_unix_fd (gsource, efd, G_IO_IN);
g_source_attach (gsource, NULL);
- profiler = sp_local_profiler_new ();
+ profiler = sysprof_local_profiler_new ();
g_signal_connect (profiler,
"failed",
@@ -202,41 +202,41 @@ main (gint argc,
}
}
- writer = sp_capture_writer_new_from_fd (fd, 0);
- sp_profiler_set_writer (profiler, writer);
+ writer = sysprof_capture_writer_new_from_fd (fd, 0);
+ sysprof_profiler_set_writer (profiler, writer);
- source = sp_proc_source_new ();
- sp_profiler_add_source (profiler, source);
+ source = sysprof_proc_source_new ();
+ sysprof_profiler_add_source (profiler, source);
g_object_unref (source);
- source = sp_perf_source_new ();
- sp_profiler_add_source (profiler, source);
+ source = sysprof_perf_source_new ();
+ sysprof_profiler_add_source (profiler, source);
g_object_unref (source);
if (!no_cpu)
{
- source = sp_hostinfo_source_new ();
- sp_profiler_add_source (profiler, source);
+ source = sysprof_hostinfo_source_new ();
+ sysprof_profiler_add_source (profiler, source);
g_object_unref (source);
}
if (!no_memory)
{
- source = sp_memory_source_new ();
- sp_profiler_add_source (profiler, source);
+ source = sysprof_memory_source_new ();
+ sysprof_profiler_add_source (profiler, source);
g_object_unref (source);
}
if (pid != -1)
{
- sp_profiler_set_whole_system (profiler, FALSE);
- sp_profiler_add_pid (profiler, pid);
+ sysprof_profiler_set_whole_system (profiler, FALSE);
+ sysprof_profiler_add_pid (profiler, pid);
}
signal (SIGINT, signal_handler);
signal (SIGTERM, signal_handler);
- sp_profiler_start (profiler);
+ sysprof_profiler_start (profiler);
/* Restore the process if we stopped it */
if (command)
@@ -252,7 +252,7 @@ main (gint argc,
close (efd);
- g_clear_pointer (&writer, sp_capture_writer_unref);
+ g_clear_pointer (&writer, sysprof_capture_writer_unref);
g_clear_object (&profiler);
g_clear_pointer (&main_loop, g_main_loop_unref);
g_clear_pointer (&context, g_option_context_free);
diff --git a/src/tools/sysprof-dump.c b/src/tools/sysprof-dump.c
index 191945f..1e81bb0 100644
--- a/src/tools/sysprof-dump.c
+++ b/src/tools/sysprof-dump.c
@@ -28,8 +28,8 @@ gint
main (gint argc,
gchar *argv[])
{
- SpCaptureReader *reader;
- SpCaptureFrameType type;
+ SysprofCaptureReader *reader;
+ SysprofCaptureFrameType type;
GHashTable *ctrtypes;
GError *error = NULL;
gint64 begin_time;
@@ -41,10 +41,10 @@ main (gint argc,
return EXIT_FAILURE;
}
- reader = sp_capture_reader_new (argv[1], &error);
+ reader = sysprof_capture_reader_new (argv[1], &error);
ctrtypes = g_hash_table_new (NULL, NULL);
- begin_time = sp_capture_reader_get_start_time (reader);
+ begin_time = sysprof_capture_reader_get_start_time (reader);
#define SET_CTR_TYPE(i,t) g_hash_table_insert(ctrtypes, GINT_TO_POINTER(i), GINT_TO_POINTER(t))
#define GET_CTR_TYPE(i) GPOINTER_TO_INT(g_hash_table_lookup(ctrtypes, GINT_TO_POINTER(i)))
@@ -55,19 +55,19 @@ main (gint argc,
return EXIT_FAILURE;
}
- begin_time = sp_capture_reader_get_start_time (reader);
- end_time = sp_capture_reader_get_end_time (reader);
+ begin_time = sysprof_capture_reader_get_start_time (reader);
+ end_time = sysprof_capture_reader_get_end_time (reader);
g_print ("Capture Time Range: %"G_GUINT64_FORMAT" to %"G_GUINT64_FORMAT" (%lf)\n",
begin_time, end_time, (end_time - begin_time) / (gdouble)NSEC_PER_SEC);
- while (sp_capture_reader_peek_type (reader, &type))
+ while (sysprof_capture_reader_peek_type (reader, &type))
{
switch (type)
{
- case SP_CAPTURE_FRAME_EXIT:
+ case SYSPROF_CAPTURE_FRAME_EXIT:
{
- const SpCaptureExit *ex = sp_capture_reader_read_exit (reader);
+ const SysprofCaptureExit *ex = sysprof_capture_reader_read_exit (reader);
if (ex == NULL)
return EXIT_FAILURE;
@@ -77,9 +77,9 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_FORK:
+ case SYSPROF_CAPTURE_FRAME_FORK:
{
- const SpCaptureFork *fk = sp_capture_reader_read_fork (reader);
+ const SysprofCaptureFork *fk = sysprof_capture_reader_read_fork (reader);
if (fk == NULL)
return EXIT_FAILURE;
@@ -89,11 +89,11 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_JITMAP:
+ case SYSPROF_CAPTURE_FRAME_JITMAP:
{
- g_autoptr(GHashTable) ret = sp_capture_reader_read_jitmap (reader);
+ g_autoptr(GHashTable) ret = sysprof_capture_reader_read_jitmap (reader);
GHashTableIter iter;
- SpCaptureAddress addr;
+ SysprofCaptureAddress addr;
const gchar *str;
if (ret == NULL)
@@ -103,14 +103,14 @@ main (gint argc,
g_hash_table_iter_init (&iter, ret);
while (g_hash_table_iter_next (&iter, (gpointer *)&addr, (gpointer *)&str))
- g_print (" "SP_CAPTURE_ADDRESS_FORMAT" : %s\n", addr, str);
+ g_print (" "SYSPROF_CAPTURE_ADDRESS_FORMAT" : %s\n", addr, str);
break;
}
- case SP_CAPTURE_FRAME_MAP:
+ case SYSPROF_CAPTURE_FRAME_MAP:
{
- const SpCaptureMap *map = sp_capture_reader_read_map (reader);
+ const SysprofCaptureMap *map = sysprof_capture_reader_read_map (reader);
g_print ("MAP: pid=%d time=%"G_GINT64_FORMAT"\n"
" start = %"G_GUINT64_FORMAT"\n"
@@ -124,9 +124,9 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_MARK:
+ case SYSPROF_CAPTURE_FRAME_MARK:
{
- const SpCaptureMark *mark = sp_capture_reader_read_mark (reader);
+ const SysprofCaptureMark *mark = sysprof_capture_reader_read_mark (reader);
gdouble ptime = (mark->frame.time - begin_time) / (gdouble)NSEC_PER_SEC;
g_print ("MARK: pid=%d time=%"G_GINT64_FORMAT" (%lf)\n"
@@ -140,9 +140,9 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_PROCESS:
+ case SYSPROF_CAPTURE_FRAME_PROCESS:
{
- const SpCaptureProcess *pr = sp_capture_reader_read_process (reader);
+ const SysprofCaptureProcess *pr = sysprof_capture_reader_read_process (reader);
if (pr == NULL)
perror ("Failed to read process");
@@ -152,37 +152,37 @@ main (gint argc,
break;
}
- case SP_CAPTURE_FRAME_SAMPLE:
+ case SYSPROF_CAPTURE_FRAME_SAMPLE:
{
- const SpCaptureSample *s = sp_capture_reader_read_sample (reader);
+ const SysprofCaptureSample *s = sysprof_capture_reader_read_sample (reader);
gdouble ptime = (s->frame.time - begin_time) / (gdouble)NSEC_PER_SEC;
guint i;
g_print ("SAMPLE: pid=%d time=%"G_GINT64_FORMAT" (%lf)\n", s->frame.pid, s->frame.time, ptime);
for (i = 0; i < s->n_addrs; i++)
- g_print (" "SP_CAPTURE_ADDRESS_FORMAT"\n", s->addrs[i]);
+ g_print (" "SYSPROF_CAPTURE_ADDRESS_FORMAT"\n", s->addrs[i]);
break;
}
- case SP_CAPTURE_FRAME_TIMESTAMP:
+ case SYSPROF_CAPTURE_FRAME_TIMESTAMP:
{
- const SpCaptureTimestamp *ts = sp_capture_reader_read_timestamp (reader);
+ const SysprofCaptureTimestamp *ts = sysprof_capture_reader_read_timestamp (reader);
g_print ("TIMESTAMP: pid=%d time=%"G_GINT64_FORMAT"\n", ts->frame.pid, ts->frame.time);
break;
}
- case SP_CAPTURE_FRAME_CTRDEF:
+ case SYSPROF_CAPTURE_FRAME_CTRDEF:
{
- const SpCaptureFrameCounterDefine *def = sp_capture_reader_read_counter_define (reader);
+ const SysprofCaptureFrameCounterDefine *def = sysprof_capture_reader_read_counter_define
(reader);
guint i;
g_print ("NEW COUNTERS: pid=%d time=%"G_GINT64_FORMAT"\n", def->frame.pid, def->frame.time);
for (i = 0; i < def->n_counters; i++)
{
- const SpCaptureCounter *ctr = &def->counters[i];
+ const SysprofCaptureCounter *ctr = &def->counters[i];
SET_CTR_TYPE (ctr->id, ctr->type);
@@ -195,27 +195,27 @@ main (gint argc,
}
break;
- case SP_CAPTURE_FRAME_CTRSET:
+ case SYSPROF_CAPTURE_FRAME_CTRSET:
{
- const SpCaptureFrameCounterSet *set = sp_capture_reader_read_counter_set (reader);
+ const SysprofCaptureFrameCounterSet *set = sysprof_capture_reader_read_counter_set (reader);
guint i;
g_print ("SET COUNTERS: pid=%d time=%"G_GINT64_FORMAT"\n", set->frame.pid, set->frame.time);
for (i = 0; i < set->n_values; i++)
{
- const SpCaptureCounterValues *values = &set->values[i];
+ const SysprofCaptureCounterValues *values = &set->values[i];
guint j;
for (j = 0; j < G_N_ELEMENTS (values->ids); j++)
{
if (values->ids[j])
{
- if (GET_CTR_TYPE (values->ids[j]) == SP_CAPTURE_COUNTER_INT64)
+ if (GET_CTR_TYPE (values->ids[j]) == SYSPROF_CAPTURE_COUNTER_INT64)
g_print (" COUNTER(%d): %"G_GINT64_FORMAT"\n",
values->ids[j],
values->values[j].v64);
- else if (GET_CTR_TYPE (values->ids[j]) == SP_CAPTURE_COUNTER_DOUBLE)
+ else if (GET_CTR_TYPE (values->ids[j]) == SYSPROF_CAPTURE_COUNTER_DOUBLE)
g_print (" COUNTER(%d): %lf\n",
values->ids[j],
values->values[j].vdbl);
@@ -227,7 +227,7 @@ main (gint argc,
default:
g_print ("Skipping unknown frame type: (%d): ", type);
- if (!sp_capture_reader_skip (reader))
+ if (!sysprof_capture_reader_skip (reader))
{
g_print ("Failed\n");
return EXIT_FAILURE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]