diff --git a/scheme/httpd/surflets/profile.scm b/scheme/httpd/surflets/profile.scm index de218fd..96c17a2 100644 --- a/scheme/httpd/surflets/profile.scm +++ b/scheme/httpd/surflets/profile.scm @@ -22,7 +22,7 @@ ;;; that contains all SPACE-INFO objects (see below for SPACE-INFO). ;;; ;;; -;;; (MAKE-GNUPLOT-DATA output-file selector space-info-list) +;;; (WRITE-GNUPLOT-DATA-FILE output-file selector space-info-list) ;;; ;;; Creates a file named OUTPUT-FILE out of SPACE-INFO-LIST. The ;;; created file can be used with GNUPLOT (external program, not part @@ -107,13 +107,16 @@ (define *run-count* 0) +(define *temp-file-lock* (make-lock)) ;; PROFILE-SPACE writes result of call to (SPACE) to a file (define (profile-space . maybe-file-name) + (obtain-lock *temp-file-lock*) (let ((file-name (:optional maybe-file-name (create-temp-file "/var/tmp/profile")))) (let ((out (open-output-file file-name open/append))) + (release-lock *temp-file-lock*) (set! *run-count* (+ 1 *run-count*)) (format out "~%Run #~a~%" *run-count*) (with-current-output-port* out space)