diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:10:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:10:13 +0930 |
commit | 26f3587d4bf60fe3c82084a7661c4f856534725f (patch) | |
tree | 4268149def9655420fc296e01dc98e9102039685 /lib/tdb2/tdb1_freelist.c | |
parent | b30bb0ed903a49a9a81d0418211e4f985eca20ab (diff) | |
download | samba-26f3587d4bf60fe3c82084a7661c4f856534725f.tar.gz samba-26f3587d4bf60fe3c82084a7661c4f856534725f.tar.bz2 samba-26f3587d4bf60fe3c82084a7661c4f856534725f.zip |
tdb2: add stats to tdb1 backend.
It's actually quite a good fit; we use compare_wrong_bucket for dead
records, which is kind of correct (they should be in the free list).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit a3e4ebff2eb9dc2e386160b8acf77d70236f4def)
Diffstat (limited to 'lib/tdb2/tdb1_freelist.c')
-rw-r--r-- | lib/tdb2/tdb1_freelist.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/tdb2/tdb1_freelist.c b/lib/tdb2/tdb1_freelist.c index 37f19ab28b..af01293721 100644 --- a/lib/tdb2/tdb1_freelist.c +++ b/lib/tdb2/tdb1_freelist.c @@ -83,6 +83,7 @@ int tdb1_free(struct tdb_context *tdb, tdb1_off_t offset, struct tdb1_record *re goto fail; } + tdb->stats.alloc_coalesce_tried++; /* Look left */ if (offset - sizeof(tdb1_off_t) > TDB1_DATA_START(tdb->tdb1.header.hash_size)) { tdb1_off_t left = offset - sizeof(tdb1_off_t); @@ -131,6 +132,9 @@ int tdb1_free(struct tdb_context *tdb, tdb1_off_t offset, struct tdb1_record *re "tdb1_free: update_tailer failed at %u", offset); goto fail; } + tdb->stats.alloc_coalesce_succeeded++; + tdb->stats.alloc_coalesce_num_merged++; + tdb->stats.frees++; tdb1_unlock(tdb, -1, F_WRLCK); return 0; } @@ -151,6 +155,7 @@ update: } /* And we're done. */ + tdb->stats.frees++; tdb1_unlock(tdb, -1, F_WRLCK); return 0; @@ -188,6 +193,7 @@ static tdb1_off_t tdb1_allocate_ofs(struct tdb_context *tdb, if (tdb1_rec_write(tdb, rec_ptr, rec) == -1) { return 0; } + tdb->stats.allocs++; return rec_ptr; } @@ -215,6 +221,8 @@ static tdb1_off_t tdb1_allocate_ofs(struct tdb_context *tdb, return 0; } + tdb->stats.allocs++; + tdb->stats.alloc_leftover++; return rec_ptr; } |