commit da706af1a4e48b9eeff68b88ccfeef90331b7fbb Author: Max Rottenkolber Date: Wed Jul 27 22:56:02 2016 +0200 software/sam/api.mk2: Do not include macro parameter default values. diff --git a/software/sam/api.mk2 b/software/sam/api.mk2 index 77f56d8..36be1b2 100644 --- a/software/sam/api.mk2 +++ b/software/sam/api.mk2 @@ -48,9 +48,7 @@ *Syntax:* - — Macro: *profile* {\(}{&key} {\(}_interval_ - _\*default‑sample‑interval\*_{\)} {\(}_cutoff_ - _\*default‑cutoff\*_{\)}{\)} {&body} _forms_ + — Macro: *profile* {\(}{&key} _interval_ _cutoff_{\)} {&body} _forms_ *Arguments and Values:* commit 22910a431b07d47c144057a422894769aee8bc6d Author: Max Rottenkolber Date: Wed Jul 27 00:47:49 2016 +0200 Add Sam API documentation. diff --git a/software/sam/api.mk2 b/software/sam/api.mk2 new file mode 100644 index 0000000..77f56d8 --- /dev/null +++ b/software/sam/api.mk2 @@ -0,0 +1,149 @@ +< sam + + Tiny, concurrent sampling profiler for Clozure Common Lisp. Sam peeks + into the stack of a running process repeatedly to figure out where time + is spent. + + *Example:* + + #code# +(sam:profile () + (loop for i from 1 to 1e8 sum i)) +▷ 39% CCL::>-2 +▷ 19% CCL::FIXNUM-SFLOAT-COMPARE +▷ 15% # +▷ 12% SAM:CALL-WITH-SAMPLING (defun call-with-sampling (fn ... +▷ 11% CCL::INTEGER-DECODE-SHORT-FLOAT +▷ 5% CCL::FIXNUM-DECODE-SHORT-FLOAT + # + + *Credits:* + + The core functionality of Sam was kindly provided by R. Matthew Emerson. + + + < call‑with‑sampling \(Function\) + + *Syntax:* + + — Function: *call‑with‑sampling* _fn_ {&key} _interval_ + + *Arguments and Values:* + + _fn_—a _function designator_. + + _interval_—a positive _number_ designating a time in seconds. The + default is 0.001. + + *Description:* + + {call-with-sampling} profiles _fn_, and returns a _hash table_ + containing the collected samples. _Interval_ specifies the time between + samples collected. + + > + + + < profile \(Macro\) + + *Syntax:* + + — Macro: *profile* {\(}{&key} {\(}_interval_ + _\*default‑sample‑interval\*_{\)} {\(}_cutoff_ + _\*default‑cutoff\*_{\)}{\)} {&body} _forms_ + + *Arguments and Values:* + + _interval_—a positive _number_ designating a time in seconds. The + default is 0.001. + + _cutoff_—a _number_ of _type_ {\(real 0 100\)} designating a + percentage. The default is 3. + + _forms_—_forms_ to be evaluated. + + *Description:* + + {profile} profiles the evaluation of _forms_ and prints a summary of + the results, omitting samples that constitute below _cutoff_ percent of + the total samples. _Interval_ specifies the time between samples + collected. + + > + + + < profile‑process \(Function\) + + *Syntax:* + + — Function: *profile‑process* _process_ _duration_ {&key} _interval_ + _cutoff_ + + *Arguments and Values:* + + _process_—a {process}. + + _duration_—a positive _number_ designating a time in seconds. + + _interval_—a positive _number_ designating a time in seconds. The + default is 0.001. + + _cutoff_—a _number_ of _type_ {\(real 0 100\)} designating a + percentage. The default is 3. + + *Description:* + + {profile-process} profiles _process_ for _duration_, and prints a + summary of the results, omitting samples that constitute below _cutoff_ + percent of the total samples. _Interval_ specifies the time between + samples collected. + + > + + + < report‑samples \(Function\) + + *Syntax:* + + — Function: *report‑samples* _h_ {&key} _cutoff_ + + *Arguments and Values:* + + _h_—a _hash table_ containing samples. + + _cutoff_—a _number_ of _type_ {\(real 0 100\)} designating a + percentage. The default is 3. + + *Description:* + + {report-samples} prints a summary of the samples in _h_, omitting + samples that constitute below _cutoff_ percent of the total samples. + + > + + + < sample‑process \(Function\) + + *Syntax:* + + — Function: *sample‑process* _process_ _duration_ {&key} _interval_ + + *Arguments and Values:* + + _process_—a {process}. + + _duration_—a positive _number_ designating a time in seconds. + + _interval_—a positive _number_ designating a time in seconds. The + default is 0.001. + + *Description:* + + {sample-process} profiles _process_ for _duration_, and returns a _hash + table_ containing the collected samples. _Interval_ is the time between + samples collected. + + > + +> +