Skip to content
Snippets Groups Projects
Commit 6b899fb9 authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files
parents
No related branches found
No related tags found
No related merge requests found
0.doc 0 → 100644
Package: lang/lisp/code/tools/metering/
Name: Metering
Summary: Portable Code Profiling Tool
Version: v2.1 (25-JAN-94)
Description:
METERING is a portable code profiling tool, for gathering timing and
consing statistics while a program is running. This is a combination
of the Monitor package written by Chris McConnell and the Profile
package written by Skef Wholey and Rob MacLachlan, with several
extensions. Monitors the use of functions and macros: calls, CPU
time, clock time, and storage use.
Requires: Common Lisp
Ports: Portable, with three small implementation-dependent
changes for new Common Lisp implementations. Tested in
CMU CL, MACL, MCL, Allegro CL, Lucid CL, AKCL, IBCL.
Origin: CMU Lisp Repository (home location)
Copying: Public domain.
Updated:
CD-ROM: Prime Time Freeware for AI, Issue 1-1
Bug Reports: lisp-utilities-request@cs.cmu.edu
Mailing List: lisp-utilities-request@cs.cmu.edu
Author(s): Mark Kantrowitz <mkant@cs.cmu.edu>
Contact:
Keywords:
Lisp!Tools, Metering, Profiler, Authors!Kantrowitz, Time Measurement,
Code Profiler, Space Usage Measurement, CMU, Public Domain
Contains: ???
See Also:
References:
Documentation of the tools written by Mark Kantrowitz (Metering,
Defsystem, Source Compare, User Manual, and Xref) appears in
Mark Kantrowitz, "Portable Utilities for Common Lisp, User Guide and
Implementation Notes", Tech Report CMU-CS-91-143, School of Computer
Science, Carnegie Mellon University, May 1991.
which is available as lang/lisp/code/tools/mkantdoc.tar.gz.
There is also some documentation at the top of the file.
0.html 0 → 100644
<TITLE>Package: lang/lisp/code/tools/metering/</TITLE>
<hr>
<b>CMU Artificial Intelligence Repository</b><br>
<tt><A HREF="/afs/cs.cmu.edu/project/ai-repository/ai/html/air.html"><IMG ALIGN=MIDDLE SRC="/afs/cs.cmu.edu/project/ai-repository/ai/html/gif/home.gif" ALT="Home"></A> <A HREF="/afs/cs.cmu.edu/project/ai-repository/ai/html/rep_info.html"><IMG ALIGN=MIDDLE SRC="/afs/cs.cmu.edu/project/ai-repository/ai/html/gif/info.gif" ALT="INFO"></A> <A HREF="/afs/cs.cmu.edu/project/ai-repository/ai/html/keys/keysform.html"><IMG ALIGN=MIDDLE SRC="/afs/cs.cmu.edu/project/ai-repository/ai/html/gif/search.gif" ALT="Search"></A> <A HREF="/afs/cs.cmu.edu/project/ai-repository/ai/html/faqs/top.html"><IMG ALIGN=MIDDLE SRC="/afs/cs.cmu.edu/project/ai-repository/ai/html/gif/faqs.gif" ALT="FAQs"></A> <A HREF="/afs/cs.cmu.edu/project/ai-repository/ai/0.html"><IMG ALIGN=MIDDLE SRC="/afs/cs.cmu.edu/project/ai-repository/ai/html/gif/top.gif" ALT="Repository Root"></A> </tt>
<hr>
<H2>Metering: Portable Code Profiling Tool</H2>
<pre>
<A HREF="./">lang/lisp/code/tools/metering/</A>
</pre>
<listing>
METERING is a portable code profiling tool, for gathering timing and
consing statistics while a program is running. This is a combination
of the Monitor package written by Chris McConnell and the Profile
package written by Skef Wholey and Rob MacLachlan, with several
extensions. Monitors the use of functions and macros: calls, CPU
time, clock time, and storage use.
</listing>
<pre>
Origin:
CMU Lisp Repository (home location)
</pre>
<hr>
<listing>
Version: v2.1 (25-JAN-94)
Requires: Common Lisp
Ports: Portable, with three small implementation-dependent
changes for new Common Lisp implementations. Tested in
CMU CL, MACL, MCL, Allegro CL, Lucid CL, AKCL, IBCL.
Copying: Public domain.
CD-ROM: Prime Time Freeware for AI, Issue 1-1
Bug Reports: lisp-utilities-request@cs.cmu.edu
Mailing List: lisp-utilities-request@cs.cmu.edu
Author(s): Mark Kantrowitz <mkant@cs.cmu.edu>
Keywords:
Authors!Kantrowitz, CMU, Code Profiler, Lisp!Tools, Metering,
Profiler, Public Domain, Space Usage Measurement,
Time Measurement
References:
Documentation of the tools written by Mark Kantrowitz (Metering,
Defsystem, Source Compare, User Manual, and Xref) appears in
Mark Kantrowitz, "Portable Utilities for Common Lisp, User Guide and
Implementation Notes", Tech Report CMU-CS-91-143, School of Computer
Science, Carnegie Mellon University, May 1991.
which is available as lang/lisp/code/tools/mkantdoc.tar.gz.
There is also some documentation at the top of the file.
</listing><hr>
<address>Last Web update on Mon Feb 13 10:30:49 1995 <br>
<A HREF="/afs/cs.cmu.edu/project/ai-repository/ai/html/air.html">AI.Repository@cs.cmu.edu</A></address>
mcl.fix 0 → 100644
Return-Path: <brunk@ruffles.ICS.UCI.EDU>
Received: by A.GP.CS.CMU.EDU id aa17156; 28 Jun 94 13:48:44 EDT
Received: from GLINDA.OZ.CS.CMU.EDU by A.GP.CS.CMU.EDU id aa17075;
28 Jun 94 13:43:38 EDT
Received: from paris.ics.uci.edu by GLINDA.OZ.CS.CMU.EDU id aa11297;
28 Jun 94 13:42:15 EDT
Received: from ruffles.ics.uci.edu by paris.ics.uci.edu id aa10848;
28 Jun 94 10:41 PDT
To: mkant@GLINDA.OZ.CS.CMU.EDU
Subject: Common Lisp Metering System
Date: Tue, 28 Jun 1994 10:41:32 -0700
From: Cliff Brunk <brunk@ruffles.ICS.UCI.EDU>
Message-ID: <9406281041.aa10848@paris.ics.uci.edu>
Hi Mark,
I use your Common Lisp metering system pretty often on under MCL 2.01.
Thanks for making this nice profiling tool available, it has helped alot.
However, I notied that the amount of space used by functions that contain
an &optional is much higher for the monitoring-encapsulation than
from the original function. I beleive this is because the encapsulation
creates a list for the optional arguments using &rest. If one adds
a dynmaic-extentent declaration after the lambda list in many implementations
of Common Lisp the &rest arglist will be stack allocated and the amount of
storage reported will be a truer indication of how the function performs
outside of the encapsulation. Below is the modification that I'm currently
using and seems to work at least under MCL.
Cliff Brunk
(defun make-monitoring-encapsulation (min-args optionals-p)
(let (required-args)
(dotimes (i min-args) (push (gensym) required-args))
`(lambda (name)
(let ((inclusive-time 0)
(inclusive-cons 0)
(exclusive-time 0)
(exclusive-cons 0)
(calls 0)
(nested-calls 0)
(old-definition (place-function name)))
(declare (type time-type inclusive-time)
(type time-type exclusive-time)
(type consing-type inclusive-cons)
(type consing-type exclusive-cons)
(fixnum calls)
(fixnum nested-calls))
(pushnew name *monitored-functions*)
(setf (place-function name)
#'(lambda (,@required-args
,@(when optionals-p `(&rest optional-args)))
,(when optionals-p `(declare (dynamic-extent optional-args))) ;;; &rest optional-args can be stack allocated
(let ((prev-total-time *total-time*)
(prev-total-cons *total-cons*)
(prev-total-calls *total-calls*)
; (old-time inclusive-time)
; (old-cons inclusive-cons)
; (old-nested-calls nested-calls)
(start-time (get-time))
(start-cons (get-cons)))
(declare (type time-type prev-total-time)
(type time-type start-time)
(type consing-type prev-total-cons)
(type consing-type start-cons)
(fixnum prev-total-calls))
(multiple-value-prog1
,(if optionals-p
`(apply old-definition
,@required-args optional-args)
`(funcall old-definition ,@required-args))
(let ((delta-time (- (get-time) start-time))
(delta-cons (- (get-cons) start-cons)))
;; Calls
(incf calls)
(incf *total-calls*)
;;; nested-calls includes this call
(incf nested-calls (the fixnum
(- *total-calls*
prev-total-calls)))
; (setf nested-calls (+ old-nested-calls
; (- *total-calls*
; prev-total-calls)))
;; Time
;;; Problem with inclusive time is that it
;;; currently doesn't add values from recursive
;;; calls to the same function. Change the
;;; setf to an incf to fix this?
(incf inclusive-time (the time-type delta-time))
; (setf inclusive-time (+ delta-time old-time))
(incf exclusive-time (the time-type
(+ delta-time
(- prev-total-time
*total-time*))))
(setf *total-time* (the time-type
(+ delta-time
prev-total-time)))
;; Consing
(incf inclusive-cons (the consing-type delta-cons))
; (setf inclusive-cons (+ delta-cons old-cons))
(incf exclusive-cons (the consing-type
(+ delta-cons
(- prev-total-cons
*total-cons*))))
(setf *total-cons*
(the consing-type
(+ delta-cons prev-total-cons))))))))
(setf (get-monitor-info name)
(make-metering-functions
:name name
:old-definition old-definition
:new-definition (place-function name)
:read-metering #'(lambda ()
(values inclusive-time
inclusive-cons
exclusive-time
exclusive-cons
calls
nested-calls))
:reset-metering #'(lambda ()
(setq inclusive-time 0
inclusive-cons 0
exclusive-time 0
exclusive-cons 0
calls 0
nested-calls 0)
t)))))))
_______________________________________________________________________________
Cliff Brunk I'm not really listening. It's all non-
Information and Computer Science sense. I'm working on a new problem:
University of California Find the value for n such that n plus
Irvine, California 92717-3425 everything else in your life makes you
(714) 725-3491 feel all right. What would n equal?
brunk@ics.uci.edu Solve for n. - Peter Cameron
_______________________________________________________________________________
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment