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