(define* (show-profile (n 100))
  (let ((info (*s7* 'profile-info)))
    (if (null? info)
	(format *stderr* "no profiling data!~%")
	(let ((vect (make-vector (hash-table-entries info))))
	  (copy info vect)
	  (set! vect (sort! vect (lambda (a b) (> (cadr a) (cadr b)))))
	  (set! n (min n (length vect)))
	  (do ((i 0 (+ i 1)))
	      ((= i n) (newline *stderr*))
	    (let* ((data (vect i))
		   (key (car data))
		   (count (cadr data))
		   (expr (cddr data))
		   (file (pair-filename expr))
		   (line (pair-line-number expr)))
	      (if (> (ash key -20) 0)
		  (format *stderr* "~A[~A]: ~A~40T~A~%" 
			  file line count
			  (let ((val (object->string expr)))
			    (if (> (length val) 40)
				(string-append (substring val 0 36) " ...")
				val))))))))))

#|
(define old-version s7-version)
(define (s7-version)
  (show-profile)
  (old-version))
|#
