summaryrefslogtreecommitdiff
path: root/tools/gdb-sd_dump_hashmaps.py
diff options
context:
space:
mode:
authorBatuhan Osman Taşkaya <batuhanosmantaskaya@gmail.com>2018-01-27 16:03:08 +0300
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-01-27 14:03:08 +0100
commit7c4a80727732296c6311a8366888fe0b6a124fda (patch)
treebea4ca1f1c1c8ca13e788a2448dc000310bd1573 /tools/gdb-sd_dump_hashmaps.py
parentf3ad25df084179cb682df09ff8b4663974cd7826 (diff)
downloadsystemd-7c4a80727732296c6311a8366888fe0b6a124fda.tar.gz
[gdb-sd_dump_hashmaps.py] String Formatting Update (#7819)
Changes: % changed as .format()
Diffstat (limited to 'tools/gdb-sd_dump_hashmaps.py')
-rw-r--r--tools/gdb-sd_dump_hashmaps.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/gdb-sd_dump_hashmaps.py b/tools/gdb-sd_dump_hashmaps.py
index b3c356b579..7f5d31eca6 100644
--- a/tools/gdb-sd_dump_hashmaps.py
+++ b/tools/gdb-sd_dump_hashmaps.py
@@ -51,7 +51,7 @@ class sd_dump_hashmaps(gdb.Command):
t = ["plain", "ordered", "set"][int(h["type"])]
- print "%s, %s, %s, %d, %d, %d, %s (%s:%d)" % (t, h["hash_ops"], bool(h["has_indirect"]), n_entries, d["max_entries"], n_buckets, d["func"], d["file"], d["line"])
+ print "{}, {}, {}, {}, {}, {}, {} ({}:{})".format(t, h["hash_ops"], bool(h["has_indirect"]), n_entries, d["max_entries"], n_buckets, d["func"], d["file"], d["line"])
if arg != "" and n_entries > 0:
dib_raw_addr = storage_ptr + (all_entry_sizes[h["type"]] * n_buckets)
@@ -63,10 +63,10 @@ class sd_dump_hashmaps(gdb.Command):
for dib in sorted(iter(histogram)):
if dib != 255:
- print "%3d %8d %f%% of entries" % (dib, histogram[dib], 100.0*histogram[dib]/n_entries)
+ print "{:>3} {:>8} {} of entries".format(dib, histogram[dib], 100.0*histogram[dib]/n_entries)
else:
- print "%3d %8d %f%% of slots" % (dib, histogram[dib], 100.0*histogram[dib]/n_buckets)
- print "mean DIB of entries: %f" % (sum([dib*histogram[dib] for dib in iter(histogram) if dib != 255])*1.0/n_entries)
+ print "{:>3} {:>8} {} of slots".format(dib, histogram[dib], 100.0*histogram[dib]/n_buckets)
+ print "mean DIB of entries: {}".format(sum([dib*histogram[dib] for dib in iter(histogram) if dib != 255])*1.0/n_entries)
blocks = []
current_len = 1
@@ -87,9 +87,9 @@ class sd_dump_hashmaps(gdb.Command):
if len(blocks) > 1 and blocks[0][0] == blocks[0][1] and blocks[-1][0] == n_buckets - 1:
blocks[0][1] += blocks[-1][1]
blocks = blocks[0:-1]
- print "max block: %s" % max(blocks, key=lambda a: a[1])
- print "sum block lens: %d" % sum(b[1] for b in blocks)
- print "mean block len: %f" % (1.0 * sum(b[1] for b in blocks) / len(blocks))
+ print "max block: {}".format(max(blocks, key=lambda a: a[1]))
+ print "sum block lens: {}".format(sum(b[1] for b in blocks))
+ print "mean block len: {}".format((1.0 * sum(b[1] for b in blocks) / len(blocks)))
d = d["debug_list_next"]