Changeset f34f95c


Ignore:
Timestamp:
Apr 5, 2022, 3:48:25 PM (10 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
enum, master, pthread-emulation, qualifiedEnum
Children:
11a1240
Parents:
0c3aa67
Message:

Updated plot script to support non-interactive mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/plot.py

    r0c3aa67 rf34f95c  
    4040}
    4141
    42 def plot(data, x, y):
     42def plot(data, x, y, out):
    4343        fig, ax = plt.subplots()
    4444        colors = itertools.cycle(['#0095e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00'])
     
    6767        ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) )
    6868        plt.legend(loc='upper left')
    69         plt.show()
     69        if out:
     70                plt.savefig(out)
     71        else:
     72                plt.show()
    7073
    7174
     
    7578        parser = parser = argparse.ArgumentParser(description='Python Script to draw R.M.I.T. results')
    7679        parser.add_argument('-f', '--file', nargs='?', type=argparse.FileType('r'), default=sys.stdin)
     80        parser.add_argument('-o', '--out', nargs='?', type=str, default=None)
     81        parser.add_argument('-y', nargs='?', type=str, default="")
    7782
    7883        try:
     
    103108                        fields.add(label)
    104109
    105         print(series)
    106         print("fields")
    107         for f in fields:
    108                 print("{}".format(f))
     110        if not options.out :
     111                print(series)
     112                print("fields")
     113                for f in fields:
     114                        print("{}".format(f))
    109115
    110         plot(data, "Number of processors", "ns per ops")
     116        if options.y and options.y in field_names.keys():
     117                plot(data, "Number of processors", options.y, options.out)
     118        else:
     119                if options.y:
     120                        print("Could not find key '{}', defaulting to 'ns per ops'".format(options.y))
     121                plot(data, "Number of processors", "ns per ops", options.out)
Note: See TracChangeset for help on using the changeset viewer.