Subversion Repositories SmartDukaan

Rev

Rev 4082 | Rev 5173 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4036 varun.gupt 1
import utils
2
 
3
def getMaxValFromDict(dictionary):
4
 
5
    max = None
6
 
7
    for key, val in dictionary.iteritems():
4569 varun.gupt 8
        if max is None or max < val:    max = val
4036 varun.gupt 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,
4082 varun.gupt 25
        'AMD Athlon II Neo K325 Dual-Core': 784,
4036 varun.gupt 26
        'AMD Neo-K235': 782,
27
        'AMD E 350': 724,
28
        'Intel N570 1.66GHz': 646,
29
        'Intel N455 1.66GHz': 321
30
    }
31
    max_score = getMaxValFromDict(processor_benchmarks)
32
    score = 0.0
33
 
34
    for processor, benchmark_score in processor_benchmarks.iteritems():
35
        if(processor.lower().find(model.lower()) > -1):
36
            score = benchmark_score
37
 
38
    return (score * 10.0) / max_score
39
 
40
def getChipsetScore(chipset):
41
    chipset_scores = {
42
            'Intel HM65': 10,
43
            'Intel HM 57': 9.5,
44
            'Intel HM55': 9,
45
            'AMD M888G': 8.5,
46
            'Intel 45': 8,
47
            'Intel NM10': 7
48
    }
49
    for chipset_name, score in chipset_scores.iteritems():
50
        if chipset_name.lower().find(chipset) > -1 or chipset.find(chipset_name.lower()) > -1: return score
51
 
52
 
53
def getscore(struct):
54
    score = 0.0
55
    model_score = 0.0
56
 
57
    if struct.has_key('features'):
58
        features = struct.get('features')
59
 
60
        if features.has_key('Processor model'):
61
            model = features.get('Processor model')
62
            model_score = getBenchmarkScore(str(model[0]))
63
    return model_score
4569 varun.gupt 64
 
4036 varun.gupt 65
print "expSlide=" + `expSlide`
66
 
67
struct = utils.contentModel2Struct(expSlide, categoryObj)
68
print "struct=" + `struct`
69
 
70
score = getscore(struct)