[gnome-builder] plugins/sysprof: add sysprof tweaks



commit 65a591a2af0f44335ace90e4a01f59a598511704
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 19 22:11:14 2022 -0700

    plugins/sysprof: add sysprof tweaks

 src/plugins/sysprof/gbp-sysprof-tweaks-addin.c |  44 ++++++++
 src/plugins/sysprof/gbp-sysprof-tweaks-addin.h |  31 ++++++
 src/plugins/sysprof/meson.build                |   1 +
 src/plugins/sysprof/sysprof-plugin.c           |   4 +
 src/plugins/sysprof/sysprof.gresource.xml      |   3 +-
 src/plugins/sysprof/tweaks.ui                  | 148 +++++++++++++++++++++++++
 6 files changed, 230 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/sysprof/gbp-sysprof-tweaks-addin.c b/src/plugins/sysprof/gbp-sysprof-tweaks-addin.c
new file mode 100644
index 000000000..dfe59bc46
--- /dev/null
+++ b/src/plugins/sysprof/gbp-sysprof-tweaks-addin.c
@@ -0,0 +1,44 @@
+/* gbp-sysprof-tweaks-addin.c
+ *
+ * Copyright 2022 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 "gbp-sysprof-tweaks-addin"
+
+#include "config.h"
+
+#include "gbp-sysprof-tweaks-addin.h"
+
+struct _GbpSysprofTweaksAddin
+{
+  IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpSysprofTweaksAddin, gbp_sysprof_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_sysprof_tweaks_addin_class_init (GbpSysprofTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_sysprof_tweaks_addin_init (GbpSysprofTweaksAddin *self)
+{
+  ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+                                       IDE_STRV_INIT ("/plugins/sysprof/tweaks.ui"));
+}
diff --git a/src/plugins/sysprof/gbp-sysprof-tweaks-addin.h b/src/plugins/sysprof/gbp-sysprof-tweaks-addin.h
new file mode 100644
index 000000000..15b7f7e81
--- /dev/null
+++ b/src/plugins/sysprof/gbp-sysprof-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-sysprof-tweaks-addin.h
+ *
+ * Copyright 2022 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 <libide-tweaks.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SYSPROF_TWEAKS_ADDIN (gbp_sysprof_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpSysprofTweaksAddin, gbp_sysprof_tweaks_addin, GBP, SYSPROF_TWEAKS_ADDIN, 
IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/sysprof/meson.build b/src/plugins/sysprof/meson.build
index 2d21e312b..b8dbb30fe 100644
--- a/src/plugins/sysprof/meson.build
+++ b/src/plugins/sysprof/meson.build
@@ -23,6 +23,7 @@ plugins_sources += files([
   'sysprof-plugin.c',
   'gbp-sysprof-page.c',
   'gbp-sysprof-tool.c',
+  'gbp-sysprof-tweaks-addin.c',
   'gbp-sysprof-workbench-addin.c',
 ])
 
diff --git a/src/plugins/sysprof/sysprof-plugin.c b/src/plugins/sysprof/sysprof-plugin.c
index a727a711e..cbe6bd43c 100644
--- a/src/plugins/sysprof/sysprof-plugin.c
+++ b/src/plugins/sysprof/sysprof-plugin.c
@@ -28,6 +28,7 @@
 #include <libide-gui.h>
 
 #include "gbp-sysprof-tool.h"
+#include "gbp-sysprof-tweaks-addin.h"
 #include "gbp-sysprof-workbench-addin.h"
 
 _IDE_EXTERN void
@@ -38,6 +39,9 @@ _gbp_sysprof_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_RUN_TOOL,
                                               GBP_TYPE_SYSPROF_TOOL);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TWEAKS_ADDIN,
+                                              GBP_TYPE_SYSPROF_TWEAKS_ADDIN);
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_WORKBENCH_ADDIN,
                                               GBP_TYPE_SYSPROF_WORKBENCH_ADDIN);
diff --git a/src/plugins/sysprof/sysprof.gresource.xml b/src/plugins/sysprof/sysprof.gresource.xml
index ab5e8c9b5..22882ad30 100644
--- a/src/plugins/sysprof/sysprof.gresource.xml
+++ b/src/plugins/sysprof/sysprof.gresource.xml
@@ -2,7 +2,8 @@
 <gresources>
   <gresource prefix="/plugins/sysprof">
     <file>sysprof.plugin</file>
-    <file>gtk/menus.ui</file>
     <file>gtk/keybindings.json</file>
+    <file preprocess="xml-stripblanks">gtk/menus.ui</file>
+    <file preprocess="xml-stripblanks">tweaks.ui</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/sysprof/tweaks.ui b/src/plugins/sysprof/tweaks.ui
new file mode 100644
index 000000000..b74fded51
--- /dev/null
+++ b/src/plugins/sysprof/tweaks.ui
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaks">
+    <child>
+      <object class="IdeTweaksSettings" id="settings_org_gnome_builder_sysprof">
+        <property name="schema-id">org.gnome.builder.sysprof</property>
+        <property name="application-only">true</property>
+      </object>
+    </child>
+    <child internal-child="foundry_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="build_page">
+          <object class="IdeTweaksPage">
+            <child>
+              <object class="IdeTweaksPage" id="build_sysprof_page">
+                <property name="icon-name">builder-profiler-symbolic</property>
+                <property name="title" translatable="yes">Profiler</property>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <property name="title" translatable="yes">Instruments</property>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">CPU Usage</property>
+                        <property name="subtitle" translatable="yes">Records CPU usage and CPU frequency 
statistics</property>
+                        <property name="action-name">settings.org.gnome.builder.sysprof.cpu-aid</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Sample Callstacks</property>
+                        <property name="subtitle" translatable="yes">Record stacktraces on a regular 
interval and build a callgraph</property>
+                        <property name="action-name">settings.org.gnome.builder.sysprof.perf-aid</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksCombo">
+                        <property name="title" translatable="yes">CPU Governor</property>
+                        <property name="subtitle" translatable="yes">Force performance mode while 
profiling</property>
+                        <property name="settings">settings_org_gnome_builder_sysprof</property>
+                        <property name="key">allow-throttle</property>
+                        <child>
+                          <object class="IdeTweaksChoice">
+                            <property name="title" translatable="yes">Don't Change Governer</property>
+                            <property name="action-target">true</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="IdeTweaksChoice">
+                            <property name="title" translatable="yes">Force Performance Mode</property>
+                            <property name="action-target">false</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Memory Usage</property>
+                        <property name="subtitle" translatable="yes">Simple memory statistics about the 
process such as total memory used</property>
+                        <property name="action-name">settings.org.gnome.builder.sysprof.memory-aid</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Memory Profiling</property>
+                        <property name="subtitle" translatable="yes">Record stacktraces of memory 
allocations and releases</property>
+                        <property 
name="action-name">settings.org.gnome.builder.sysprof.memprof-aid</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Energy Usage</property>
+                        <property name="subtitle" translatable="yes">Record statistics about energy usage 
using RAPL</property>
+                        <property name="action-name">settings.org.gnome.builder.sysprof.energy-aid</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Battery Usage</property>
+                        <property name="subtitle" translatable="yes">Record statistics about battery charge 
and discharge rates</property>
+                        <property 
name="action-name">settings.org.gnome.builder.sysprof.battery-aid</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Network Usage</property>
+                        <property name="subtitle" translatable="yes">Record statistics about network 
usage</property>
+                        <property name="action-name">settings.org.gnome.builder.sysprof.netdev-aid</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Disk Usage</property>
+                        <property name="subtitle" translatable="yes">Record statistics about battery charge 
and discharge rates</property>
+                        <property 
name="action-name">settings.org.gnome.builder.sysprof.diskstat-aid</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">GNOME Shell Performance</property>
+                        <property name="subtitle" translatable="yes">Collect performance and timing 
information from GNOME Shell</property>
+                        <property 
name="action-name">settings.org.gnome.builder.sysprof.compositor-aid</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <property name="title" translatable="yes">Integration</property>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">JavaScript</property>
+                        <property name="subtitle" translatable="yes">Collect infomration from GJS-based 
applications</property>
+                        <property name="action-name">settings.org.gnome.builder.sysprof.gjs-aid</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Application Tracing</property>
+                        <property name="subtitle" translatable="yes">Provide TRACE_FD environment variable 
for applications to deliver custom events</property>
+                        <property 
name="action-name">settings.org.gnome.builder.sysprof.allow-tracefd</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]