| 4036 |
varun.gupt |
1 |
import utils
|
|
|
2 |
|
|
|
3 |
def getMaxValFromDict(dictionary):
|
|
|
4 |
|
|
|
5 |
max = None
|
|
|
6 |
|
|
|
7 |
for key, val in dictionary.iteritems():
|
|
|
8 |
if max is not None or max < val: max = val
|
|
|
9 |
|
|
|
10 |
return max * 1.0
|
|
|
11 |
|
|
|
12 |
def getBenchmarkScore(model):
|
|
|
13 |
processor_benchmarks = {
|
|
|
14 |
'Intel 2630QM 2GHz': 6337,
|
|
|
15 |
'Intel 2430M 2.4GHz': 3483,
|
|
|
16 |
'Intel 2410M 2.3GHz': 3362,
|
|
|
17 |
'Intel 2330M 2.2GHz': 2727,
|
|
|
18 |
'Intel 2310M 2.1GHz': 2623,
|
|
|
19 |
'Intel 370M 2.4GHz': 2218,
|
|
|
20 |
'Intel B950 2.1GHz': 2018,
|
|
|
21 |
'Intel B940 2GHz': 1904,
|
|
|
22 |
'Intel T4500 2.3GHz': 1545,
|
|
|
23 |
'Intel T6750 2.1GHz': 1349,
|
|
|
24 |
'Intel 380UM 1.33GHz': 1301,
|
|
|
25 |
'AMD Neo-K235': 782,
|
|
|
26 |
'AMD E 350': 724,
|
|
|
27 |
'Intel N570 1.66GHz': 646,
|
|
|
28 |
'Intel N455 1.66GHz': 321
|
|
|
29 |
}
|
|
|
30 |
max_score = getMaxValFromDict(processor_benchmarks)
|
|
|
31 |
score = 0.0
|
|
|
32 |
|
|
|
33 |
for processor, benchmark_score in processor_benchmarks.iteritems():
|
|
|
34 |
if(processor.lower().find(model.lower()) > -1):
|
|
|
35 |
score = benchmark_score
|
|
|
36 |
|
|
|
37 |
return (score * 10.0) / max_score
|
|
|
38 |
|
|
|
39 |
def getChipsetScore(chipset):
|
|
|
40 |
chipset_scores = {
|
|
|
41 |
'Intel HM65': 10,
|
|
|
42 |
'Intel HM 57': 9.5,
|
|
|
43 |
'Intel HM55': 9,
|
|
|
44 |
'AMD M888G': 8.5,
|
|
|
45 |
'Intel 45': 8,
|
|
|
46 |
'Intel NM10': 7
|
|
|
47 |
}
|
|
|
48 |
for chipset_name, score in chipset_scores.iteritems():
|
|
|
49 |
if chipset_name.lower().find(chipset) > -1 or chipset.find(chipset_name.lower()) > -1: return score
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
def getscore(struct):
|
|
|
53 |
score = 0.0
|
|
|
54 |
model_score = 0.0
|
|
|
55 |
|
|
|
56 |
if struct.has_key('features'):
|
|
|
57 |
features = struct.get('features')
|
|
|
58 |
|
|
|
59 |
if features.has_key('Processor model'):
|
|
|
60 |
model = features.get('Processor model')
|
|
|
61 |
model_score = getBenchmarkScore(str(model[0]))
|
|
|
62 |
return model_score
|
|
|
63 |
|
|
|
64 |
print "expSlide=" + `expSlide`
|
|
|
65 |
|
|
|
66 |
struct = utils.contentModel2Struct(expSlide, categoryObj)
|
|
|
67 |
print "struct=" + `struct`
|
|
|
68 |
|
|
|
69 |
score = getscore(struct)
|