Discussion:
[PATCH 5/9] procview: fix another identation error
Federico Pellegrin
2021-03-18 05:01:51 UTC
Permalink
Fix another identation error introduced in tabs->spaces
transition

Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/gui/procview.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index 9cd575c..bbe14b6 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -454,7 +454,7 @@ class procview:
# removed and now row is the next one
continue
# removed and its the last one
- break
+ break
else:
try:
self.set_thread_columns(row, tid, threads[tid])
--
2.26.3
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: http
John Kacur
2021-03-19 04:39:59 UTC
Permalink
Add -R (--refresh) to be able to set via command line the refresh
time of the GUI. Previously it was hardcoded 2500. I believe this
can be very useful both for unloaded systems where we want faster
refreshes and for very loaded (with many processes/irqs) systems
where 2500 can lead to very high CPU usage of tuna.
---
tuna-cmd.py | 16 +++++++++++++---
tuna/gui/cpuview.py | 4 ++--
tuna/tuna_gui.py | 6 +++---
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 4181004..c27abd1 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
{"irqlist": _('IRQ-LIST')}))
print(fmt % ('-r, --run=' + _('COMMAND'), _('fork a new process and run the %(command)s') %
{"command": _('COMMAND')}))
+ print(fmt % ('-R, --refresh=' + _('MSEC'), _('Refresh the GUI every MSEC milliseconds')))
print(fmt % ('-s, --save=' + _('FILENAME'), _('Save kthreads sched tunables to %(filename)s') %
{"filename": _('FILENAME')}))
print(fmt % ('-S, --sockets=' +
i18n_init()
- short = "a:c:CfgGhiIKlmNp:PQq:r:s:S:t:UvWx"
+ short = "a:c:CfgGhiIKlmNp:PQq:r:R:s:S:t:UvWx"
long = ["cpus=", "affect_children", "filter", "gui", "help",
"isolate", "include", "no_kthreads", "move", "nohz_full",
"show_sockets", "priority=", "show_threads",
"show_irqs", "irqs=",
"save=", "sockets=", "threads=", "no_uthreads",
"version", "what_is", "spread", "cgroup", "config_file_apply=",
- "config_file_list=", "run="]
+ "config_file_list=", "run=", "refresh="]
short += "n"
long.append("show_sockets")
affect_children = False
show_sockets = False
p_waiting_action = False
+ gui_refresh = 2500
filter = True
run_gui = True
+ run_gui = True
+ (op, a) = pick_op(a)
+ gui_refresh=int(a)
+ print("tuna: --refresh %s" % err)
+ sys.exit(2)
print("tuna: --isolate " + _("requires a cpu list!"))
cpus_filtered = filter and cpu_list or []
- app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered)
+ app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered, gui_refresh)
app.run()
pass
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index debdd2d..cc3f0f9 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
self.cpus = sysfs.cpus()
self.cpustats = procfs.cpusstats()
self.socket_frames = {}
vpaned.set_position(int(height))
hpaned.set_position(int(width))
- self.timer = GObject.timeout_add(3000, self.refresh)
+ self.timer = GObject.timeout_add(refresh_time, self.refresh)
self.previous_pid_affinities, \
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 5c3276c..1296beb 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -23,7 +23,7 @@ tuna_glade = None
global tuna_glade
(app, localedir) = ('tuna', '/usr/share/locale')
self.wtree.get_object("vpaned1"),
self.wtree.get_object("hpaned2"),
self.wtree.get_object("cpuview"),
- self.procview, self.irqview, cpus_filtered)
+ self.procview, self.irqview, cpus_filtered, refresh_time)
self.config = Config()
self.check_env()
self.ps.reload_threads()
self.show()
- self.timer = GObject.timeout_add(2500, self.refresh)
+ self.timer = GObject.timeout_add(refresh_time, self.refresh)
self.icon = Gtk.status_icon_new_from_stock(Gtk.STOCK_PREFERENCES)
self.icon.connect("activate", self.on_status_icon_activate)
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the l
John Kacur
2021-03-19 04:07:16 UTC
Permalink
GtkSpinButton need to have a min/max defined, otherwise they will
not be usable. Set to 0-127 (which should be the correct range for
RT Prio according to docs)
---
tuna/gui/irqview.py | 1 +
tuna/gui/procview.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py
index 32aad6f..8ccae76 100755
--- a/tuna/gui/irqview.py
+++ b/tuna/gui/irqview.py
self.window.connect_signals(event_handlers)
self.sched_pri = self.window.get_object("irq_pri_spinbutton")
+ self.sched_pri.set_range(0, 127)
self.sched_policy = self.window.get_object("irq_policy_combobox")
self.affinity = self.window.get_object("irq_affinity_text")
text = self.window.get_object("irq_text")
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index d5685b5..f4ccef5 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
#self.window.signal_autoconnect(event_handlers)
self.window.connect_signals(event_handlers)
self.sched_pri = self.window.get_object("sched_pri_spin")
+ self.sched_pri.set_range(0, 127)
self.sched_policy = self.window.get_object("sched_policy_combo")
self.regex_edit = self.window.get_object("cmdline_regex")
self.affinity = self.window.get_object("affinity_text")
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https://pagure.io
Federico Pellegrin
2021-03-18 05:01:47 UTC
Permalink
Add missing os import as it is using for some scheduling operations.

Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/gui/cpuview.py | 1 +
tuna/gui/util.py | 1 +
2 files changed, 2 insertions(+)

diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index fea8744..debdd2d 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -4,6 +4,7 @@
from functools import reduce

import math
+import os
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
diff --git a/tuna/gui/util.py b/tuna/gui/util.py
index 3c3ff4a..ec368ae 100644
--- a/tuna/gui/util.py
+++ b/tuna/gui/util.py
@@ -1,4 +1,5 @@
import errno
+import os
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GObject
--
2.26.3
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the li
John Kacur
2021-03-19 04:04:02 UTC
Permalink
Post by Federico Pellegrin
Add missing os import as it is using for some scheduling operations.
---
tuna/gui/cpuview.py | 1 +
tuna/gui/util.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index fea8744..debdd2d 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -4,6 +4,7 @@
from functools import reduce
import math
+import os
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
diff --git a/tuna/gui/util.py b/tuna/gui/util.py
index 3c3ff4a..ec368ae 100644
--- a/tuna/gui/util.py
+++ b/tuna/gui/util.py
@@ -1,4 +1,5 @@
import errno
+import os
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GObject
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, r
John Kacur
2021-03-19 04:17:37 UTC
Permalink
When inet_diag module is present an additional command line (-n,
--show_sockets) is added. But a bug (wrong name of list to append)
will make the program fail instead. Fixed "int" to "long" to solve
this.
---
tuna-cmd.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 7b9f6eb..4181004 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
"config_file_list=", "run="]
short += "n"
- int.append("show_sockets")
+ long.append("show_sockets")
opts, args = getopt.getopt(sys.argv[1:], short, long)
usage()
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, r
Federico Pellegrin
2021-03-18 05:01:50 UTC
Permalink
on_irq_policy_combobox_changed was declared in the XML file but
never used, so remove the signal definition

Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/tuna_gui.glade | 1 -
1 file changed, 1 deletion(-)

diff --git a/tuna/tuna_gui.glade b/tuna/tuna_gui.glade
index b892d21..1ddcf12 100644
--- a/tuna/tuna_gui.glade
+++ b/tuna/tuna_gui.glade
@@ -963,7 +963,6 @@
<object class="GtkComboBox" id="irq_policy_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <signal name="changed" handler="on_irq_policy_combobox_changed" swapped="no"/>
</object>
<packing>
<property name="top_attach">1</property>
--
2.26.3
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https://pagure.io/fedora-i
John Kacur
2021-03-19 04:11:04 UTC
Permalink
Post by Federico Pellegrin
on_irq_policy_combobox_changed was declared in the XML file but
never used, so remove the signal definition
---
tuna/tuna_gui.glade | 1 -
1 file changed, 1 deletion(-)
diff --git a/tuna/tuna_gui.glade b/tuna/tuna_gui.glade
index b892d21..1ddcf12 100644
--- a/tuna/tuna_gui.glade
+++ b/tuna/tuna_gui.glade
@@ -963,7 +963,6 @@
<object class="GtkComboBox" id="irq_policy_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <signal name="changed" handler="on_irq_policy_combobox_changed" swapped="no"/>
</object>
<packing>
<property name="top_attach">1</property>
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, repor
Federico Pellegrin
2021-03-18 05:01:49 UTC
Permalink
I'm afraid this was introduced with the passage from tabs to
spacing and broke the logic of the refresh of processes and of
display of the process attributes. Now looks much better.

Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/gui/procview.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index f4ccef5..9cd575c 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -455,6 +455,7 @@ class procview:
continue
# removed and its the last one
break
+ else:
try:
self.set_thread_columns(row, tid, threads[tid])
if "threads" in threads[tid]:
@@ -523,10 +524,10 @@ class procview:
ppid = self.tree_store.get_value(parent, self.COL_PID)
pid_info = self.ps[ppid].threads[pid]

- dialog = process_druid(self.ps, pid, pid_info, self.nr_cpus,
- self.gladefile)
- if dialog.run():
- self.refresh()
+ dialog = process_druid(self.ps, pid, pid_info, self.nr_cpus,
+ self.gladefile)
+ if dialog.run():
+ self.refresh()

