diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-03-12 00:34:10 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-03-12 00:34:10 -0700 |
commit | 5bf88f48fe8233955b3346ccea14f8e3fae38286 (patch) | |
tree | da9adbd5427b8e69e2ace69794f64fe4e1e4b494 /txr.1 | |
parent | 5382f4a6aa4a38c5f2f229f79bee55dfcb3843fc (diff) | |
download | txr-5bf88f48fe8233955b3346ccea14f8e3fae38286.tar.gz txr-5bf88f48fe8233955b3346ccea14f8e3fae38286.tar.bz2 txr-5bf88f48fe8233955b3346ccea14f8e3fae38286.zip |
* eval.c (plus_s, prof_s): New symbol global variables.
(op_prof, me_pprof): New static functions.
(eval_init): Intern prof symbol, store in prof_s.
Captured interned + symbol in plus_s. Register prof operator and pprof
macro.
* gc.c (gc_bytes): New global variable.
(more): Use nse function chk_malloc_gc_more instead of chk_malloc.
(make_obj): Increment gc_bytes.
* lib.c (malloc_bytes): New global variable.
(chk_malloc, chk_realloc): Increment malloc_bytes.
(chk_calloc): Bugfix: incorrect size in recursion into oom_realloc.
Incorrect calculation of malloc_high_bound. Increment malloc_bytes.
(chk_malloc_gc_more): New function.
* lib.h (alloc_bytes_t): New typedef.
(malloc_bytes, gc_bytes): Declared.
(chk_malloc_gc_more): Declared.
* stream.c (format_s): New symbol global.
(stream_init): format_s inited.
format_s used to register formatv function.
* stream.h (format_s): Declared.
* txr.1: Documented prof and pprof.
* genvim.txr: Recognize reg_fun calls with intern
followed by a preceding assignment or other syntax.
* txr.vim: Updated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 60 |
1 files changed, 60 insertions, 0 deletions
@@ -14026,6 +14026,66 @@ source code location info also, so that when the TXR Lisp evaluator encounters errors in transformed code, it can give diagnostics which refer to the original untransformed source code. +.SH PROFILING + +.SS Operator prof + +.TP +Syntax: + + (prof <form>*) + +.TP +Description: + +The prof operator evaluates the enclosed forms from left to right similarly +to progn, while determining the memory allocation requests and time +consumed by the evaluation of the forms. + +If there are no forms, the prof operator measures the smallest measurable +operation of evaluating nothing and producing nil. + +If the evaluation terminates normally (not abruptly by a non-local +control transfer), then prof yields a list consisting of: + + (<value> <malloc-bytes> <gc-bytes> <milliseconds>) + +where <values> is the value returned by the rightmost <form>, or nil if there +are no forms, <malloc-bytes> is the total number of bytes of all malloc +requests (or at least those known to the TXR runtime, such as those of all +internal objects), <gc-bytes> is the total number of bytes drawn from the +garbage-collected heaps, and <milliseconds> is the total processor time +consumed over the execution of those forms. + +Notes: + +The bytes allocated by the garbage collector from malloc to create +heap areas are not counted as <malloc-bytes>. <malloc-bytes> includes storage +such as the space used for dynamic strings, vectors and bignums (in addition to +their gc-heap allocated nodes), and the various structures used by the cobj +type objects such as streams and hashes. Objects in external libraries that use +un-instrumented allocators are not counted: for instance the C FILE * streams. + +.SS Macro pprof + +.TP +Syntax: + + (pprof <form>*) + +.TP +Description: + +The pprof (pretty-printing prof) macro is similar to progn. It evaluates forms, +and returns the rightmost one, or nil if there are no forms. + +Over the evaluation of the forms, it counts memory allocations, and measures +CPU time. If the forms terminate normally, then just prior to returning, +pprof prints these statistics are printed in a concise report on the +*std-output* stream, prior to returning the value or nil. + +The pprof macro relies on the prof operator. + .SH MODULARIZATION .SS Special variable *self-path* |