mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
sysprof: add memory allocations section
Still a bunch to do here to restore what we had previously, but this gets the section into place.
This commit is contained in:
@ -5,6 +5,7 @@ sysprof_sources = [
|
||||
'sysprof-greeter.c',
|
||||
'sysprof-logs-section.c',
|
||||
'sysprof-marks-section.c',
|
||||
'sysprof-memory-section.c',
|
||||
'sysprof-metadata-section.c',
|
||||
'sysprof-processes-section.c',
|
||||
'sysprof-recording-pad.c',
|
||||
|
||||
68
src/sysprof/sysprof-memory-section.c
Normal file
68
src/sysprof/sysprof-memory-section.c
Normal file
@ -0,0 +1,68 @@
|
||||
/* sysprof-memory-section.c
|
||||
*
|
||||
* Copyright 2023 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-gtk.h>
|
||||
|
||||
#include "sysprof-memory-section.h"
|
||||
|
||||
struct _SysprofMemorySection
|
||||
{
|
||||
SysprofSection parent_instance;
|
||||
|
||||
SysprofWeightedCallgraphView *callgraph_view;
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (SysprofMemorySection, sysprof_memory_section, SYSPROF_TYPE_SECTION)
|
||||
|
||||
static void
|
||||
sysprof_memory_section_dispose (GObject *object)
|
||||
{
|
||||
SysprofMemorySection *self = (SysprofMemorySection *)object;
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (self), SYSPROF_TYPE_MEMORY_SECTION);
|
||||
|
||||
G_OBJECT_CLASS (sysprof_memory_section_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_memory_section_class_init (SysprofMemorySectionClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = sysprof_memory_section_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-memory-section.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofMemorySection, callgraph_view);
|
||||
|
||||
g_type_ensure (SYSPROF_TYPE_CHART);
|
||||
g_type_ensure (SYSPROF_TYPE_XY_SERIES);
|
||||
g_type_ensure (SYSPROF_TYPE_COLUMN_LAYER);
|
||||
g_type_ensure (SYSPROF_TYPE_VALUE_AXIS);
|
||||
g_type_ensure (SYSPROF_TYPE_MEMORY_CALLGRAPH_VIEW);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_memory_section_init (SysprofMemorySection *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
31
src/sysprof/sysprof-memory-section.h
Normal file
31
src/sysprof/sysprof-memory-section.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* sysprof-memory-section.h
|
||||
*
|
||||
* Copyright 2023 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-section.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_MEMORY_SECTION (sysprof_memory_section_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SysprofMemorySection, sysprof_memory_section, SYSPROF, MEMORY_SECTION, SysprofSection)
|
||||
|
||||
G_END_DECLS
|
||||
40
src/sysprof/sysprof-memory-section.ui
Normal file
40
src/sysprof/sysprof-memory-section.ui
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="SysprofMemorySection" parent="SysprofSection">
|
||||
<property name="title" translatable="yes">Memory Allocations</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="SysprofMemoryCallgraphView" id="callgraph_view">
|
||||
<property name="vexpand">true</property>
|
||||
<binding name="include-threads">
|
||||
<lookup name="include-threads" type="SysprofSession">
|
||||
<lookup name="session">SysprofMemorySection</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
<binding name="hide-system-libraries">
|
||||
<lookup name="hide-system-libraries" type="SysprofSession">
|
||||
<lookup name="session">SysprofMemorySection</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
<binding name="document">
|
||||
<lookup name="document" type="SysprofSession">
|
||||
<lookup name="session">SysprofMemorySection</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
<binding name="traceables">
|
||||
<!-- TODO: This should be filtered by Session selected time span -->
|
||||
<lookup name="allocations" type="SysprofDocument">
|
||||
<lookup name="document" type="SysprofSession">
|
||||
<lookup name="session">SysprofMemorySection</lookup>
|
||||
</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "sysprof-greeter.h"
|
||||
#include "sysprof-logs-section.h"
|
||||
#include "sysprof-marks-section.h"
|
||||
#include "sysprof-memory-section.h"
|
||||
#include "sysprof-metadata-section.h"
|
||||
#include "sysprof-processes-section.h"
|
||||
#include "sysprof-samples-section.h"
|
||||
@ -199,6 +200,7 @@ sysprof_window_class_init (SysprofWindowClass *klass)
|
||||
g_type_ensure (SYSPROF_TYPE_FILES_SECTION);
|
||||
g_type_ensure (SYSPROF_TYPE_LOGS_SECTION);
|
||||
g_type_ensure (SYSPROF_TYPE_MARKS_SECTION);
|
||||
g_type_ensure (SYSPROF_TYPE_MEMORY_SECTION);
|
||||
g_type_ensure (SYSPROF_TYPE_METADATA_SECTION);
|
||||
g_type_ensure (SYSPROF_TYPE_PROCESSES_SECTION);
|
||||
g_type_ensure (SYSPROF_TYPE_SAMPLES_SECTION);
|
||||
|
||||
@ -105,6 +105,14 @@
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="SysprofMemorySection">
|
||||
<property name="category">callgraph</property>
|
||||
<binding name="session">
|
||||
<lookup name="session">SysprofWindow</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="SysprofLogsSection">
|
||||
<property name="category">processes</property>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<file preprocess="xml-stripblanks">sysprof-greeter.ui</file>
|
||||
<file preprocess="xml-stripblanks">sysprof-logs-section.ui</file>
|
||||
<file preprocess="xml-stripblanks">sysprof-marks-section.ui</file>
|
||||
<file preprocess="xml-stripblanks">sysprof-memory-section.ui</file>
|
||||
<file preprocess="xml-stripblanks">sysprof-metadata-section.ui</file>
|
||||
<file preprocess="xml-stripblanks">sysprof-processes-section.ui</file>
|
||||
<file preprocess="xml-stripblanks">sysprof-recording-pad.ui</file>
|
||||
|
||||
Reference in New Issue
Block a user