summaryrefslogtreecommitdiffstats
path: root/scripts/buildstats-diff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-09-29 17:28:04 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-10-01 21:45:56 +0100
commitc6047cd989e09320cfd1e457b85e41dfb4e44811 (patch)
tree08a951b5fcfa1ed8a79e948b1dec9b6235e334bb /scripts/buildstats-diff
parent44bc3f47a3a32f01cc44296bfb31726a524397b9 (diff)
downloadpoky-c6047cd989e09320cfd1e457b85e41dfb4e44811.tar.gz
scripts/buildstats-diff: add read_ops and write_ops to --diff-attr
Two new options, making it possible to compare the number of filesystem operations of tasks. Defaults for --min-val and --min-absdiff are set to more or less arbitrary 500 and 50 operations, respectively. (From OE-Core rev: 75292a1de1a59e19198d26b7c1291004a5ca92f3) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/buildstats-diff')
-rwxr-xr-xscripts/buildstats-diff27
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/buildstats-diff b/scripts/buildstats-diff
index 3c894cbbe1..c6fa803445 100755
--- a/scripts/buildstats-diff
+++ b/scripts/buildstats-diff
@@ -88,6 +88,17 @@ class BSTask(dict):
88 """Bytes written to the block layer""" 88 """Bytes written to the block layer"""
89 return self['iostat']['write_bytes'] 89 return self['iostat']['write_bytes']
90 90
91 @property
92 def read_ops(self):
93 """Number of read operations on the block layer"""
94 return self['rusage']['ru_inblock'] + self['child_rusage']['ru_inblock']
95
96 @property
97 def write_ops(self):
98 """Number of write operations on the block layer"""
99 return self['rusage']['ru_oublock'] + self['child_rusage']['ru_oublock']
100
101
91def read_buildstats_file(buildstat_file): 102def read_buildstats_file(buildstat_file):
92 """Convert buildstat text file into dict/json""" 103 """Convert buildstat text file into dict/json"""
93 bs_task = BSTask() 104 bs_task = BSTask()
@@ -306,6 +317,12 @@ def print_task_diff(bs1, bs2, val_type, min_val=0, min_absdiff=0, sort_by=('absd
306 prec = 1 if dec > 0 else 0 317 prec = 1 if dec > 0 else 0
307 return "{:.{prec}f}{}B".format(val / (2 ** (10 * dec)), 318 return "{:.{prec}f}{}B".format(val / (2 ** (10 * dec)),
308 prefix[dec], prec=prec) 319 prefix[dec], prec=prec)
320 elif 'ops' in val_type and human_readable:
321 prefix = ['', 'k', 'M', 'G', 'T', 'P']
322 dec = int(math.log(val, 1000))
323 prec = 1 if dec > 0 else 0
324 return "{:.{prec}f}{}ops".format(val / (1000 ** dec),
325 prefix[dec], prec=prec)
309 return str(int(val)) 326 return str(int(val))
310 327
311 def sum_vals(buildstats): 328 def sum_vals(buildstats):
@@ -418,17 +435,21 @@ Script for comparing buildstats of two separate builds."""
418 435
419 min_val_defaults = {'cputime': 3.0, 436 min_val_defaults = {'cputime': 3.0,
420 'read_bytes': 524288, 437 'read_bytes': 524288,
421 'write_bytes': 524288} 438 'write_bytes': 524288,
439 'read_ops': 500,
440 'write_ops': 500}
422 min_absdiff_defaults = {'cputime': 1.0, 441 min_absdiff_defaults = {'cputime': 1.0,
423 'read_bytes': 131072, 442 'read_bytes': 131072,
424 'write_bytes': 131072} 443 'write_bytes': 131072,
444 'read_ops': 50,
445 'write_ops': 50}
425 446
426 parser.add_argument('--debug', '-d', action='store_true', 447 parser.add_argument('--debug', '-d', action='store_true',
427 help="Verbose logging") 448 help="Verbose logging")
428 parser.add_argument('--ver-diff', action='store_true', 449 parser.add_argument('--ver-diff', action='store_true',
429 help="Show package version differences and exit") 450 help="Show package version differences and exit")
430 parser.add_argument('--diff-attr', default='cputime', 451 parser.add_argument('--diff-attr', default='cputime',
431 choices=('cputime', 'read_bytes', 'write_bytes'), 452 choices=min_val_defaults.keys(),
432 help="Buildstat attribute which to compare") 453 help="Buildstat attribute which to compare")
433 parser.add_argument('--min-val', default=min_val_defaults, type=float, 454 parser.add_argument('--min-val', default=min_val_defaults, type=float,
434 help="Filter out tasks less than MIN_VAL. " 455 help="Filter out tasks less than MIN_VAL. "