-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-flattening-files.py
executable file
·71 lines (48 loc) · 1.73 KB
/
gen-flattening-files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import math
import argparse
def genFlattenModules(benchName):
fn = benchName+'.out'
print '====Processing',benchName
f = open(fn,'r')
r = f.read().split('\n')
f.close()
l = filter(lambda x: (len(x)>1), r)
#print l
m = map(lambda x: x.replace(':',''), l)
m = map(lambda x: x.split(), m)
#print m
vals = map(lambda x: int(x[1]), m)
#print vals
numVals = len(vals)
print 'Total Num of Functions = ',numVals
'''
names = ['001k','005k','010k','050k','100k','150k','1M','2M','8M','20M']
buckets = [(0,1000),(1000,5000),(5000,10000),(10000,50000),(50000,100000),
(100000,150000),(150000,1000000),(1000000,2000000),
(2000000,8000000),(8000000,20000000)]
'''
names = ['2M']
buckets = [(1000000,2000000)]
numBuckets = len(buckets)
histVals = []
for i in range(numBuckets):
n = filter(lambda x: (int(x[1])>=buckets[i][0]) and (int(x[1])<buckets[i][1]), m)
histVals.append(len(n))
sumFunc = 0
for i in range(numBuckets):
print buckets[i][0],'-',buckets[i][1],' : ',histVals[i]
sumFunc = sumFunc+histVals[i]
print '>',buckets[-1][1] ,': ', numVals - sumFunc
for i in range(numBuckets):
can1k = filter(lambda x: (int(x[1])>=0) and (int(x[1])<buckets[i][1]), m)
n1k = map(lambda x: x[0], can1k)
fn = benchName+'_inline'+names[i]+'.txt'
fout = open(fn,'w')
for e in n1k:
fout.write(e)
fout.write('\n')
fout.close()
parser = argparse.ArgumentParser(description='Generate flattened module list for this benchmark')
parser.add_argument("input")
args = parser.parse_args()
genFlattenModules(args.input)