Changeset 71cf630 for benchmark/plot.py


Ignore:
Timestamp:
Aug 16, 2022, 4:04:47 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
aec2c022
Parents:
741e22c (diff), 17c6edeb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/plot.py

    r741e22c r71cf630  
    1818import statistics
    1919import sys
    20 
     20import time
     21
     22import matplotlib
    2123import matplotlib.pyplot as plt
    22 from matplotlib.ticker import EngFormatter
     24from matplotlib.ticker import EngFormatter, ScalarFormatter
     25
     26def fmtDur( duration ):
     27        if duration :
     28                hours, rem = divmod(duration, 3600)
     29                minutes, rem = divmod(rem, 60)
     30                seconds, millis = divmod(rem, 1)
     31                return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
     32        return " n/a"
    2333
    2434class Field:
     
    3242field_names = {
    3343        "ns per ops"            : Field('ns'    , 0, False),
    34         "Number of processors"  : Field(''      , 1, False),
     44        "Number of processors"  : Field(''      , 1, "exact"),
    3545        "Ops per procs"         : Field('Ops'   , 0, False),
    3646        "Ops per threads"       : Field('Ops'   , 0, False),
    37         "ns per ops/procs"      : Field(''      , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ),
     47        "ns per ops/procs"      : Field(''      , 0, False, _name = "ns $\\times$ (Processor $/$ Total Ops)" ),
    3848        "Number of threads"     : Field(''      , 1, False),
    3949        "Total Operations(ops)" : Field('Ops'   , 0, False),
     
    4555        "Target QPS"            : Field(''      , 0, False),
    4656        "Actual QPS"            : Field(''      , 0, False),
    47         "Average Read Latency"  : Field('s'     , 0, True, _factor = 0.000001),
     57        "Average Read Latency"  : Field('s'     , 0, False, _factor = 0.000001),
    4858        "Median Read Latency"   : Field('s'     , 0, True, _factor = 0.000001),
    4959        "Tail Read Latency"     : Field('s'     , 0, True, _factor = 0.000001),
     
    5161        "Median Update Latency" : Field('s'     , 0, True, _factor = 0.000001),
    5262        "Tail Update Latency"   : Field('s'     , 0, True, _factor = 0.000001),
    53         "Update Ratio"          : Field('\%'    , 0, False),
     63        "Update Ratio"          : Field('%'   , 0, False),
    5464        "Request Rate"          : Field('req/s' , 0, False),
    5565        "Data Rate"             : Field('b/s'   , 0, False, _factor = 1000 * 1000, _name = "Response Throughput"),
     66        "Errors"                : Field('%'   , 0, False),
    5667}
    5768
     
    6677        for entry in in_data:
    6778                name = entry[0]
     79                if options.filter and not name.startswith(options.filter):
     80                        continue
     81
    6882                if not name in series:
    6983                        series[name] = {'x':[], 'y':[]}
     
    123137        elif field_names[x].log:
    124138                ax.set_xscale('log')
     139                if field_names[x].log == "exact":
     140                        xvals = set()
     141                        for s in series.values():
     142                                xvals |= set(s['x'])
     143                        ax.set_xticks(sorted(xvals))
     144                        ax.get_xaxis().set_major_formatter(ScalarFormatter())
     145                        plt.xticks(rotation = 45)
    125146        else:
    126147                plt.xlim(field_names[x].min, mx + 0.25)
     
    138159
    139160        print("Results Ready")
     161        start = time.time()
    140162        if options.out:
    141163                plt.savefig(options.out, bbox_inches='tight')
    142164        else:
    143165                plt.show()
     166        end = time.time()
     167        print("Took {}".format(fmtDur(end - start)))
    144168
    145169
     
    155179        parser.add_argument('--logy', action='store_true', help="if set, makes the y-axis logscale")
    156180        parser.add_argument('--MaxY', nargs='?', type=int, help="maximum value of the y-axis")
     181        parser.add_argument('--filter', nargs='?', type=str, default="", help="if not empty, only print series that start with specified filter")
    157182
    158183        options =  parser.parse_args()
     184
     185        # if not options.out:
     186        #       matplotlib.use('SVG')
    159187
    160188        # ================================================================================
     
    178206                        fields.add(label)
    179207
    180         # find the common prefix on series for removal
     208        # filter out the series if needed
     209        if options.filter:
     210                series = set(filter(lambda elem: elem.startswith(options.filter), series))
     211
     212        # find the common prefix on series for removal (only if no filter)
    181213        prefix = os.path.commonprefix(list(series))
    182214
Note: See TracChangeset for help on using the changeset viewer.