sysprof: start on processes chart

This commit is contained in:
Christian Hergert
2023-07-10 11:34:28 -07:00
parent f0e0298acb
commit 5d1a7a8cce
7 changed files with 218 additions and 0 deletions

View File

@ -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',

View File

@ -0,0 +1,77 @@
/* sysprof-processes-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 <glib/gi18n.h>
#include <adwaita.h>
#include <sysprof-gtk.h>
#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));
}

View File

@ -0,0 +1,32 @@
/* sysprof-processes-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_PROCESSES_SECTION (sysprof_processes_section_get_type())
G_DECLARE_FINAL_TYPE (SysprofProcessesSection, sysprof_processes_section, SYSPROF, PROCESSES_SECTION, SysprofSection)
G_END_DECLS

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="SysprofProcessesSection" parent="SysprofSection">
<property name="title" translatable="yes">Processes</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">true</property>
<child>
<object class="GtkListView" id="list_view">
<style>
<class name="data-table"/>
</style>
<property name="model">
<object class="GtkSingleSelection">
<property name="model">
<object class="SysprofSessionModel">
<binding name="session">
<lookup name="session">SysprofProcessesSection</lookup>
</binding>
<binding name="model">
<lookup name="processes" type="SysprofDocument">
<lookup name="document" type="SysprofSession">
<lookup name="session">SysprofProcessesSection</lookup>
</lookup>
</lookup>
</binding>
</object>
</property>
</object>
</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkBox">
<property name="height-request">16</property>
<child>
<object class="SysprofChart">
<property name="hexpand">true</property>
<child>
<object class="SysprofTimeSpanLayer">
<binding name="axis">
<lookup name="selected-time-axis" type="SysprofSession">
<lookup name="session" type="SysprofSessionModelItem">
<lookup name="item">GtkListItem</lookup>
</lookup>
</lookup>
</binding>
<property name="series">
<object class="SysprofTimeSeries">
<property name="model">
<object class="SysprofSingleModel">
<binding name="item">
<lookup name="item" type="SysprofSessionModelItem">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
<property name="time-expression">
<lookup name="time" type="SysprofDocumentFrame"/>
</property>
<property name="duration-expression">
<lookup name="duration" type="SysprofDocumentProcess"/>
</property>
<property name="label-expression">
<lookup name="command-line" type="SysprofDocumentProcess"/>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>

View File

@ -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);

View File

@ -110,6 +110,13 @@
</binding>
</object>
</child>
<child>
<object class="SysprofProcessesSection">
<binding name="session">
<lookup name="session">SysprofWindow</lookup>
</binding>
</object>
</child>
<child>
<object class="SysprofFilesSection">
<binding name="session">

View File

@ -8,6 +8,7 @@
<file preprocess="xml-stripblanks">sysprof-logs-section.ui</file>
<file preprocess="xml-stripblanks">sysprof-marks-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>
<file preprocess="xml-stripblanks">sysprof-samples-section.ui</file>
<file preprocess="xml-stripblanks">sysprof-sidebar.ui</file>