Skip to content

Commit 5b4f2aa

Browse files
Formatting.
1 parent dfe5a34 commit 5b4f2aa

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

msprint.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
def inst_unit_scaling(peak):
1616
"""
1717
Given the peak instruction value to plot, get a scaling factor which will
18-
divide the data point and the resulting unit name. Those informations is
18+
divide the data point and the resulting unit name. These information are
1919
used to scale the data and set the axis label in the print_gnuplot_script
2020
function.
2121
"""
22-
2322
unit_table = [
2423
(2 ** 0, "i"),
2524
(2 ** 10, "ki"),
@@ -38,10 +37,9 @@ def inst_unit_scaling(peak):
3837
def time_unit_scaling(peak):
3938
"""
4039
Given the peak time value to plot, get a scaling factor which will divide
41-
the data point and the resulting unit name. Those informations is used to
40+
the data point and the resulting unit name. These information are used to
4241
scale the data and set the axis label in the print_gnuplot_script function.
4342
"""
44-
4543
if peak // 1000 < 1:
4644
return (1, "milliseconds (ms)")
4745
elif 1 <= peak // 1000 < 60:
@@ -53,10 +51,9 @@ def time_unit_scaling(peak):
5351
def memory_unit_scaling(peak):
5452
"""
5553
Given the peak memory value to plot, get a scaling factor which will divide
56-
the data point and the resulting unit name. Those informations is used to
54+
the data point and the resulting unit name. These information are used to
5755
scale the data and set the axis label in the print_gnuplot_script function.
5856
"""
59-
6057
unit_table = [
6158
(2 ** 0, "bytes (B)"),
6259
(2 ** 10, "kibibytes (KiB)"),
@@ -76,7 +73,6 @@ def print_as_json(mdata, indent):
7673
"""
7774
Print mdata as json. If indent is true, the outputed json is indented.
7875
"""
79-
8076
if indent:
8177
print(json.dumps(mdata, indent=1))
8278
else:
@@ -87,7 +83,6 @@ def print_gnuplot_dtable(mdata):
8783
"""
8884
Print mdata as a data table ready for gnuplot consumption.
8985
"""
90-
9186
print("# ms_processor.py - (C) Mathieu Turcotte, 2011")
9287
print("# valgrind --tool=massif", mdata["desc"], mdata["cmd"])
9388
print("# id", "time", "heap", "extra", "total", "stack", sep="\t")
@@ -124,16 +119,14 @@ def print_gnuplot_script(mdata, filename, format="png", xsize=1024, ysize=768):
124119
Print mdata as a gnuplot batch script which, when executed, will produce a
125120
plot of the massif.out data.
126121
"""
127-
128-
# Retrieve the time peak and determine the y axis
129-
# scale and label.
122+
# Retrieve the time peak and determine the y axis scale and label.
130123
peak_snapshot_id = mdata["peak_snapshot"]
131124
peak_snapshot = mdata["snapshots"][peak_snapshot_id]
132125
memory_peak = peak_snapshot["mem_heap"] + peak_snapshot["mem_heap_extra"]
133126
(yscale, ylabel) = memory_unit_scaling(memory_peak)
134127

135-
# Retrieve the time peak and the time unit in order
136-
# to calculate the x axis scale and label.
128+
# Retrieve the time peak and the time unit in order to compute the x
129+
# axis scale and label.
137130
time_peak = mdata["snapshots"][-1]["time"]
138131
time_unit = mdata["time_unit"]
139132
if time_unit == "B":
@@ -250,10 +243,10 @@ def parse_args():
250243

251244
def main():
252245
(options, args) = parse_args()
246+
253247
for path in args[0:]:
254248
try:
255249
mdata = msparser.parse_file(path)
256-
257250
if options.output == "json":
258251
print_as_json(mdata, options.indent)
259252
elif options.output == "gnuplot":
@@ -262,7 +255,6 @@ def main():
262255
options.ysize)
263256
elif options.output == "table":
264257
print_gnuplot_dtable(mdata)
265-
266258
except ParseError as perr:
267259
print(perr, file=sys.stderr)
268260

0 commit comments

Comments
 (0)