Skip to content

Automatically exported from code.google.com/p/gperftools-httpd

Notifications You must be signed in to change notification settings

neeraj9/gperftools-httpd

Repository files navigation

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 
[email protected]

About

Automatically exported from code.google.com/p/gperftools-httpd

Resources

Stars

Watchers

Forks

Packages

No packages published