Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/plot.py

    r76f5e9f re9c5db2  
    2222
    2323class Field:
    24         def __init__(self, unit, _min, _log, _name=None):
     24        def __init__(self, unit, _min, _log):
    2525                self.unit = unit
    2626                self.min  = _min
    2727                self.log  = _log
    28                 self.name = _name
    2928
    3029field_names = {
     
    3332        "Ops per procs"         : Field('Ops'   , 0, False),
    3433        "Ops per threads"       : Field('Ops'   , 0, False),
    35         "ns per ops/procs"      : Field(''    , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ),
    36         "Number of threads"     : Field(''      , 1, False),
     34        "ns per ops/procs"      : Field('ns'    , 0, False),
     35        "Number of threads"     : Field('thrd'  , 1, False),
    3736        "Total Operations(ops)" : Field('Ops'   , 0, False),
    3837        "Ops/sec/procs"         : Field('Ops'   , 0, False),
    3938        "Total blocks"          : Field('Blocks', 0, False),
    40         "Ops per second"        : Field(''   , 0, False),
     39        "Ops per second"        : Field('Ops'   , 0, False),
    4140        "Cycle size (# thrds)"  : Field('thrd'  , 1, False),
    4241        "Duration (ms)"         : Field('ms'    , 0, False),
    43         "Target QPS"            : Field(''      , 0, False),
    44         "Actual QPS"            : Field(''      , 0, False),
    45         "Average Read Latency"  : Field('us'    , 0, True),
     42        "Target QPS"            : Field('QPS'   , 0, False),
     43        "Actual QPS"            : Field('QPS'   , 0, False),
    4644        "Median Read Latency"   : Field('us'    , 0, True),
    4745        "Tail Read Latency"     : Field('us'    , 0, True),
    48         "Average Update Latency": Field('us'    , 0, True),
    4946        "Median Update Latency" : Field('us'    , 0, True),
    5047        "Tail Update Latency"   : Field('us'    , 0, True),
    51         "Update Ratio"          : Field('\%'    , 0, False),
    5248}
    5349
    54 def plot(in_data, x, y, options):
     50def plot(in_data, x, y, out):
    5551        fig, ax = plt.subplots()
    5652        colors = itertools.cycle(['#0095e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00'])
     
    9692        print("Making Plots")
    9793
    98         for name, data in sorted(series.items()):
     94        for name, data in series.items():
    9995                _col = next(colors)
    10096                plt.scatter(data['x'], data['y'], color=_col, label=name, marker='x')
     
    110106        print("Finishing Plots")
    111107
    112         plt.ylabel(field_names[y].name if field_names[y].name else y)
     108        plt.ylabel(y)
    113109        # plt.xticks(range(1, math.ceil(mx) + 1))
    114         plt.xlabel(field_names[x].name if field_names[x].name else x)
     110        plt.xlabel(x)
    115111        plt.grid(b = True)
    116112        ax.xaxis.set_major_formatter( EngFormatter(unit=field_names[x].unit) )
    117         if options.logx:
    118                 ax.set_xscale('log')
    119         elif field_names[x].log:
     113        if field_names[x].log:
    120114                ax.set_xscale('log')
    121115        else:
     
    123117
    124118        ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) )
    125         if options.logy:
    126                 ax.set_yscale('log')
    127         elif field_names[y].log:
     119        if field_names[y].log:
    128120                ax.set_yscale('log')
    129121        else:
    130                 plt.ylim(field_names[y].min, options.MaxY if options.MaxY else my*1.2)
     122                plt.ylim(field_names[y].min, my*1.2)
    131123
    132124        plt.legend(loc='upper left')
    133125
    134126        print("Results Ready")
    135         if options.out:
    136                 plt.savefig(options.out, bbox_inches='tight')
     127        if out:
     128                plt.savefig(out)
    137129        else:
    138130                plt.show()
     
    147139        parser.add_argument('-y', nargs='?', type=str, default="", help="Which field to use as the Y axis")
    148140        parser.add_argument('-x', nargs='?', type=str, default="", help="Which field to use as the X axis")
    149         parser.add_argument('--logx', action='store_true', help="if set, makes the x-axis logscale")
    150         parser.add_argument('--logy', action='store_true', help="if set, makes the y-axis logscale")
    151         parser.add_argument('--MaxY', nargs='?', type=int, help="maximum value of the y-axis")
    152141
    153142        options =  parser.parse_args()
     
    193182
    194183
    195         plot(data, wantx, wanty, options)
     184        plot(data, wantx, wanty, options.out)
Note: See TracChangeset for help on using the changeset viewer.