[782] | 1 | #!/usr/bin/python |
---|
| 2 | # @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr> |
---|
| 3 | # @date 28 August, 2014 |
---|
| 4 | |
---|
| 5 | import sys |
---|
| 6 | import matplotlib.pyplot as pyplot |
---|
| 7 | |
---|
| 8 | # get statistics file name |
---|
| 9 | assert len(sys.argv) > 1, "Introduce the stats file" |
---|
| 10 | filename = sys.argv[1] |
---|
| 11 | |
---|
| 12 | clusters = [] |
---|
| 13 | cycles = [] |
---|
| 14 | |
---|
| 15 | # parse the ffst stats file |
---|
| 16 | with open(filename, 'r') as filedat: |
---|
| 17 | for line in filedat: |
---|
| 18 | partitions = line.split() |
---|
| 19 | if len(partitions) == 0: continue |
---|
| 20 | if partitions[0] == '#': continue |
---|
| 21 | |
---|
| 22 | if len(cycles) == 0: |
---|
| 23 | for i in xrange(len(partitions)-1): |
---|
| 24 | cycles.append([]); |
---|
| 25 | |
---|
| 26 | clusters.append(int(partitions[0])) |
---|
| 27 | for i in xrange(len(partitions)-1): |
---|
| 28 | if int(partitions[i+1]) == -1: |
---|
| 29 | cycles[i].append(None) |
---|
| 30 | else: |
---|
| 31 | cycles[i].append(int(partitions[i+1])) |
---|
| 32 | |
---|
| 33 | # plot the different configurations |
---|
| 34 | for c in xrange(len(cycles)): |
---|
| 35 | pyplot.plot(clusters, cycles[c], label = 'config{0}'.format(c), marker = 'o') |
---|
| 36 | |
---|
| 37 | # x axis parameters |
---|
| 38 | pyplot.xlabel('number of clusters') |
---|
| 39 | pyplot.xticks(clusters) |
---|
| 40 | pyplot.xlim(0, max(clusters)) |
---|
| 41 | #pyplot.xticks(xrange(0, 257, 64) |
---|
| 42 | #pyplot.xscale('log', basex=2, subx=clusters) |
---|
| 43 | |
---|
| 44 | # y axis parameters |
---|
| 45 | pyplot.ylabel('number of cycles') |
---|
| 46 | |
---|
| 47 | # show figure with legend and grid |
---|
| 48 | pyplot.legend(loc = 'lower right') |
---|
| 49 | pyplot.grid() |
---|
| 50 | pyplot.show() |
---|
| 51 | |
---|
| 52 | # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab |
---|