Btrfs-progs: add a bunch of new statistics to btrfs-calc-size
authorJosef Bacik <jbacik@fusionio.com>
Fri, 20 Sep 2013 15:32:41 +0000 (11:32 -0400)
committerChris Mason <chris.mason@fusionio.com>
Wed, 16 Oct 2013 12:23:11 +0000 (08:23 -0400)
commitb5efa4c3c9cd879e2f8079c56df8e38ae7024121
tree0ddcce9079fa554fa64a12e57f5d6461cfd82458
parent7fbcc39c3075b88718bcb3e8e6f3ff599a4e9f86
Btrfs-progs: add a bunch of new statistics to btrfs-calc-size

I've been wanting to get back to the allocator and make some changes to try and
fix our fragmenation woes with lots of metadata.  But in order to make these
changes I need to have something to tell me if my changes are making a real
measurable difference.  So this patch adds a bunch of new statistics to
btrfs-calc-size.  It will tell me how long it took to read in the trees, how
many seeks it had (both forward and backward).  It will tell me how far spread
out the tree is and spit out a nice histogram of the seeks.  Here is some sample
output

Calculating size of extent tree
        Total size: 60.74MB
                Inline data: 0.00
        Total seeks: 5020
                Forward seeks: 3691
                Backward seeks: 1329
                Avg seek len: 929.53MB
        Seek histogram
                      4096 -       4096:       1043 ####
                      8192 -      73728:        760 ###
                     81920 -   52527104:        753 ###
                  53518336 -  168009728:        753 ###
                 168591360 -  696045568:        753 ###
                 696238080 - 7560364032:        753 ###
                7560437760 - 8409739264:        178 |
        Total clusters: 1874
                Avg cluster size: 25.17KB
                Min cluster size: 8.00KB
                Max cluster size: 472.00KB
        Total disk spread: 7.90GB
        Total read time: 0 s 341670 us
        Levels: 4

This way we can have good numbers to back up any changes we make to the
allocator.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
btrfs-calc-size.c