summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-08-05 09:43:43 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-08-05 10:08:13 -0300
commitc7f561f5acbabb095c22709a1878e484e1134ae2 (patch)
tree26239655a1a138399a4797482bf8a6391928f0d6
parent7adf3d82861b8c84db5ddfdf794fc26ba937802f (diff)
downloadpython-linux-procfs-c7f561f5acbabb095c22709a1878e484e1134ae2.tar.gz
interrupts: Fix parsing of users field
It is the last field, in CSV format, and that was what was being parsed, but in a convoluted way, fixing it also simplified it. Buggy: [root@zoo ~]# tuna -Q # users affinity 0 2-edge timer 0,1,2,3 8 8-edge rtc0 0,1,2,3 9 9-fasteoi acpi 0,1,2,3 17 17-fasteoi brcmsmac 0,1,2,3 22 22-fasteoi ehci_hcd:usb4 0,1,2,3 23 23-fasteoi ehci_hcd:usb3 0,1,2,3 26 2146304-edge pciehp 0,1,2,3 27 2162688-edge pciehp 0,1,2,3 28 2179072-edge pciehp 0,1,2,3 29 2195456-edge pciehp 0,1,2,3 30 512000-edge 0000:00:1f.2 0,1,2,3 31 327680-edge xhci_hcd 0,1,2,3 32 32768-edge i915 0,1,2,3 33 360448-edge mei_me 0,1,2,3 34 2621440-edge thunderbolt 0,1,2,3 35 442368-edge snd_hda_intel 0,1,2,3 [root@zoo ~]# Fixed: # tuna -Q # users affinity 0 timer 0,1,2,3 8 rtc0 0,1,2,3 9 acpi 0,1,2,3 17 brcmsmac 0,1,2,3 22 ehci_hcd:usb4 0,1,2,3 23 ehci_hcd:usb3 0,1,2,3 26 pciehp 0,1,2,3 27 pciehp 0,1,2,3 28 pciehp 0,1,2,3 29 pciehp 0,1,2,3 30 0000:00:1f.2 0,1,2,3 31 xhci_hcd 0,1,2,3 32 i915 0,1,2,3 33 mei_me 0,1,2,3 34 thunderbolt 0,1,2,3 35 snd_hda_intel 0,1,2,3 # Reported-by: Flavio Leitner <fbl@redhat.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1245677 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-xprocfs/procfs.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py
index 0ed55af..d5717de 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -410,7 +410,7 @@ class interrupts:
dict["type"] = fields[self.nr_cpus]
# look if there are users (interrupts 3 and 4 haven't)
if nr_fields > self.nr_cpus + 1:
- dict["users"] = [a.strip() for a in line[line.index(fields[self.nr_cpus + 1]):].split(',')]
+ dict["users"] = [a.strip() for a in fields[nr_fields - 1].split(',')]
else:
dict["users"] = []
return dict