diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-10-20 12:19:41 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-10-22 00:00:12 +1030 |
commit | 703004340c3e0f43f741bd368d2525cfd187d590 (patch) | |
tree | 586695354ca782f374b2bcffc46a015e70a5fa79 /lib/tdb/docs | |
parent | 1467e5eaab24b2b5c90ba0dd4e9dad4f321568c3 (diff) | |
download | samba-703004340c3e0f43f741bd368d2525cfd187d590.tar.gz samba-703004340c3e0f43f741bd368d2525cfd187d590.tar.bz2 samba-703004340c3e0f43f741bd368d2525cfd187d590.zip |
lib/tdb: TDB_TRACE support (for developers)
When TDB_TRACE is defined (in tdb_private.h), verbose tracing of tdb operations is enabled.
This can be replayed using "replay_trace" from http://ccan.ozlabs.org/info/tdb.
The majority of this patch comes from moving internal functions to _<funcname> to
avoid double-tracing. There should be no additional overhead for the normal (!TDB_TRACE)
case.
Note that the verbose traces compress really well with rzip.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb/docs')
-rw-r--r-- | lib/tdb/docs/tracing.txt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/tdb/docs/tracing.txt b/lib/tdb/docs/tracing.txt new file mode 100644 index 0000000000..98c5db9a51 --- /dev/null +++ b/lib/tdb/docs/tracing.txt @@ -0,0 +1,46 @@ +How And Why To Use TDB Tracing +============================== + +You can trace all TDB operations, using TDB_TRACE. It is not complete +(error conditions which expect to the logged will not always be traced +correctly, so you should set up a logging function too), but is designed +to collect benchmark-style traces to allow us to optimize TDB. + +Note: tracing is not efficient, and the trace files are huge: a +traverse of the database is particularly large! But they compress very +well with rzip (http://rzip.samba.org) + +How to gather trace files: +-------------------------- +1) Uncomment /* #define TDB_TRACE 1 */ in tdb_private.h. +2) Rebuild TDB, and everything that uses it. +3) Run something. + +Your trace files will be called <tdbname>.trace.<pid>. These files +will not be overwritten: if the same process reopens the same TDB, an +error will be logged and tracing will be disabled. + +How to replay trace files: +-------------------------- +1) For benchmarking, remember to rebuild tdb with #define TDB_TRACE commented + out again! +2) Grab the latest "replace_trace.c" from CCAN's tdb module (tools/ dir): + http://ccan.ozlabs.org/tarballs/tdb.tar.bz2 +3) Compile up replay_trace, munging as necessary. +4) Run replay_trace <scratch-tdb-name> <tracefiles>... + +If given more than one trace file (presumably from the same tdb) +replay_trace will try to figure out the dependencies between the operations +and fire off a child to run each trace. Occasionally it gets stuck, in +which case it will add another dependency and retry. Eventually it will +give a speed value. + +replay_trace can intuit the existence of previous data in the tdb (ie. +activity prior to the trace(s) supplied) and will prepopulate as +neccessary. + +You can run --quiet for straight benchmark results, and -n to run multiple +times (this saves time, since it need only calculate dependencies once). + +Good luck! +Rusty Russell <rusty@rustcorp.com.au> |