-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpecDataElem1995.py
50 lines (40 loc) · 1.7 KB
/
SpecDataElem1995.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
from SpecDataElem import *
import urllib
import BeautifulSoup
def getLinks(url):
""" give it the url, will extract an array of links to details"""
html = urllib.urlopen(url).read()
soup = BeautifulSoup.BeautifulSoup(html)
line = soup.pre.findNext("a")
links = []
while line:
if str(line.text) == "HTML":
link = str("http://www.spec.org" + str(line['href']))
links.append(link)
line = line.findNext("a")
return links
class SpecDataElem1995(SpecDataElem):
"A class that holds/parses spec95 data for a given processor"
def __init__(self, tests, attrMap=dict()):
SpecDataElem.__init__(self, tests=tests)
# map this table's headers to our standard attrs
# to do: figure out a more enum-y way to do this
# especially b.c standard attrs are ugly (include colons)
self.__attrMap = {"System": "hw_model",
"HW Avail": "hw_avail",
"Tested By": "test_sponsor",
"# cores" : "hw_ncores",
"# chips" : "hw_nchips",
"# cores per chip" : "hw_ncoresperchip",
"Processor": "CPU:",
"1st Cache" : "Primary Cache:",
"2nd Cache" : "Secondary Cache:",
"Other Cache": "L3 Cache:",
"Result": "peakmean",
"Baseline": "basemean",
}
self.__attrMap.update(attrMap)
def update(self, attr, data):
if attr in self.__attrMap:
attr = self.__attrMap[attr]
SpecDataElem.update(self, attr, data)