[PATCH] procview: limit refresh rate in perf mode to refresh_time
by Federico Pellegrin
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 <fede(a)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 c224e4b..dc2e94e 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
if not disable_perf:
@@ -347,7 +348,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):
@@ -426,9 +427,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 83af063..f1f2caa 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.26.3
2 years, 6 months
[PATCH 0/9] Gtk 3.0 fixes and two new command line options
by Federico Pellegrin
Hello,
This is another bunch of fixes for Gtk 3.0 / Python 3 porting that I found
during further feedback from users at my org. They are made against the
patches previously delivered, so please do check the other ones before
(the 3 patches from Monday 15th March).
They contain some fixes to GtkSpins (that need to have a range), some
missing os imports, wrong signal for the perf feature and a few logic
errors that I tracked to having been introduced with the tabs/spaces
cleanup.
The last two patches are not fixes but improvements to be able to fiddle
a few GUI params via command line that were previously hardcoded. Namely
one is setting the refresh timeout (before hardcoded to 2.5s) and to
disable usage of perf (before if perf was found on the system it would
always be used with no possibility to disable).
A rationale on the addition of these two is given in the two specific
patches.
Hope the contribution looks fine, users at my org are starting to be
able to use it again effectively on CentOS 8 as they were using it on 7
before the big Gtk/Python version jump.
Cheers,
Federico
Federico Pellegrin (9):
cpuview and util: add missing os import
irqview, procview: spins in Gtk 3.0 need to have range defined
procview: fix logic of refresh and attributes dialog display
tuna_gui: remove unused signal to prevent errors
procview: fix another identation error
procview: fix perf watch and add handler for errors
tuna-cmd: fix command line when inet_diag is present
tuna_gui: add command line option to customize GUI refresh time
tuna_gui: add command line option to explicitly disable perf usage
tuna-cmd.py | 24 ++++++++++++++++++++----
tuna/gui/cpuview.py | 5 +++--
tuna/gui/irqview.py | 1 +
tuna/gui/procview.py | 37 ++++++++++++++++++++++---------------
tuna/gui/util.py | 1 +
tuna/tuna_gui.glade | 1 -
tuna/tuna_gui.py | 8 ++++----
7 files changed, 51 insertions(+), 26 deletions(-)
--
2.26.3
2 years, 8 months
[PATCH] procview: fix thread refresh when using polling mode
by Federico Pellegrin
When in polling mode the GUI seems not to be refreshing new threads
that are added to a process. If the GUI is totally redrawn (ie.
stop and start refreshing) then it will be displayed, so the
problem comes out just when an already drawn process gets new
threads.
This is fixed by making sure that for both new and already existing
processes the threads information is refreshed.
This bug was introduced with tabs->space transition.
Signed-off-by: Federico Pellegrin <fede(a)evolware.org>
---
tuna/gui/procview.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index c5b5f1f..c224e4b 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -467,8 +467,8 @@ class procview:
children = threads[tid]["threads"]
else:
children = {}
- child_row = self.tree_store.iter_children(row)
- self.update_rows(children, child_row, row)
+ child_row = self.tree_store.iter_children(row)
+ self.update_rows(children, child_row, row)
except: # thread doesn't exists anymore
if self.tree_store.remove(row):
# removed and now row is the next one
--
2.26.3
2 years, 8 months
[PATCH] tuna: Correct allowable ranges in irqview and in procview
by John Kacur
Federico Pellegrin pointed out that spins in Gtk 3.0
need to have defined ranges.
This is a little correction to keep that range from
0 (for SCHED_OTHER)
to 99 for SCHED_FIFO and SCHED_RR
Reported-by: Guy Streeter <streeter(a)fedoraproject.org>
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
tuna/gui/irqview.py | 2 +-
tuna/gui/procview.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py
index 8ccae76fa5a1..35fc3fd0b0ca 100755
--- a/tuna/gui/irqview.py
+++ b/tuna/gui/irqview.py
@@ -34,7 +34,7 @@ class irq_druid:
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_pri.set_range(0, 99)
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 199a4f1efd85..7eb347f9d238 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -46,7 +46,7 @@ class process_druid:
#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_pri.set_range(0, 99)
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
2 years, 8 months
[PATCH] tuna: tuna add gui refresh option to the manpage
by John Kacur
- Add -R, --refresh option to the manpage
- Also move the -s, --save option after it
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
docs/tuna.8 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/docs/tuna.8 b/docs/tuna.8
index 81a42dd114a5..dd69ec64d5d3 100644
--- a/docs/tuna.8
+++ b/docs/tuna.8
@@ -40,12 +40,15 @@ Set thread scheduler tunables: POLICY and RTPRIO. POLICY is one of OTHER, FIFO,
\fB\-P\fR, \fB\-\-show_threads\fR
Show thread list.
.TP
-\fB\-s\fR, \fB\-\-save\fR=\fIFILENAME\fR
-Save kthreads sched tunables to FILENAME.
-.TP
\fB\-r\fR, \fB\-\-run\fR=\fI"COMMAND"\fR
Run the COMMAND. If arguments are passed, the entire command line must be provided inside "quotes". Modifiers \fB-c\fR and \fB-p\fR can be used to set the affinity and scheduler tunables of the given COMMAND. The arg[0] (i.e. the command) will be set in THREAD\-LIST. Likewise the \fB-t\fR, the COMMAND accepts the prefix \fB+\fR and \fB-\fR as wildcards in order to be appended or removed from THREAD\-LIST, respectively.
.TP
+\fB\-R\fR, \fB\-\-refresh\fR=\fIMSEC\fR
+Refresh the GUI every MSEC milliseconds
+.TP
+\fB\-s\fR, \fB\-\-save\fR=\fIFILENAME\fR
+Save kthreads sched tunables to FILENAME.
+.TP
\fB\-v\fR, \fB\-\-version\fR
Show version
.TP
--
2.26.3
2 years, 8 months
[PATCH 0/3] Additional improvements to Gtk 3.0 compatibility
by Federico Pellegrin
Hello,
A few more patches wrt Gtk 3.0 compatibility. A few more improvements on
base tuna GUI after testing with machines with more cores (visual
improvements and fixes on sorting of CPU labels) and fixed also Gtk 3.0
compatibility for the oscilloscope tool.
Hope the changes look good!
Cheers,
Federico
Federico Pellegrin (3):
cpuview: improve display of CPUs/Sockets for every CPU/socket number
sysfs: correct and improve sorting
oscilloscope: complete porting to Gtk 3.0
oscilloscope-cmd.py | 2 +-
tuna/gui/cpuview.py | 4 ++--
tuna/oscilloscope.py | 41 +++++++++++++++++++++++------------------
tuna/sysfs.py | 10 ++++++----
tuna/tuna_gui.glade | 2 +-
5 files changed, 33 insertions(+), 26 deletions(-)
--
2.26.2
2 years, 8 months
[PATCH v2 0/7] tuna gui porting to Gtk 3.0
by Federico Pellegrin
Hi all,
I've made some effort to make the tuna gui work properly with Gtk 3.0
(tested using CentOS 8.x) and additionally included also some fixes that
are related to the porting to Python 3.
As far as I can see now the situation is much better and the UI is pretty
much usable. Probably some other details may come out (I will keep fixing
while finding other details during usage) but I think applying those could
already make the tool very well usable now.
Hope they are fine and can be merged!
Thanks!
Federico
Federico Pellegrin (7):
tuna: multiple fixes for Gtk-3.0 UI interface
config: make configuration files consistently text only
profileview: disable cursor_changed handler when manipulating list
cpuview: a few more improvements for Gtk 3.0
tuna_gui: handle destroy handler to prevent error messages on startup
tuna: fix mnemonic accelerators for Gtk 3.0
profileview: fix text entry retrieval
tuna/config.py | 4 ++--
tuna/gui/commonview.py | 13 +++++++------
tuna/gui/cpuview.py | 29 +++++++++++++----------------
tuna/gui/irqview.py | 11 ++++++-----
tuna/gui/procview.py | 24 ++++++++++++------------
tuna/gui/profileview.py | 19 +++++++++++++------
tuna/tuna.py | 2 +-
tuna/tuna_gui.glade | 7 +++----
tuna/tuna_gui.py | 4 +++-
9 files changed, 60 insertions(+), 53 deletions(-)
--
2.26.2
2 years, 8 months
[PATCH 1/2] tuna: multiple fixes for Gtk-3.0 UI interface
by Federico Pellegrin
Multiple fixes to make tuna compatible with Gtk-3.0 library. The UI
should be now mostly working, some warnings are still present and
may be still addressed in the future.
Signed-off-by: Federico Pellegrin <fede(a)evolware.org>
---
tuna/gui/commonview.py | 13 +++++++------
tuna/gui/cpuview.py | 15 ++++++---------
tuna/gui/irqview.py | 5 +++--
tuna/gui/procview.py | 6 +++---
tuna/gui/profileview.py | 8 ++++----
tuna/tuna.py | 2 +-
tuna/tuna_gui.glade | 6 +++---
tuna/tuna_gui.py | 2 +-
8 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/tuna/gui/commonview.py b/tuna/gui/commonview.py
index 59ca244..cc8f913 100644
--- a/tuna/gui/commonview.py
+++ b/tuna/gui/commonview.py
@@ -13,9 +13,9 @@ class commonview:
def cleanUp(self):
for value in self.contentTable.get_children():
- if value.get_name() == "controls":
+ if Gtk.Buildable.get_name(value) == "controls":
self.ctrl = value
- if value.get_name() == "profileSelectorBox":
+ if Gtk.Buildable.get_name(value) == "profileSelectorBox":
self.selector = value
self.contentTable.remove(value)
@@ -79,12 +79,13 @@ class commonview:
# scale control
frameContent[catCntr]['texts'][contentCntr] = Gtk.HScale()
frameContent[catCntr]['texts'][contentCntr].set_range(self.config.ctlGuiParams[catCntr][val][0], self.config.ctlGuiParams[catCntr][val][1])
- frameContent[catCntr]['texts'][contentCntr].set_update_policy(Gtk.UPDATE_CONTINUOUS)
+ #frameContent[catCntr]['texts'][contentCntr].set_update_policy(Gtk.UPDATE_CONTINUOUS)
frameContent[catCntr]['texts'][contentCntr].set_value(int(self.config.ctlParams[catCntr][val]))
frameContent[catCntr]['texts'][contentCntr].set_digits(0)
else:
# input field
- frameContent[catCntr]['texts'][contentCntr] = Gtk.Entry(256)
+ frameContent[catCntr]['texts'][contentCntr] = Gtk.Entry()
+ frameContent[catCntr]['texts'][contentCntr].set_max_length(256)
frameContent[catCntr]['texts'][contentCntr].set_alignment(0)
frameContent[catCntr]['texts'][contentCntr].set_text(self.config.ctlParams[catCntr][val])
frameContent[catCntr]['texts'][contentCntr].connect("button-release-event", self.checkStar, catCntr, contentCntr, val, frameContent[catCntr]['labels'][contentCntr])
@@ -105,7 +106,7 @@ class commonview:
self.ret = {}
self.property_cntr = 0
for value in self.contentTable.get_children():
- if value.get_name() == "controls" or value.get_name() == "profileSelectorBox":
+ if Gtk.Buildable.get_name(value) == "controls" or Gtk.Buildable.get_name(value) == "profileSelectorBox":
continue
self.ret[value.get_label()] = {}
for content in value:
@@ -128,7 +129,7 @@ class commonview:
self.ret = {}
self.property_cntr = 0
for value in self.contentTable.get_children():
- if value.get_name() == "controls" or value.get_name() == "profileSelectorBox":
+ if Gtk.Buildable.get_name(value) == "controls" or Gtk.Buildable.get_name(value) == "profileSelectorBox":
continue
self.ret[value.get_label()] = {}
for content in value:
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index ec19149..7f00bf5 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -47,10 +47,9 @@ class cpu_socket_frame(Gtk.Frame):
def __init__(self, socket, cpus, creator):
+ GObject.GObject.__init__(self)
if creator.nr_sockets > 1:
- GObject.GObject.__init__(self, _("Socket %s") % socket)
- else:
- GObject.GObject.__init__(self)
+ self.set_label(_("Socket %s") % socket)
self.socket = socket
self.cpus = cpus
@@ -268,7 +267,7 @@ class cpuview:
columns = math.ceil(math.sqrt(self.nr_sockets))
rows = math.ceil(self.nr_sockets / columns)
box = Gtk.HBox()
- vbox.pack_start(box, True, True)
+ vbox.pack_start(box, True, True, 0)
else:
box = vbox
@@ -281,7 +280,7 @@ class cpuview:
if self.nr_sockets > 1:
if column == columns:
box = Gtk.HBox()
- vbox.pack_start(box, True, True)
+ vbox.pack_start(box, True, True, 0)
column = 1
else:
column += 1
@@ -298,10 +297,8 @@ class cpuview:
req = frame.get_preferred_size()
# FIXME: what is the slack we have
# to add to every row and column?
- #width = req[0] + 16
- width = 16
- #height = req[1] + 20
- height = 20
+ width = req.minimum_size.width + 16
+ height = req.minimum_size.height + 40
if self.nr_sockets > 1:
width *= columns
height *= rows
diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py
index ea5c2f5..fddb977 100755
--- a/tuna/gui/irqview.py
+++ b/tuna/gui/irqview.py
@@ -20,7 +20,8 @@ class irq_druid:
self.irqs = irqs
self.ps = ps
self.irq = irq
- self.window = Gtk.Builder(gladefile)
+ self.window = Gtk.Builder()
+ self.window.add_objects_from_file(gladefile, ("set_irq_attributes", "tuna"))
#self.window = Gtk.glade.XML(gladefile, "set_irq_attributes", "tuna")
self.dialog = self.window.get_object("set_irq_attributes")
pixbuf = self.dialog.render_icon(Gtk.STOCK_PREFERENCES,
@@ -322,7 +323,7 @@ class irqview:
setattr.show()
refresh.show()
- menu.popup(None, None, None, event.button, event.time)
+ menu.popup(None, None, None, event, event.button, event.time)
def toggle_mask_cpu(self, cpu, enabled):
if not enabled:
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index f897fdd..d2abc13 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -1,4 +1,5 @@
import re
+import os
import tuna.tuna_sched as tuna_sched
import gi
@@ -29,7 +30,7 @@ class process_druid:
self.pid_info = pid_info
self.nr_cpus = nr_cpus
self.window = Gtk.Builder()
- self.window.add_from_file(gladefile)
+ self.window.add_objects_from_file(gladefile, ("set_process_attributes", "tuna"))
# self.window = Gtk.glade.XML(gladefile, "set_process_attributes", "tuna")
self.dialog = self.window.get_object("set_process_attributes")
pixbuf = self.dialog.render_icon(Gtk.STOCK_PREFERENCES,
@@ -410,7 +411,6 @@ class procview:
pass
new_value[self.COL_CMDLINE] = procfs.process_cmdline(thread_info)
-
gui.set_store_columns(self.tree_store, iter, new_value)
def show(self, force_refresh=False):
@@ -671,7 +671,7 @@ class procview:
uthreads.show()
help.show()
- menu.popup(None, None, None, event.button, event.time)
+ menu.popup(None, None, None, event, event.button, event.time)
def toggle_mask_cpu(self, cpu, enabled):
if not enabled:
diff --git a/tuna/gui/profileview.py b/tuna/gui/profileview.py
index 4f68bf4..c65f92e 100644
--- a/tuna/gui/profileview.py
+++ b/tuna/gui/profileview.py
@@ -87,7 +87,7 @@ class profileview:
temp = f.read()
f.close()
self.profileContentBuffer = self.profileContent.get_buffer()
- buff = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter())
+ buff = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter(), False)
if temp != buff:
dialog = Gtk.MessageDialog(None, \
Gtk.DialogFlags.MODAL \
@@ -114,14 +114,14 @@ class profileview:
def on_SaveButton_clicked(self, widget):
try:
self.profileContentBuffer = self.profileContent.get_buffer()
- self.config.cache = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter())
+ self.config.cache = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter(), False)
self.config.cacheToFile(self.config.cacheFileName)
except IOError as e:
self.show_mbox_warning(_("Cannot write to config file: %s") % (self.config.cacheFileName))
def on_UpdateButton_clicked(self, widget):
self.profileContentBuffer = self.profileContent.get_buffer()
- self.temp = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter())
+ self.temp = self.profileContentBuffer.get_text(self.profileContentBuffer.get_start_iter(), self.profileContentBuffer.get_end_iter(), False)
try:
if not self.config.loadDirect(self.temp):
self.commonview.updateCommonView()
@@ -215,7 +215,7 @@ class profileview:
context.append(item)
context.show_all()
- context.popup(None, None, None, event.button, time)
+ context.popup(None, None, None, event, event.button, time)
return True
def get_current_tree_selection(self):
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 614a825..1e39222 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -530,7 +530,7 @@ def thread_filtered(tid, cpus_filtered, show_kthreads, show_uthreads):
return False
raise err
- if set(cpus_filtered + affinity) == set(cpus_filtered):
+ if set(cpus_filtered + list(affinity)) == set(cpus_filtered):
return True
if not (show_kthreads and show_uthreads):
diff --git a/tuna/tuna_gui.glade b/tuna/tuna_gui.glade
index 2b572ca..65b38b1 100644
--- a/tuna/tuna_gui.glade
+++ b/tuna/tuna_gui.glade
@@ -129,7 +129,7 @@
</child>
</object>
</child>
- <child>
+ <child type="tab">
<object class="GtkLabel" id="monitor_tab_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -455,7 +455,7 @@
<property name="position">1</property>
</packing>
</child>
- <child>
+ <child type="tab">
<object class="GtkLabel" id="common_tab_l">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -757,7 +757,7 @@
<property name="position">2</property>
</packing>
</child>
- <child>
+ <child type="tab">
<object class="GtkLabel" id="profile_tab_l">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 2360f53..6c2e05d 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -37,7 +37,7 @@ class main_gui:
if os.access(tuna_glade, os.F_OK):
break
self.wtree = Gtk.Builder()
- self.wtree.add_from_file(tuna_glade)
+ self.wtree.add_objects_from_file(tuna_glade, ("mainbig_window", "tuna"))
#self.wtree = Gtk.glade.XML(tuna_glade, "mainbig_window", "tuna")
self.ps = procfs.pidstats()
self.irqs = procfs.interrupts()
--
2.26.2
2 years, 8 months
[PATCH] tuna: Fix tuna --include option breakage
by John Kacur
The change to remove the dependency on python-schedutils
broke the --include function.
get_affinity(pid) from python-schedutils returned a list
os.sched_getaffinity(pid) returns a set
In many cases they can be interchanged, but not with the '+' operation
Fix this by changing affinity to a list before concatenation
Reported-by: Mark Simmons <msimmons(a)redhat.com>
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
tuna/tuna.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tuna/tuna.py b/tuna/tuna.py
index e5122dac1081..614a8250b054 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -431,9 +431,9 @@ def include_cpus(cpus, nr_cpus):
if err.args[0] == errno.ESRCH:
continue
raise err
- if set(affinity).intersection(set(cpus)) != set(cpus):
+ if affinity.intersection(set(cpus)) != set(cpus):
previous_pid_affinities[pid] = copy.copy(affinity)
- affinity = list(set(affinity + cpus))
+ affinity = list(affinity) + cpus
try:
os.sched_setaffinity(pid, affinity)
except OSError as err:
@@ -453,9 +453,9 @@ def include_cpus(cpus, nr_cpus):
if err.args[0] == errno.ESRCH:
continue
raise err
- if set(affinity).intersection(set(cpus)) != set(cpus):
+ if affinity.intersection(set(cpus)) != set(cpus):
previous_pid_affinities[tid] = copy.copy(affinity)
- affinity = list(set(affinity + cpus))
+ affinity = list(affinity) + cpus
try:
os.sched_setaffinity(tid, affinity)
except OSError as err:
--
2.26.2
2 years, 8 months