source: branches/reconfiguration/platforms/tsar_generic_iob/scripts/plot_ffstend.py @ 902

Last change on this file since 902 was 902, checked in by cfuguet, 10 years ago

reconf: improve the random fault generation

  • Improve portability of python scripts by using env
File size: 2.0 KB
RevLine 
[902]1#!/usr/bin/env python
[782]2# @author Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr>
3# @date   28 August, 2014
4
5import sys
6import matplotlib.pyplot as pyplot
7
8# get statistics file name
9assert len(sys.argv) > 1, "Introduce the stats file"
10filename = sys.argv[1]
11
12clusters = []
13cycles   = []
14
15# parse the ffst stats file
16with open(filename, 'r') as filedat:
[784]17    # skip comment lines at the beginning of the file
18    line = filedat.readline()
19    while line[0] == '#': line = filedat.readline()
20
21    # get the number of faultconfigs and init cycles array
22    nfaultconfigs = int(line)
23    for i in xrange(nfaultconfigs):
24        cycles.append([]);
25
26    # get the name of configurations
27    faultconfigs = []
28    for i in xrange(nfaultconfigs):
29        line = filedat.readline()
30        faultconfigs.append(line.rstrip('\n '))
31
32    # read statistics
33    # first column is the number of clusters (X axis)
34    # other columns are number of cycles per fault configuration (Y axis)
35    line = filedat.readline()
36    while line != "":
[782]37        partitions = line.split()
[784]38        if len(partitions) == 0:
39            line = filedat.readline()
40            continue
[782]41
42        clusters.append(int(partitions[0]))
[784]43        for i in xrange(nfaultconfigs):
[782]44            if int(partitions[i+1]) == -1:
45                cycles[i].append(None)
46            else:
47                cycles[i].append(int(partitions[i+1]))
48
[784]49        line = filedat.readline()
50
[782]51# plot the different configurations
52for c in xrange(len(cycles)):
[784]53    pyplot.plot(clusters, cycles[c], label = faultconfigs[c], marker = 'o')
[782]54
55# x axis parameters
56pyplot.xlabel('number of clusters')
57pyplot.xticks(clusters)
58pyplot.xlim(0, max(clusters))
59#pyplot.xticks(xrange(0, 257, 64)
60#pyplot.xscale('log', basex=2, subx=clusters)
61
62# y axis parameters
63pyplot.ylabel('number of cycles')
64
65# show figure with legend and grid
[784]66pyplot.title('Number of Cycles per Mesh Dimensions and Faulty Cores')
[782]67pyplot.legend(loc = 'lower right')
68pyplot.grid()
69pyplot.show()
70
71# vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracBrowser for help on using the repository browser.