summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Pellegrin <fede@evolware.org>2021-05-14 08:50:54 +0200
committerJohn Kacur <jkacur@redhat.com>2021-05-22 00:27:23 -0400
commitebef6387d63d10344862f1aca95559f6af7b8d47 (patch)
tree74f2886ab92a0dcdeaa161415f70da56b82087f3
parentaefdc47daffc2a65f6a145ec638ecb92ec6a5da5 (diff)
downloadtuna-ebef6387d63d10344862f1aca95559f6af7b8d47.tar.gz
tuna_gui: add command line option to explicitly disable perf usage
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. This can be in case partially alleviated by reducing the refresh time via the recently added refresh time option. -) 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 <fede@evolware.org> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--docs/tuna.83
-rwxr-xr-xtuna-cmd.py12
-rwxr-xr-xtuna/gui/procview.py11
-rwxr-xr-xtuna/tuna_gui.py4
4 files changed, 20 insertions, 10 deletions
diff --git a/docs/tuna.8 b/docs/tuna.8
index dd69ec6..b6431be 100644
--- a/docs/tuna.8
+++ b/docs/tuna.8
@@ -65,6 +65,9 @@ CPU\-LIST affected by commands. Requires a CPU number or a comma-separated list
\fB\-C\fR, \fB\-\-affect_children\fR
Operation will affect children threads.
.TP
+\fB\-d\fR, \fB\-\-disable_perf\fR
+Explicitly disable usage of perf in GUI for process view
+.TP
\fB\-f\fR, \fB\-\-filter\fR
Disable display of selected CPUs in \fB--gui\fR. Requires \fB-c\R.
.TP
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 28a73a3..440a289 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -214,7 +214,7 @@ 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
@@ -222,10 +222,11 @@ class procview:
self.evlist_added = True
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 ac50d93..f1f2caa 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,