From 249f2788c6c9d6c0ddfbca37c8a6bfab42b22374 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 25 Feb 2011 14:54:36 +0100 Subject: Fix `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (memory-mappings)[mapping-line-rx]: Fix and give an example. (total-heap-size): Fix docstring. --- gc-benchmarks/gc-profile.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gc-benchmarks/gc-profile.scm') diff --git a/gc-benchmarks/gc-profile.scm b/gc-benchmarks/gc-profile.scm index 3365832a0..667886ea5 100755 --- a/gc-benchmarks/gc-profile.scm +++ b/gc-benchmarks/gc-profile.scm @@ -3,7 +3,7 @@ exec ${GUILE-guile} --no-debug -q -l "$0" \ -c '(apply main (cdr (command-line)))' "$@" !# -;;; Copyright (C) 2008 Free Software Foundation, Inc. +;;; Copyright (C) 2008, 2011 Free Software Foundation, Inc. ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public License @@ -38,8 +38,10 @@ memory mapping of process @var{pid}. This information is obtained by reading @file{/proc/PID/smaps} on Linux. See `procs(5)' for details." (define mapping-line-rx + ;; As of Linux 2.6.32.28, an `smaps' line looks like this: + ;; "00400000-00401000 r-xp 00000000 fe:00 108264 /home/ludo/soft/bin/guile" (make-regexp - "^([[:xdigit:]]+)-([[:xdigit:]]+) ([rwx-]{3}[ps]) ([[:xdigit:]]+) [0-9]{2}:[0-9]{2} [0-9]+[[:blank:]]+(.*)$")) + "^([[:xdigit:]]+)-([[:xdigit:]]+) ([rwx-]{3}[ps]) ([[:xdigit:]]+) [[:xdigit:]]{2}:[[:xdigit:]]{2} [0-9]+[[:blank:]]+(.*)$")) (define rss-line-rx (make-regexp @@ -83,7 +85,7 @@ memory mapping of process @var{pid}. This information is obtained by reading (loop (read-line) result)))))))) (define (total-heap-size pid) - "Return the total heap size of process @var{pid}." + "Return a pair representing the total and RSS heap size of PID." (define heap-or-anon-rx (make-regexp "\\[(heap|anon)\\]")) -- cgit v1.2.3 From 821eca02eb50cb65d41f72fe99acbebd5bc5cc7d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 6 Mar 2011 22:27:53 +0100 Subject: Have `gc-profile.scm' make sure it's on a Linux-based system. * gc-benchmarks/gc-profile.scm (memory-mappings): Check %HOST-TYPE for "-linux-". --- gc-benchmarks/gc-profile.scm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gc-benchmarks/gc-profile.scm') diff --git a/gc-benchmarks/gc-profile.scm b/gc-benchmarks/gc-profile.scm index 667886ea5..d95e29572 100755 --- a/gc-benchmarks/gc-profile.scm +++ b/gc-benchmarks/gc-profile.scm @@ -47,6 +47,9 @@ memory mapping of process @var{pid}. This information is obtained by reading (make-regexp "^Rss:[[:blank:]]+([[:digit:]]+) kB$")) + (if (not (string-contains %host-type "-linux-")) + (error "this procedure only works on Linux-based systems" %host-type)) + (with-input-from-port (open-input-file (format #f "/proc/~a/smaps" pid)) (lambda () (let loop ((line (read-line)) -- cgit v1.2.3