61 lines
1.8 KiB
Diff
61 lines
1.8 KiB
Diff
--- a/tools/dbusmenu-bench
|
|
+++ b/tools/dbusmenu-bench
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/env python
|
|
+#!/usr/bin/env python3
|
|
# encoding: utf-8
|
|
"""
|
|
A library to communicate a menu object set accross DBus and
|
|
@@ -61,7 +61,7 @@
|
|
|
|
def dump_properties(properties, prepend=""):
|
|
for key, value in properties.items():
|
|
- print "%s- %s: %s" % (prepend, key, value)
|
|
+ print("%s- %s: %s" % (prepend, key, value))
|
|
|
|
|
|
def run_test_sequence(menu, dump=False):
|
|
@@ -74,9 +74,9 @@
|
|
revision, layout = menu.GetLayout(dbus.Int32(0))
|
|
times["GetLayout"] = chrono.elapsed()
|
|
if dump:
|
|
- print "revision:", revision
|
|
- print "layout:"
|
|
- print layout
|
|
+ print("revision:", revision)
|
|
+ print("layout:")
|
|
+ print(layout)
|
|
|
|
# Get ids
|
|
tree = ET.fromstring(layout)
|
|
@@ -89,17 +89,17 @@
|
|
children = menu.GetChildren(dbus.Int32(root_id), property_names)
|
|
times["GetChildren"] = chrono.elapsed()
|
|
if dump:
|
|
- print "children:"
|
|
+ print("children:")
|
|
for child in children:
|
|
id, properties = child
|
|
- print "- %d:" % id
|
|
+ print("- %d:" % id)
|
|
dump_properties(properties, prepend=" ")
|
|
|
|
chrono.restart()
|
|
properties = menu.GetProperties(dbus.Int32(child_id), property_names)
|
|
times["GetProperties"] = chrono.elapsed()
|
|
if dump:
|
|
- print "properties:"
|
|
+ print("properties:")
|
|
dump_properties(properties)
|
|
|
|
return times
|
|
@@ -109,7 +109,7 @@
|
|
|
|
def print_probe(prefix, name, value, timestamp):
|
|
value = int(value * 1000000)
|
|
- print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
|
|
+ print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
|
|
|
|
def main():
|
|
parser = OptionParser(usage = "%prog [options]")
|