-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix json perf counter print and add script to generate a chart
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python | ||
|
||
import matplotlib | ||
matplotlib.use('Agg') | ||
|
||
import matplotlib.pyplot as plt | ||
import json | ||
import sys | ||
|
||
stages_to_counters = {} | ||
stages_to_time = {} | ||
|
||
if len(sys.argv) != 2: | ||
print("USAGE: {} <input file>".format(sys.argv[0])) | ||
sys.exit(1) | ||
|
||
with open(sys.argv[1]) as fh: | ||
for line in fh.readlines(): | ||
if "COUNTER" in line: | ||
json_part = line[line.find("{"):] | ||
x = json.loads(json_part) | ||
counter = x['name'] | ||
if not (counter in stages_to_counters): | ||
stages_to_counters[counter] = [] | ||
stages_to_time[counter] = [] | ||
stages_to_counters[counter].append(x['counts']) | ||
stages_to_time[counter].append(x['now']) | ||
|
||
fig, ax = plt.subplots() | ||
|
||
for stage in stages_to_counters.keys(): | ||
plt.plot(stages_to_time[stage], stages_to_counters[stage], label=stage) | ||
|
||
plt.xlabel('ms') | ||
plt.ylabel('count') | ||
|
||
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, | ||
ncol=2, mode="expand", borderaxespad=0.) | ||
|
||
plt.locator_params(axis='x', nbins=10) | ||
plt.grid(True) | ||
|
||
plt.savefig("perf.pdf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters