Changeset 883c4d9


Ignore:
Timestamp:
Nov 11, 2020, 12:22:20 PM (11 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
2c2b60f
Parents:
b82d140
Message:

rmit.py script no prints json by default.
Also it supports json now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/rmit.py

    rb82d140 r883c4d9  
    1212import datetime
    1313import itertools
     14import json
    1415import os
    1516import random
     
    117118        # ================================================================================
    118119        # parse command line arguments
    119         formats = ['raw', 'csv']
     120        formats = ['raw', 'csv', 'json']
    120121        parser = argparse.ArgumentParser(description='Python Script to implement R.M.I.T. testing : Randomized Multiple Interleaved Trials')
    121122        parser.add_argument('--list', help='List all the commands that would be run', action='store_true')
    122         parser.add_argument('--format', help='How to print the result', choices=formats, default='csv')
     123        parser.add_argument('--format', help='How to print the result', choices=formats, default='json')
    123124        parser.add_argument('--file', nargs='?', type=argparse.FileType('w'), default=sys.stdout)
    124125        parser.add_argument('-t', '--trials', help='Number of trials to run per combinaison', type=int, default=3)
     
    203204
    204205        # ================================================================================
    205         # Print csv
     206        # Print raw
    206207        if options.format == 'raw':
    207208                for r in result:
    208209                        print(r, file=options.file)
     210                sys.exit(0)
     211
     212        # ================================================================================
     213        # Print json
     214        if options.format == 'json':
     215                json.dump(result, options.file)
    209216                sys.exit(0)
    210217
Note: See TracChangeset for help on using the changeset viewer.