diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -307,7 +307,7 @@ def _timer(fm, func, title=None, display fm.write(prefix + b'comb', b' comb %f', entry[1] + entry[2]) fm.write(prefix + b'user', b' user %f', entry[1]) fm.write(prefix + b'sys', b' sys %f', entry[2]) - fm.write(prefix + b'count', b' (%s of %d)', role, count) + fm.write(prefix + b'count', b' (%s of %%d)' % role, count) fm.plain(b'\n') results.sort() min_val = results[0] diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t +++ b/tests/test-contrib-perf.t @@ -207,6 +207,50 @@ detailed output: ! wall * comb * user * sys * (avg of *) (glob) ! wall * comb * user * sys * (median of *) (glob) +test json output +---------------- + +normal output: + + $ hg perfheads --template json --config perf.stub=no + [ + { + "comb": *, (glob) + "count": *, (glob) + "sys": *, (glob) + "user": *, (glob) + "wall": * (glob) + } + ] + +detailed output: + + $ hg perfheads --template json --config perf.all-timing=yes --config perf.stub=no + [ + { + "avg.comb": *, (glob) + "avg.count": *, (glob) + "avg.sys": *, (glob) + "avg.user": *, (glob) + "avg.wall": *, (glob) + "comb": *, (glob) + "count": *, (glob) + "max.comb": *, (glob) + "max.count": *, (glob) + "max.sys": *, (glob) + "max.user": *, (glob) + "max.wall": *, (glob) + "median.comb": *, (glob) + "median.count": *, (glob) + "median.sys": *, (glob) + "median.user": *, (glob) + "median.wall": *, (glob) + "sys": *, (glob) + "user": *, (glob) + "wall": * (glob) + } + ] + Check perf.py for historical portability ----------------------------------------