libpfm/libpfm-python3.patch
Tomáš Chvátal cd47cfeda8 - Add patch to build and work with python3:
* libpfm-python3.patch
- Build the python parts using singlespec macros to allow switching
  as needed

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libpfm?expand=0&rev=28
2018-01-18 12:04:08 +00:00

64 lines
2.3 KiB
Diff

Index: libpfm-4.9.0/python/src/pmu.py
===================================================================
--- libpfm-4.9.0.orig/python/src/pmu.py
+++ libpfm-4.9.0/python/src/pmu.py
@@ -26,7 +26,7 @@ from perfmon import *
def public_members(self):
s = "{ "
- for k, v in self.__dict__.iteritems():
+ for k, v in self.__dict__.items():
if not k[0] == '_':
s += "%s : %s, " % (k, v)
s += " }"
@@ -94,8 +94,8 @@ if __name__ == '__main__':
for pmu in s.pmus:
info = pmu.info
if info.flags.is_present:
- print info.name, info.size, info.nevents
+ print(info.name, info.size, info.nevents)
for e in pmu.events():
- print e.info.name, e.info.code
+ print(e.info.name, e.info.code)
for a in e.attrs():
- print '\t\t', a.name, a.code
+ print('\t\t', a.name, a.code)
Index: libpfm-4.9.0/python/sys.py
===================================================================
--- libpfm-4.9.0.orig/python/sys.py
+++ libpfm-4.9.0/python/sys.py
@@ -48,7 +48,7 @@ if __name__ == '__main__':
if options.events:
events = options.events.split(",")
else:
- raise "You need to specify events to monitor"
+ raise Exception("You need to specify events to monitor")
s = perfmon.SystemWideSession(cpus, events)
@@ -60,4 +60,4 @@ if __name__ == '__main__':
for c in cpus:
for i in range(0, len(events)):
count = struct.unpack("L", s.read(c, i))[0]
- print """CPU%d: %s\t%lu""" % (c, events[i], count)
+ print("""CPU%d: %s\t%lu""" % (c, events[i], count))
Index: libpfm-4.9.0/python/self.py
===================================================================
--- libpfm-4.9.0.orig/python/self.py
+++ libpfm-4.9.0/python/self.py
@@ -40,7 +40,7 @@ if __name__ == '__main__':
if options.events:
events = options.events.split(",")
else:
- raise "You need to specify events to monitor"
+ raise Exception("You need to specify events to monitor")
s = perfmon.PerThreadSession(int(os.getpid()), events)
s.start()
@@ -55,4 +55,4 @@ if __name__ == '__main__':
# read the counts
for i in range(0, len(events)):
count = struct.unpack("L", s.read(i))[0]
- print """%s\t%lu""" % (events[i], count)
+ print("""%s\t%lu""" % (events[i], count))