Blame docs/tracing.txt

rpm-build ca8475
How And Why To Use TDB Tracing
rpm-build ca8475
==============================
rpm-build ca8475
rpm-build ca8475
You can trace all TDB operations, using TDB_TRACE.  It is not complete
rpm-build ca8475
(error conditions which expect to the logged will not always be traced
rpm-build ca8475
correctly, so you should set up a logging function too), but is designed
rpm-build ca8475
to collect benchmark-style traces to allow us to optimize TDB.
rpm-build ca8475
rpm-build ca8475
Note: tracing is not efficient, and the trace files are huge: a
rpm-build ca8475
traverse of the database is particularly large!  But they compress very
rpm-build ca8475
well with rzip (http://rzip.samba.org)
rpm-build ca8475
rpm-build ca8475
How to gather trace files:
rpm-build ca8475
--------------------------
rpm-build ca8475
1) Uncomment /* #define TDB_TRACE 1 */ in tdb_private.h.
rpm-build ca8475
2) Rebuild TDB, and everything that uses it.
rpm-build ca8475
3) Run something.
rpm-build ca8475
rpm-build ca8475
Your trace files will be called <tdbname>.trace.<pid>.  These files
rpm-build ca8475
will not be overwritten: if the same process reopens the same TDB, an
rpm-build ca8475
error will be logged and tracing will be disabled.
rpm-build ca8475
rpm-build ca8475
How to replay trace files:
rpm-build ca8475
--------------------------
rpm-build ca8475
1) For benchmarking, remember to rebuild tdb with #define TDB_TRACE commented
rpm-build ca8475
   out again!
rpm-build ca8475
2) Grab the latest "replace_trace.c" from CCAN's tdb module (tools/ dir):
rpm-build ca8475
	http://ccan.ozlabs.org/tarballs/tdb.tar.bz2
rpm-build ca8475
3) Compile up replay_trace, munging as necessary.
rpm-build ca8475
4) Run replay_trace <scratch-tdb-name> <tracefiles>...
rpm-build ca8475
rpm-build ca8475
If given more than one trace file (presumably from the same tdb)
rpm-build ca8475
replay_trace will try to figure out the dependencies between the operations
rpm-build ca8475
and fire off a child to run each trace.  Occasionally it gets stuck, in
rpm-build ca8475
which case it will add another dependency and retry.  Eventually it will
rpm-build ca8475
give a speed value.
rpm-build ca8475
rpm-build ca8475
replay_trace can intuit the existence of previous data in the tdb (ie.
rpm-build ca8475
activity prior to the trace(s) supplied) and will prepopulate as
Packit Service b162db
necessary.
rpm-build ca8475
rpm-build ca8475
You can run --quiet for straight benchmark results, and -n to run multiple
rpm-build ca8475
times (this saves time, since it need only calculate dependencies once).
rpm-build ca8475
rpm-build ca8475
Good luck!
rpm-build ca8475
Rusty Russell <rusty@rustcorp.com.au>