def kthreads_view_toggled(self, a):
self.show_kthreads = not self.show_kthreads
--
2.26.3
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https://pagure.io/fedo
John Kacur
2021-03-19 04:09:32 UTC
Permalink
Post by Federico Pellegrin
I'm afraid this was introduced with the passage from tabs to
spacing and broke the logic of the refresh of processes and of
display of the process attributes. Now looks much better.
---
tuna/gui/procview.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index f4ccef5..9cd575c 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
continue
# removed and its the last one
break
self.set_thread_columns(row, tid, threads[tid])
ppid = self.tree_store.get_value(parent, self.COL_PID)
pid_info = self.ps[ppid].threads[pid]
- dialog = process_druid(self.ps, pid, pid_info, self.nr_cpus,
- self.gladefile)
- self.refresh()
+ dialog = process_druid(self.ps, pid, pid_info, self.nr_cpus,
+ self.gladefile)
+ self.refresh()
self.show_kthreads = not self.show_kthreads
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https://pagure.

John Kacur
2021-03-19 04:12:13 UTC
Permalink
Post by Federico Pellegrin
Fix another identation error introduced in tabs->spaces
transition
---
tuna/gui/procview.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index 9cd575c..bbe14b6 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
# removed and now row is the next one
continue
# removed and its the last one
- break
+ break
self.set_thread_columns(row, tid, threads[tid])
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https://pagure.io/fedora-in
Federico Pellegrin
2021-03-18 05:01:52 UTC
Permalink
-) The used signal Gdk.INPUT_READ is not valid, replaced therefore
with GObject.IO_IN. This restores the functionality.
-) Added a try/catch to prevent exceptions being thrown for processes
that go away fast (they are there when event arrives but are already
gone by the time the UI processing code is going through them)

Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/gui/procview.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index bbe14b6..199a4f1 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -329,10 +329,14 @@ class procview:
except: # short lived thread
pass
else:
- try:
- self.ps.processes[event.pid].threads.processes[event.tid] = procfs.process(event.tid)
- except AttributeError:
- self.ps.processes[event.pid].threads = procfs.pidstats("/proc/%d/task/" % event.pid)
+ if event.pid in self.ps.processes:
+ try:
+ self.ps.processes[event.pid].threads.processes[event.tid] = procfs.process(event.tid)
+ except (AttributeError, KeyError):
+ try:
+ self.ps.processes[event.pid].threads = procfs.pidstats("/proc/%d/task/" % event.pid)
+ except:
+ pass
elif event.type == perf.RECORD_EXIT:
del self.ps[int(event.tid)]
elif event.type == perf.RECORD_SAMPLE:
@@ -356,7 +360,7 @@ class procview:
self.evlist.mmap()
self.pollfd = self.evlist.get_pollfd()
for f in self.pollfd:
- GObject.io_add_watch(f, Gdk.INPUT_READ, self.perf_process_events)
+ GObject.io_add_watch(f, GObject.IO_IN, self.perf_process_events)
self.perf_counter = {}

def on_query_tooltip(self, treeview, x, y, keyboard_mode, tooltip):
--
2.26.3
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https://pagure.io/fedora-in
John Kacur
2021-03-19 04:14:01 UTC
Permalink
Post by Federico Pellegrin
-) The used signal Gdk.INPUT_READ is not valid, replaced therefore
with GObject.IO_IN. This restores the functionality.
-) Added a try/catch to prevent exceptions being thrown for processes
that go away fast (they are there when event arrives but are already
gone by the time the UI processing code is going through them)
---
tuna/gui/procview.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index bbe14b6..199a4f1 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
except: # short lived thread
pass
- self.ps.processes[event.pid].threads.processes[event.tid] = procfs.process(event.tid)
- self.ps.processes[event.pid].threads = procfs.pidstats("/proc/%d/task/" % event.pid)
+ self.ps.processes[event.pid].threads.processes[event.tid] = procfs.process(event.tid)
+ self.ps.processes[event.pid].threads = procfs.pidstats("/proc/%d/task/" % event.pid)
+ pass
del self.ps[int(event.tid)]
self.evlist.mmap()
self.pollfd = self.evlist.get_pollfd()
- GObject.io_add_watch(f, Gdk.INPUT_READ, self.perf_process_events)
+ GObject.io_add_watch(f, GObject.IO_IN, self.perf_process_events)
self.perf_counter = {}
--
2.26.3
Signed-off-by: John Kacur <***@redhat.com>
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report it: https:
Federico Pellegrin
2021-03-18 05:01:55 UTC
Permalink
Add command line option (-d, --disable_perf) to explicitly disable
usage of perf facility for procview. Previously if the perf attach
succeeds, it will always be used. Now if -d is passed it will be not
tried.

Default behaviour is kept as before.

Rationale for adding this option:
-) On very loaded systems (mostly with processes / threads varing very
often) perf may end up being triggered all the time, causing a
continuous widget refresh which will cause 100% CPU usage of tuna
and therefore a very sluggish and hardly usable GUI
-) As it is now (maybe we could change?) perf doesn't deliver the
same data as polling /proc does, for example perf will not update
context switch data. So having the possibility for the user to go
anyway for acquiring data from /proc (as ugly as polling is) to have
also that data displayed, if needed, sounds like a reasonable
approach.

Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna-cmd.py | 12 +++++++++---
tuna/gui/procview.py | 11 ++++++-----
tuna/tuna_gui.py | 4 ++--
3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/tuna-cmd.py b/tuna-cmd.py
index c27abd1..ecfa15e 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -59,6 +59,8 @@ def usage():
{"cpulist": _('CPU-LIST')}))
print(fmt % ('-C, --affect_children',
_('Operation will affect children threads')))
+ print(fmt % ('-d, --disable_perf',
+ _('Explicitly disable usage of perf in GUI for process view')))
print(fmt % ('-f, --filter',
_('Display filter the selected entities')))
print(fmt % ('-i, --isolate', _('Move all threads away from %(cpulist)s') %
@@ -495,14 +497,14 @@ def main():

i18n_init()
try:
- short = "a:c:CfgGhiIKlmNp:PQq:r:R:s:S:t:UvWx"
+ short = "a:c:dCfgGhiIKlmNp:PQq:r:R:s:S:t:UvWx"
long = ["cpus=", "affect_children", "filter", "gui", "help",
"isolate", "include", "no_kthreads", "move", "nohz_full",
"show_sockets", "priority=", "show_threads",
"show_irqs", "irqs=",
"save=", "sockets=", "threads=", "no_uthreads",
"version", "what_is", "spread", "cgroup", "config_file_apply=",
- "config_file_list=", "run=", "refresh="]
+ "config_file_list=", "run=", "refresh=", "disable_perf"]
if have_inet_diag:
short += "n"
long.append("show_sockets")
@@ -528,6 +530,7 @@ def main():
show_sockets = False
p_waiting_action = False
gui_refresh = 2500
+ disable_perf = False

for o, a in opts:
if o in ("-h", "--help"):
@@ -588,6 +591,9 @@ def main():
except Exception as err:
print("tuna: --refresh %s" % err)
sys.exit(2)
+ elif o in ("-d", "--disable_perf"):
+ run_gui = True
+ disable_perf = True
elif o in ("-i", "--isolate"):
if not cpu_list:
print("tuna: --isolate " + _("requires a cpu list!"))
@@ -747,7 +753,7 @@ def main():

try:
cpus_filtered = filter and cpu_list or []
- app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered, gui_refresh)
+ app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered, gui_refresh, disable_perf)
app.run()
except KeyboardInterrupt:
pass
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index 199a4f1..c5b5f1f 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -214,17 +214,18 @@ class procview:
gui.list_store_column(_("Command Line"), GObject.TYPE_STRING))

def __init__(self, treeview, ps, show_kthreads, show_uthreads,
- cpus_filtered, gladefile):
+ cpus_filtered, gladefile, disable_perf):
self.ps = ps
self.treeview = treeview
self.nr_cpus = procfs.cpuinfo().nr_cpus
self.gladefile = gladefile

self.evlist = None
- try:
- self.perf_init()
- except: # No perf, poll /proc baby, poll
- pass
+ if not disable_perf:
+ try:
+ self.perf_init()
+ except: # No perf, poll /proc baby, poll
+ pass

if "voluntary_ctxt_switches" not in ps[1]["status"]:
self.nr_columns = 5
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 1296beb..83af063 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -23,7 +23,7 @@ tuna_glade = None

class main_gui:

- def __init__(self, show_kthreads=True, show_uthreads=True, cpus_filtered=[], refresh_time=2500):
+ def __init__(self, show_kthreads=True, show_uthreads=True, cpus_filtered=[], refresh_time=2500, disable_perf=False):
global tuna_glade

(app, localedir) = ('tuna', '/usr/share/locale')
@@ -46,7 +46,7 @@ class main_gui:
self.procview = procview(
self.wtree.get_object("processlist"),
self.ps, show_kthreads, show_uthreads,
- cpus_filtered, tuna_glade)
+ cpus_filtered, tuna_glade, disable_perf)
self.irqview = irqview(
self.wtree.get_object("irqlist"),
self.irqs, self.ps, cpus_filtered,
--
2.26.3
_______________________________________________
tuna-devel mailing list -- tuna-***@lists.fedorahosted.org
To unsubscribe send an email to tuna-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/tuna-***@lists.fedorahosted.org
Do not reply to spam on the list, report
Loading...