Changeset c0458be3


Ignore:
Timestamp:
Jul 29, 2022, 2:16:38 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
0d24ff2
Parents:
ce1d721
Message:

More small changes to the plot script and added script to parse trun results.

Location:
benchmark
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/plot.py

    rce1d721 rc0458be3  
    1414import math
    1515import numpy
     16import os
    1617import re
    1718import statistics
     
    2223
    2324class Field:
    24         def __init__(self, unit, _min, _log, _name=None):
     25        def __init__(self, unit, _min, _log, _name=None, _factor=1.0):
    2526                self.unit = unit
    2627                self.min  = _min
    2728                self.log  = _log
    2829                self.name = _name
     30                self.factor = _factor
    2931
    3032field_names = {
     
    3335        "Ops per procs"         : Field('Ops'   , 0, False),
    3436        "Ops per threads"       : Field('Ops'   , 0, False),
    35         "ns per ops/procs"      : Field(''    , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ),
     37        "ns per ops/procs"      : Field(''      , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ),
    3638        "Number of threads"     : Field(''      , 1, False),
    3739        "Total Operations(ops)" : Field('Ops'   , 0, False),
    3840        "Ops/sec/procs"         : Field('Ops'   , 0, False),
    3941        "Total blocks"          : Field('Blocks', 0, False),
    40         "Ops per second"        : Field(''   , 0, False),
     42        "Ops per second"        : Field(''      , 0, False),
    4143        "Cycle size (# thrds)"  : Field('thrd'  , 1, False),
    4244        "Duration (ms)"         : Field('ms'    , 0, False),
    4345        "Target QPS"            : Field(''      , 0, False),
    4446        "Actual QPS"            : Field(''      , 0, False),
    45         "Average Read Latency"  : Field('us'    , 0, True),
    46         "Median Read Latency"   : Field('us'    , 0, True),
    47         "Tail Read Latency"     : Field('us'    , 0, True),
    48         "Average Update Latency": Field('us'    , 0, True),
    49         "Median Update Latency" : Field('us'    , 0, True),
    50         "Tail Update Latency"   : Field('us'    , 0, True),
     47        "Average Read Latency"  : Field('s'     , 0, True, _factor = 0.000001),
     48        "Median Read Latency"   : Field('s'     , 0, True, _factor = 0.000001),
     49        "Tail Read Latency"     : Field('s'     , 0, True, _factor = 0.000001),
     50        "Average Update Latency": Field('s'     , 0, True, _factor = 0.000001),
     51        "Median Update Latency" : Field('s'     , 0, True, _factor = 0.000001),
     52        "Tail Update Latency"   : Field('s'     , 0, True, _factor = 0.000001),
    5153        "Update Ratio"          : Field('\%'    , 0, False),
     54        "Request Rate"          : Field('req/s' , 0, False),
     55        "Data Rate"             : Field('b/s'   , 0, False, _factor = 1000 * 1000, _name = "Response Throughput"),
    5256}
    5357
    54 def plot(in_data, x, y, options):
     58def plot(in_data, x, y, options, prefix):
    5559        fig, ax = plt.subplots()
    56         colors = itertools.cycle(['#0095e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00'])
     60        colors = itertools.cycle(['#006cb4','#0aa000','#ff6600','#8510a1','#0095e3','#fd8f00','#e30002','#8f00d6','#4b009a','#ffff00','#69df00','#fb0300','#b13f00'])
    5761        series = {} # scatter data for each individual data point
    5862        groups = {} # data points for x value
     
    7074                if x in entry[2] and y in entry[2]:
    7175                        xval = entry[2][x]
    72                         yval = entry[2][y]
     76                        yval = entry[2][y] * field_names[y].factor
    7377                        series[name]['x'].append(xval)
    7478                        series[name]['y'].append(yval)
     
    98102        for name, data in sorted(series.items()):
    99103                _col = next(colors)
    100                 plt.scatter(data['x'], data['y'], color=_col, label=name, marker='x')
     104                plt.scatter(data['x'], data['y'], color=_col, label=name[len(prefix):], marker='x')
    101105                plt.plot(lines[name]['x'], lines[name]['min'], '--', color=_col)
    102106                plt.plot(lines[name]['x'], lines[name]['max'], '--', color=_col)
     
    122126                plt.xlim(field_names[x].min, mx + 0.25)
    123127
    124         ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) )
    125128        if options.logy:
    126129                ax.set_yscale('log')
     
    129132        else:
    130133                plt.ylim(field_names[y].min, options.MaxY if options.MaxY else my*1.2)
     134
     135        ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) )
    131136
    132137        plt.legend(loc='upper left')
     
    173178                        fields.add(label)
    174179
     180        # find the common prefix on series for removal
     181        prefix = os.path.commonprefix(list(series))
     182
    175183        if not options.out :
    176184                print(series)
     
    193201
    194202
    195         plot(data, wantx, wanty, options)
     203        plot(data, wantx, wanty, options, prefix)
Note: See TracChangeset for help on using the changeset viewer.