How to profile a dynamically linked library without sprof?
The answer was to use valgrind and KCachegrind
Using SBCL's profiler in my own package
You need to evaluate the require
before you do the defpackage
of your own package. The defpackage
won't automatically require
the SB-PROF
module for you. Think of require
as some kind of "fancy" load
, which loads the module into the image. During loading, the module's packages get created, and only after that are you able to reference them from within a defpackage
or via the reader (sb-sprof:with-profiling
).
Often, when I am too lazy to do it right (or if it's a "one-shot" solution), I use a small "loadup.lisp" script, which makes sure, that all my dependencies are present and then loads up my own code. This also makes sure, that the image can reliably be reproduced from in a fresh lisp.
Something along the lines of
;; Make sure, the dependencies are present
(ql:quickload '(whatever)) ;; Load a dependency via Quicklisp
(require :sb-something-else) ;; ... or via some implementation-dependent repository
(asdf:oos 'asdf:load-op 'some-module) ;; ... or via ASDF or ... or ... or ...
;; Now, load my own stuff
(load "packages")
(load "something-important-1")
...
The order of these operations is important; you cannot reference any packages from dependency modules in your own package declarations, before those modules have been properly loaded.
Related Topics
How to Convert Fixed Size Dimension to Unlimited in a Netcdf File
How to Diagnose a Python Process Chewing CPU in Linux
How to Debug a Linux Core Dump Using Vscode
Setup Cron from Morning to Evening Only
Linux Service Can't Load Library Path in The /Etc/Ld.So.Conf.D
Linux: How to Lock The Pages of a Process in Memory
Under What Circumstances Does The Read() Syscall Return 0
Get Latest Release Version Number for Chrome Browser
Linux: How to Debug a Sigsegv? How to Trace The Error Source
Adding New System Call to Linux Kernel 3.13 on 64 Bit System
Why Processes Are Deprived of CPU for Too Long While Busy Looping in Linux Kernel
Does I2C Driver Need to Be Implemented Just Like Any Other Character Device Driver
How to Assign Execute Permission to a .Sh File in Windows to Be Executed in Linux