[ccan] New module: rprof, runtime profiler/timers

Christian Thaeter ct at pipapo.org
Sat Aug 27 06:03:45 EST 2011


As a warmup excercise for contributung things to CCAN I made a small
module to benchmark code. I'd like ask if everything is ok this
way and what should be improved. After some polishing I'll then send a
merge request :)

The code is available in my git repository git://git.pipapo.org/ccan in
the 'devel' branch.

 http://git.pipapo.org/?p=ccan;a=commit;h=5fe2b6049076ea2b87aa90845b48b8fe3bc30ef0


Some observations: It is a bit exceptional as I designed it not to
return any errors but just continue gracefully when used correctly.
If used wrong hell will break loose (SEGV). This possibly could
improved with asserts or runtime checks, but I strive to make the
timer function as deterministic AND small as possible. This makes
writing tests a bit superfluous. Nevertheless I added an 'api.c' test
just to stomp into a known valgrind bug (sched_getcpu() is broken on
valgrind in debian/stale).

Some remaining questions and remarks:

* How to disable valgrind for ccanlint testing?
* This needs '-lrt' any way to put that in the metadata?
* It's documented in asciidoc using my own doc extractor
  (http://git.pipapo.org/?p=pipadoc;a=blob_plain;f=pipadoc.html)

	Cheers
		Christian


More information about the ccan mailing list