-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
31 lines (21 loc) · 1.01 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
This code is not from Google. It is a copy of thttpd 2.25b downloaded
from http://www.acme.com/software/thttpd/thttpd-2.25b.tar.gz
but then adapted to be a tiny minimal HTTP server
that can be linked into any program to serve
profiling information for google-perftools's pprof.
It has been chopped up significantly compared to the original.
After running make (which assumes you have the google-perftools
libraries installed in /usr/local/lib or a standard place like /usr/lib),
you can profile an arbitrary program with:
LD_PRELOAD=/usr/local/lib/libghttpd-preload.so ./a.out
and then while it is running, execute:
pprof a.out http://localhost:9999/pprof/heap
The preload library starts the HTTP server at the first call
to malloc. Alternately, you can link with -lghttpd and call ghttpd()
during program initialization (e.g., in main).
You can change the port number by setting the environment
variable GHTTPPORT:
GHTTPPORT=12345 LD_PRELOAD=libghttpd-preload.so ./a.out
Russ Cox
18 October 2006