From 5d1a7a8cce1a044578332168906a5e95ab8008a4 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 10 Jul 2023 11:34:28 -0700 Subject: [PATCH] sysprof: start on processes chart --- src/sysprof/meson.build | 1 + src/sysprof/sysprof-processes-section.c | 77 +++++++++++++++++++ src/sysprof/sysprof-processes-section.h | 32 ++++++++ src/sysprof/sysprof-processes-section.ui | 97 ++++++++++++++++++++++++ src/sysprof/sysprof-window.c | 3 + src/sysprof/sysprof-window.ui | 7 ++ src/sysprof/sysprof.gresource.xml | 1 + 7 files changed, 218 insertions(+) create mode 100644 src/sysprof/sysprof-processes-section.c create mode 100644 src/sysprof/sysprof-processes-section.h create mode 100644 src/sysprof/sysprof-processes-section.ui diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build index 781b857e..dcb653c0 100644 --- a/src/sysprof/meson.build +++ b/src/sysprof/meson.build @@ -6,6 +6,7 @@ sysprof_sources = [ 'sysprof-logs-section.c', 'sysprof-marks-section.c', 'sysprof-metadata-section.c', + 'sysprof-processes-section.c', 'sysprof-recording-pad.c', 'sysprof-samples-section.c', 'sysprof-section.c', diff --git a/src/sysprof/sysprof-processes-section.c b/src/sysprof/sysprof-processes-section.c new file mode 100644 index 00000000..8a57b309 --- /dev/null +++ b/src/sysprof/sysprof-processes-section.c @@ -0,0 +1,77 @@ +/* sysprof-processes-section.c + * + * Copyright 2023 Christian Hergert + * + * 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 . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include "config.h" + +#include + +#include +#include + +#include "sysprof-processes-section.h" +#include "sysprof-single-model.h" + +struct _SysprofProcessesSection +{ + SysprofSection parent_instance; + + GtkListView *list_view; +}; + +G_DEFINE_FINAL_TYPE (SysprofProcessesSection, sysprof_processes_section, SYSPROF_TYPE_SECTION) + +static void +sysprof_processes_section_dispose (GObject *object) +{ + SysprofProcessesSection *self = (SysprofProcessesSection *)object; + + gtk_widget_dispose_template (GTK_WIDGET (self), SYSPROF_TYPE_PROCESSES_SECTION); + + G_OBJECT_CLASS (sysprof_processes_section_parent_class)->dispose (object); +} + +static void +sysprof_processes_section_class_init (SysprofProcessesSectionClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->dispose = sysprof_processes_section_dispose; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-processes-section.ui"); + gtk_widget_class_bind_template_child (widget_class, SysprofProcessesSection, list_view); + + g_type_ensure (SYSPROF_TYPE_CHART); + g_type_ensure (SYSPROF_TYPE_CHART_LAYER); + g_type_ensure (SYSPROF_TYPE_DOCUMENT_PROCESS); + g_type_ensure (SYSPROF_TYPE_SESSION_MODEL); + g_type_ensure (SYSPROF_TYPE_SESSION_MODEL_ITEM); + g_type_ensure (SYSPROF_TYPE_SINGLE_MODEL); + g_type_ensure (SYSPROF_TYPE_TIME_LABEL); + g_type_ensure (SYSPROF_TYPE_TIME_SERIES); + g_type_ensure (SYSPROF_TYPE_TIME_SPAN_LAYER); + g_type_ensure (SYSPROF_TYPE_VALUE_AXIS); +} + +static void +sysprof_processes_section_init (SysprofProcessesSection *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); +} diff --git a/src/sysprof/sysprof-processes-section.h b/src/sysprof/sysprof-processes-section.h new file mode 100644 index 00000000..cbdafba5 --- /dev/null +++ b/src/sysprof/sysprof-processes-section.h @@ -0,0 +1,32 @@ +/* sysprof-processes-section.h + * + * Copyright 2023 Christian Hergert + * + * 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 . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "sysprof-section.h" + +G_BEGIN_DECLS + +#define SYSPROF_TYPE_PROCESSES_SECTION (sysprof_processes_section_get_type()) + +G_DECLARE_FINAL_TYPE (SysprofProcessesSection, sysprof_processes_section, SYSPROF, PROCESSES_SECTION, SysprofSection) + +G_END_DECLS + diff --git a/src/sysprof/sysprof-processes-section.ui b/src/sysprof/sysprof-processes-section.ui new file mode 100644 index 00000000..e0afe756 --- /dev/null +++ b/src/sysprof/sysprof-processes-section.ui @@ -0,0 +1,97 @@ + + + + + diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c index 57a459ec..fef99dd4 100644 --- a/src/sysprof/sysprof-window.c +++ b/src/sysprof/sysprof-window.c @@ -29,6 +29,7 @@ #include "sysprof-logs-section.h" #include "sysprof-marks-section.h" #include "sysprof-metadata-section.h" +#include "sysprof-processes-section.h" #include "sysprof-samples-section.h" #include "sysprof-sidebar.h" #include "sysprof-window.h" @@ -36,6 +37,7 @@ struct _SysprofWindow { AdwApplicationWindow parent_instance; + SysprofDocument *document; SysprofSession *session; }; @@ -183,6 +185,7 @@ sysprof_window_class_init (SysprofWindowClass *klass) g_type_ensure (SYSPROF_TYPE_LOGS_SECTION); g_type_ensure (SYSPROF_TYPE_MARKS_SECTION); g_type_ensure (SYSPROF_TYPE_METADATA_SECTION); + g_type_ensure (SYSPROF_TYPE_PROCESSES_SECTION); g_type_ensure (SYSPROF_TYPE_SAMPLES_SECTION); g_type_ensure (SYSPROF_TYPE_SESSION); g_type_ensure (SYSPROF_TYPE_SIDEBAR); diff --git a/src/sysprof/sysprof-window.ui b/src/sysprof/sysprof-window.ui index 9d20eada..16462304 100644 --- a/src/sysprof/sysprof-window.ui +++ b/src/sysprof/sysprof-window.ui @@ -110,6 +110,13 @@ + + + + SysprofWindow + + + diff --git a/src/sysprof/sysprof.gresource.xml b/src/sysprof/sysprof.gresource.xml index cd75158c..6bea8c39 100644 --- a/src/sysprof/sysprof.gresource.xml +++ b/src/sysprof/sysprof.gresource.xml @@ -8,6 +8,7 @@ sysprof-logs-section.ui sysprof-marks-section.ui sysprof-metadata-section.ui + sysprof-processes-section.ui sysprof-recording-pad.ui sysprof-samples-section.ui sysprof-sidebar.ui