diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-05-20 12:50:48 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-05-20 12:50:48 +0100 |
commit | 309dd0b0a84057c998c492fdf488156c73b33613 (patch) | |
tree | 8f8196e8de2c4ea114f4bede973830d6a5ece68e | |
parent | 13ee5f9d3e7ad1286703a13a2375ff12ffb4a7e9 (diff) | |
download | verismith-309dd0b0a84057c998c492fdf488156c73b33613.tar.gz verismith-309dd0b0a84057c998c492fdf488156c73b33613.zip |
Rename script
-rwxr-xr-x | scripts/size | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/size b/scripts/size new file mode 100755 index 0000000..d6d7466 --- /dev/null +++ b/scripts/size @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import subprocess +import statistics +import argparse +import os + +def file_len(fname): + with open(fname) as f: + for i, l in enumerate(f): + pass + return i + 1 + +def main(c, n): + l = [] + for x in range(0, n): + subprocess.call(["verifuzz", "generate", "-o", "main.v", "-c", c]) + l.append(file_len("main.v")) + os.remove("main.v") + print("mean: ", statistics.mean(l)) + print("median: ", statistics.median(l)) + print("stdev: ", statistics.stdev(l)) + print("variance: ", statistics.variance(l)) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Check the average size of a generated program.') + parser.add_argument('config', metavar='CONFIG', help='The config file to test.') + parser.add_argument('-n', '--num', help='How many iterations to run.', default=10, type=int) + args = parser.parse_args() + main(args.config, args.num) |