diff --git a/comparisons/resources-diff.py b/comparisons/resources-diff.py index bc64432aff0..605c8dab3f3 100755 --- a/comparisons/resources-diff.py +++ b/comparisons/resources-diff.py @@ -11,8 +11,7 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): dkey = "%s_diff" % metric res[dkey] = dmetric pdmetric = 0.0 - if not data[metric] == 0.0: - pdmetric = 100 * dmetric / data[metric] + pdmetric = 100 * dmetric pdkey = "%s_pdiff" % metric res[pdkey] = pdmetric fkey = "%s_frac" % metric @@ -24,8 +23,7 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): dfkey = "%s_frac_diff" % metric res[dfkey] = dfmetric pdfmetric = 0.0 - if not fdata == 0.0: - pdfmetric = 100 * dfmetric / fdata + pdfmetric = 100 * dfmetric dkpkey = "%s_frac_pdiff" % metric res[dkpkey] = pdfmetric @@ -57,7 +55,7 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): for metric in metrics: datacumul[metric] = module[metric] datacumulsib[module["type"]] = datacumul -print(datacumulsib) +# print(datacumulsib) with open(sys.argv[2]) as f: prdata = json.load(f) @@ -80,7 +78,7 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): for metric in metrics: datacumul[metric] = module[metric] datacumulspr[module["type"]] = datacumul -print(datacumulspr) +# print(datacumulspr) if ibdata["total"]["label"] != prdata["total"]["label"]: print("Warning: input files describe different process names") @@ -132,19 +130,19 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): + "warn threshold %0.2f" % threshold + '%
Type | ' + 'Label | ' + 'real time | ' - + 'real time percent diff | ' + 'cpu time | ' - + 'cpu time percent diff | ' - + 'allocated memory total | ' - + 'allocated memory percent diff | ' - + 'deallocated memory diff | ' - + 'deallocated memory percent diff | ' + + 'allocated memory | ' + + 'deallocated memory | ' + 'events | ' + "%s | " % prdata["total"]["type"] @@ -155,37 +153,31 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): ibdata["total"]["time_real"], results["total"]["time_real_diff"], ) - + '%0.2f%% | ' % results["total"]["time_real_pdiff"] + '%0.6f %0.6f %0.6f | '
% (
prdata["total"]["time_thread"],
ibdata["total"]["time_thread"],
results["total"]["time_thread_diff"],
)
- + '%0.2f%% | ' % results["total"]["time_thread_pdiff"] + '%0.f %0.f %0.f | '
% (
prdata["total"]["mem_alloc"],
ibdata["total"]["mem_alloc"],
results["total"]["mem_alloc_diff"],
)
- + '%0.2f%% | ' % results["total"]["mem_alloc_pdiff"] + '%0.f %0.f %0.f | '
% (prdata["total"]["mem_free"], ibdata["total"]["mem_free"], results["total"]["mem_free_diff"])
- + '%0.2f%% | ' % results["total"]["mem_free_pdiff"] + "%i %i %i | "
% (prdata["total"]["events"], ibdata["total"]["events"], results["total"]["events"])
+ "
Module type | ' + 'Module label | ' - + 'real time fraction percent | ' - + 'real time fraction percent diff | ' - + 'cpu time fraction percent | ' - + 'cpu time fraction percent diff | ' + + 'real time fraction | ' + + 'real time fraction diff percent | ' + + 'cpu time fraction | ' + + 'cpu time fraction diff percent | ' + 'allocated memory diff | ' - + 'allocated memory percent diff | ' + 'deallocated memory diff | ' - + 'deallocated memory percent diff | ' + 'events | ' + "threshold: + if moduleres["time_thread_frac_pdiff"] > threshold: color = 'bgcolor="orange"' - if abs(moduleres["time_thread_frac_pdiff"]) > error_threshold: + if moduleres["time_thread_frac_pdiff"] > error_threshold: color = 'bgcolor="red"' + if moduleres["time_thread_frac_pdiff"] < -1.0 * threshold: + color = 'bgcolor="cyan"' + if moduleres["time_thread_frac_pdiff"] < -1.0 * error_threshold: + color = 'bgcolor="green"' cellString += color cellString += ">" summaryLines += [ @@ -225,10 +221,8 @@ def diff_from(metrics, data, data_total, dest, dest_total, res): + "%0.6f%% | " % moduleres["time_thread_frac_pdiff"] + '%0.f %0.f %0.f | '
% (moduleib["mem_alloc"], modulepr["mem_alloc"], moduleres["mem_alloc_diff"])
- + '%0.2f%% | ' % moduleres["mem_alloc_pdiff"] + '%0.f %0.f %0.f | '
- % (moduleib["mem_free"], modulepr["mem_free"], moduleres["mem_free_pdiff"])
- + '%0.2f%% | ' % moduleres["mem_free_diff"] + % (moduleib["mem_free"], modulepr["mem_free"], moduleres["mem_free_diff"]) + "%i %i %i | "
% (moduleib["events"], modulepr["events"], moduleres["events"])
+ ""