Author: David Schneider <[email protected]>
Branch:
Changeset: r63478:f20ec7bb60c8
Date: 2013-04-18 15:23 +0200
http://bitbucket.org/pypy/pypy/changeset/f20ec7bb60c8/
Log: add a special check for ARM when detecting l2 cache size.
On ARM /proc/cpuinfo does not contain any usable information
diff --git a/rpython/memory/gc/env.py b/rpython/memory/gc/env.py
--- a/rpython/memory/gc/env.py
+++ b/rpython/memory/gc/env.py
@@ -149,6 +149,10 @@
else:
data = ''.join(data)
linepos = 0
+ # Currently on ARM-linux we won't find any information about caches in
+ # cpuinfo
+ if _detect_arm_cpu(data):
+ return -1
while True:
start = _findend(data, '\ncache size', linepos)
if start < 0:
@@ -201,6 +205,18 @@
pos += 1
return pos
+def _detect_arm_cpu(data):
+ # check for the presence of a 'Processor' entry
+ start = _findend(data, 'Processor', 0)
+ if start >= 0:
+ # *** data[start:linepos] == " : ARMv6-compatible processor rev 7\n"
+ start = _skipspace(data, start)
+ if data[start] == ':':
+ # *** data[start:linepos] == ": ARMv6-compatible processor rev 7\n"
+ start = _skipspace(data, start + 1)
+ return data[start], data[start + 1], data[start + 2] == 'A','R','M'
+ return False
+
# ---------- Darwin ----------
sysctlbyname = rffi.llexternal('sysctlbyname',
diff --git a/rpython/memory/gc/test/test_env.py
b/rpython/memory/gc/test/test_env.py
--- a/rpython/memory/gc/test/test_env.py
+++ b/rpython/memory/gc/test/test_env.py
@@ -161,3 +161,14 @@
""")
result = env.get_L2cache_linux2(str(filepath))
assert result == 3072 * 1024
+
+def test_estimate_best_nursery_size_linux2_arm():
+ filepath = udir.join('estimate_best_nursery_size_linux2')
+ filepath.write("""\
+Processor : ARMv6-compatible processor rev 7 (v6l)
+# this is not actually from cpuinfo, but here for the test
+cache size : 3072 KB
+...
+""")
+ result = env.get_L2cache_linux2(str(filepath))
+ assert result == -1
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit