Gather resource utilization statistics and report them.
Usage:
(reporting-sru (:job-origin (remote-client) :stream (remote-stream))
(do-something-lengthy))
(reporting-sru (:job-origin (remote-client) :stream (remote-stream)
:report-to (lambda (cpu-time sys-time device-i/o paging-i/o
job-origin &key (stream t))
(SUMMARY-RESOURCE-UTILIZATION
cpu-time sys-time device-i/o paging-i/o
job-origin :stream stream)))
(do-something-lengthy))
Example:
(reporting-sru (:job-origin "REPL")
(asdf-load :com.informatimago.clext))
prints:
Summary of resource utilization
-------------------------------
CPU time: 0.300 sec Device I/O: 175
Overhead CPU: 0.012 sec Paging I/O: 1
CPU model: AMD Athlon(tm) Processor 6.4.2 1200.303 MHz (2402.66 bogomips)
Job origin: REPL
License:
AGPL3
Copyright Pascal J. Bourguignon 2006 - 2012
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
|
(reporting-sru (&key (job-origin (quote (short-site-name))) (stream t) (report-to NIL report-to-p)) &body body) |
macro |
DO: Execute the BODY collecting resource usage statistics, and
finally reporting them.
JOB-ORIGIN: Label of the originator of the job; defaults to (SHORT-SITE-NAME).
STREAM: Output stream (the default T means *standard-output*).
REPORT-TO: If provided, it's a function with the same signature as
SUMMARY-RESOURCE-UTILIZATION, ie.:
(cpu-time sys-time device-i/o paging-i/o job-origin &key (stream t))
which is called to report the collected statistics.
The default is SUMMARY-RESOURCE-UTILIZATION.
|
(summary-resource-utilization cpu-time sys-time device-i/o paging-i/o job-origin &key stream) |
function |
DO: Reports resource utilisaty summary. CPU-TIME: CPU time used, in seconds. SYS-TIME: System time used, in seconds. DEVICE-I/O: Number of Disk I/O. PAGING-I/O: Number of Swap I/O. JOB-ORIGIN: Label of the originator of the job. STREAM: Output stream (the default T means *standard-output*).