]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Works now with older kernels too.
authorBart Van Assche <bvanassche@acm.org>
Sat, 21 Jun 2008 08:07:40 +0000 (08:07 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 21 Jun 2008 08:07:40 +0000 (08:07 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8265

exp-drd/scripts/measurement-functions

index 8abd03cf282e530df084ec3b20b367b0787ac471..f03534b66f2d3b0ec6852663d8b13eaefa00aca4 100644 (file)
@@ -22,7 +22,12 @@ function log2 {
 ## Print the size of the level 2 cache in bytes on stdout.
 function get_cache_size {
   local s
-  s=$(</sys/devices/system/cpu/cpu0/cache/index2/size)
+  if [ -e /sys/devices/system/cpu/cpu0/cache/index2/size ]; then
+    s="$(</sys/devices/system/cpu/cpu0/cache/index2/size)"
+  else
+    s="$(cat /proc/cpuinfo|while read a b c d e ; do if [ "$a" = cache -a "$b" = size ]; then echo $d $e; break; fi; done)"
+    s="${s%B}"
+  fi
   if [ "${s%M}" != "$s" ]; then
     echo $((${s%M}*1024*1024))
   elif [ "${s%K}" != "$s" ]; then