Federico Pellegrin
2021-05-14 06:50:53 UTC
When in perf mode (so not polling) previously the GUI would be
refreshed at the arrival of any single perf event. This may mean
that it would get refreshed all the time especially on quite loaded
systems, causing very high CPU load and unuseable GUI.
The patch limits the refresh to the minimum refresh_time (already
used for polling and configurable via -R command line by the user)
to prevent such cases. If no events arrive, the GUI will still not
be refreshed at all as before.
Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/gui/procview.py | 14 ++++++++++----
tuna/tuna_gui.py | 2 +-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index fce0b52..28a73a3 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -219,6 +219,7 @@ class procview:
self.treeview = treeview
self.nr_cpus = procfs.cpuinfo().nr_cpus
self.gladefile = gladefile
+ self.evlist_added = True
self.evlist = None
try:
@@ -346,7 +347,7 @@ class procview:
else:
self.perf_counter[tid] = event.sample_period
- self.show()
+ self.evlist_added = True # Mark that event arrived, so next periodic show() will refresh GUI
return True
def perf_init(self):
@@ -425,9 +426,14 @@ class procview:
# create the rows.
if not self.refreshing and not force_refresh:
return
- row = self.tree_store.get_iter_first()
- self.update_rows(self.ps, row, None)
- self.treeview.show_all()
+
+ # If using perf only refresh if we saw at least a new event since last refresh
+ if not self.evlist or self.evlist_added:
+ self.evlist_added = None
+
+ row = self.tree_store.get_iter_first()
+ self.update_rows(self.ps, row, None)
+ self.treeview.show_all()
def update_rows(self, threads, row, parent_row):
new_tids = list(threads.keys())
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 1296beb..ac50d93 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -146,7 +146,7 @@ class main_gui:
if not self.procview.evlist: # Poll, as we don't have perf
self.ps.reload()
self.ps.reload_threads()
- self.procview.show()
+ self.procview.show()
self.irqview.refresh()
return True
--
2.31.1
_______________________________________________
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
refreshed at the arrival of any single perf event. This may mean
that it would get refreshed all the time especially on quite loaded
systems, causing very high CPU load and unuseable GUI.
The patch limits the refresh to the minimum refresh_time (already
used for polling and configurable via -R command line by the user)
to prevent such cases. If no events arrive, the GUI will still not
be refreshed at all as before.
Signed-off-by: Federico Pellegrin <***@evolware.org>
---
tuna/gui/procview.py | 14 ++++++++++----
tuna/tuna_gui.py | 2 +-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index fce0b52..28a73a3 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -219,6 +219,7 @@ class procview:
self.treeview = treeview
self.nr_cpus = procfs.cpuinfo().nr_cpus
self.gladefile = gladefile
+ self.evlist_added = True
self.evlist = None
try:
@@ -346,7 +347,7 @@ class procview:
else:
self.perf_counter[tid] = event.sample_period
- self.show()
+ self.evlist_added = True # Mark that event arrived, so next periodic show() will refresh GUI
return True
def perf_init(self):
@@ -425,9 +426,14 @@ class procview:
# create the rows.
if not self.refreshing and not force_refresh:
return
- row = self.tree_store.get_iter_first()
- self.update_rows(self.ps, row, None)
- self.treeview.show_all()
+
+ # If using perf only refresh if we saw at least a new event since last refresh
+ if not self.evlist or self.evlist_added:
+ self.evlist_added = None
+
+ row = self.tree_store.get_iter_first()
+ self.update_rows(self.ps, row, None)
+ self.treeview.show_all()
def update_rows(self, threads, row, parent_row):
new_tids = list(threads.keys())
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 1296beb..ac50d93 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -146,7 +146,7 @@ class main_gui:
if not self.procview.evlist: # Poll, as we don't have perf
self.ps.reload()
self.ps.reload_threads()
- self.procview.show()
+ self.procview.show()
self.irqview.refresh()
return True
--
2.31.1
_______________________________________________
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