Created
March 15, 2011 18:42
-
-
Save etrepum/871212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 8f177a7e05f5 pypy/rpython/memory/gc/env.py | |
--- a/pypy/rpython/memory/gc/env.py Tue Mar 15 14:10:00 2011 -0400 | |
+++ b/pypy/rpython/memory/gc/env.py Tue Mar 15 14:41:48 2011 -0400 | |
@@ -99,8 +99,9 @@ | |
def get_total_memory(): | |
return get_total_memory_linux2('/proc/meminfo') | |
-#elif sys.platform == 'darwin': | |
-# ... | |
+elif sys.platform == 'darwin': | |
+ def get_total_memory(): | |
+ return get_darwin_syctl_signed('hw.memsize') | |
else: | |
def get_total_memory(): | |
@@ -191,7 +192,7 @@ | |
rffi.INT, | |
sandboxsafe=True) | |
-def get_darwin_cache_size(cache_key): | |
+def get_darwin_sysctl_signed(cache_key): | |
cache_p = lltype.malloc(rffi.LONGLONGP.TO, 1, flavor='raw') | |
try: | |
len_p = lltype.malloc(rffi.SIZE_TP.TO, 1, flavor='raw') | |
@@ -223,8 +224,8 @@ | |
on the machine we are running on. | |
""" | |
debug_start("gc-hardware") | |
- L2cache = get_darwin_cache_size("hw.l2cachesize") | |
- L3cache = get_darwin_cache_size("hw.l3cachesize") | |
+ L2cache = get_darwin_sysctl_signed("hw.l2cachesize") | |
+ L3cache = get_darwin_sysctl_signed("hw.l3cachesize") | |
debug_print("L2cache =", L2cache) | |
debug_print("L3cache =", L3cache) | |
debug_stop("gc-hardware") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment