summaryrefslogtreecommitdiff
blob: 89866ec46c36c22da2475c2585c1ead7c1e7418d (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
diff -urN gDesklets-0.35.3.orig/libdesklets/system/ArchFactory.py gDesklets-0.35.3/libdesklets/system/ArchFactory.py
--- gDesklets-0.35.3.orig/libdesklets/system/ArchFactory.py	2005-01-22 15:33:31.000000000 +0000
+++ gDesklets-0.35.3/libdesklets/system/ArchFactory.py	2006-04-30 12:58:04.000000000 +0000
@@ -27,6 +27,9 @@
         if (uname[-1] in ('ppc', 'ppc64')):
             return Linux.PPC()
 
+        if (uname[-1] in ('alpha')):
+            return Linux.Alpha()
+
         return Linux.Generic()
 
 
diff -urN gDesklets-0.35.3.orig/libdesklets/system/Linux/Alpha.py gDesklets-0.35.3/libdesklets/system/Linux/Alpha.py
--- gDesklets-0.35.3.orig/libdesklets/system/Linux/Alpha.py	1970-01-01 00:00:00.000000000 +0000
+++ gDesklets-0.35.3/libdesklets/system/Linux/Alpha.py	2006-04-30 16:06:54.000000000 +0000
@@ -0,0 +1,52 @@
+from Generic import Generic
+
+import re
+
+class Alpha(Generic):
+
+    def __init__(self):
+
+        Generic.__init__(self)
+
+        def _get_model():
+            r = re.compile('^system type\s+:\s+(.+)$', re.M)
+            m = r.search( self._read_cpuinfo() )
+            return m.group(1)
+
+        def _get_speed():
+            r = re.compile('^cycle frequency \[Hz\]\s+:\s+(\d+)\s+est\.$', re.M);
+            m = r.search( self._read_cpuinfo() )
+            return float(int(m.group(1))/1000000.0)
+
+        self.__model_name = _get_model()
+        self.__speed      = _get_speed()
+
+        # set cache size to 0, since size is not present in /proc/cpuinfo
+        self.__cache_size = int(0)
+
+
+    def cpu_cache(self):
+        """
+        @return : 2nd level cache of installed processor
+        @rtype  : int
+        """
+
+        return self.__cache_size
+
+    def cpu_model(self):
+        """
+        @return : model/type of installed processor
+        @rtype  : str
+        """
+
+        return self.__model_name
+
+
+
+    def cpu_speed(self):
+        """
+        @return : current clock of installed processor
+        @rtype  : float
+        """
+
+        return self.__speed
diff -urN gDesklets-0.35.3.orig/libdesklets/system/Linux/Makefile.am gDesklets-0.35.3/libdesklets/system/Linux/Makefile.am
--- gDesklets-0.35.3.orig/libdesklets/system/Linux/Makefile.am	2004-11-22 19:42:53.000000000 +0000
+++ gDesklets-0.35.3/libdesklets/system/Linux/Makefile.am	2006-04-30 12:58:43.000000000 +0000
@@ -2,6 +2,7 @@
 
 install_DATA = \
 	__init__.py	\
+	Alpha.py	\
 	Generic.py \
 	PPC.py \
 	Sparc.py \
diff -urN gDesklets-0.35.3.orig/libdesklets/system/Linux/__init__.py gDesklets-0.35.3/libdesklets/system/Linux/__init__.py
--- gDesklets-0.35.3.orig/libdesklets/system/Linux/__init__.py	2004-04-19 18:24:26.000000000 +0000
+++ gDesklets-0.35.3/libdesklets/system/Linux/__init__.py	2006-04-30 13:14:47.000000000 +0000
@@ -1,4 +1,5 @@
 from X86 import X86
 from Sparc import Sparc
 from PPC import PPC
+from Alpha import Alpha
 from Generic import Generic