From: Ben England Date: Wed, 12 Sep 2018 17:14:50 +0000 (-0400) Subject: filter out records with duplicate timestamps X-Git-Tag: fio-3.11~44^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fbcf1e71d547ff29fcfe05dce3ceda3affaaa044 filter out records with duplicate timestamps fio should not be outputting records with duplicate timestamps into the histogram log, but because it does do this, this script was getting divide-by-zero errors. This workaround will filter out the duplicates, which allows the script to operate on existing fio logs --- diff --git a/tools/hist/fio-histo-log-pctiles.py b/tools/hist/fio-histo-log-pctiles.py index c398113c..bbe08369 100755 --- a/tools/hist/fio-histo-log-pctiles.py +++ b/tools/hist/fio-histo-log-pctiles.py @@ -59,6 +59,8 @@ def parse_hist_file(logfn, buckets_per_interval): with open(logfn, 'r') as f: records = [ l.strip() for l in f.readlines() ] intervals = [] + last_time_ms = -1 + last_direction = -1 for k, r in enumerate(records): if r == '': continue @@ -91,6 +93,15 @@ def parse_hist_file(logfn, buckets_per_interval): if len(buckets) != buckets_per_interval: raise FioHistoLogExc('%d buckets per interval but %d expected in %s' % (len(buckets), buckets_per_interval, exception_suffix(k+1, logfn))) + + # hack to filter out records with the same timestamp + # we should not have to do this if fio logs histogram records correctly + + if time_ms == last_time_ms and direction == last_direction: + continue + last_time_ms = time_ms + last_direction = direction + intervals.append((time_ms, direction, bsz, buckets)) if len(intervals) == 0: raise FioHistoLogExc('no records in %s' % logfn)