Superior Common Lisp trace
functionality for debugging/profiling real world applications.
This software is still ALPHA quality. The APIs will be likely to change.
;; List a function names to trace
(supertrace dbi:execute dbi:prepare)
;; Trace all exported functions from 'dbi' package and 'dex:request'
(supertrace (package dbi) dex:request)
;; Custom before/after functions
(supertrace (package dbi) dex:request
:before #'before-logger ;; <- A function takes 2 arguments -- a function name and arguments
:after #'after-logger) ;; <- A function takes 4 arguments -- a function name, arguments, returned value and elapsed time in microsecond.
Output is like as follows:
running <DBI.DRIVER> (prepare #<dbd.postgres:dbd-postgres-connection {1001937FF3}> "SELECT COUNT(*) AS \"count\" FROM \"entry\" WHERE \"user_id\" = ?")
0.210ms <DBI.DRIVER> (prepare #<dbd.postgres:dbd-postgres-connection {1001937FF3}> "SELECT COUNT(*) AS \"count\" FROM \"entry\" WHERE \"user_id\" = ?") -> #<dbd.postgres:dbd-postgres-query {100459D6A3}>
running <DBI.DRIVER> (execute #<dbd.postgres:dbd-postgres-query {100459D6A3}> "eb073a91-d098-4c38-805b-cede8e39d278")
0.565ms <DBI.DRIVER> (execute #<dbd.postgres:dbd-postgres-query {100459D6A3}> "eb073a91-d098-4c38-805b-cede8e39d278") -> #<dbd.postgres:dbd-postgres-query {100459D6A3}>
:before
: A function to run before the function call:after
: A function to run after the function call:threshold
: Run:after
function only when the elapsed time exceeded this value. (in microsecond)
- SBCL
- Clozure CL
- Others
- Eitaro Fukamachi ([email protected])
Copyright (c) 2020 Eitaro Fukamachi ([email protected])
Licensed under the BSD 2-Clause License.