linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <jbacik@fusionio.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs-progs: add a bunch of new statistics to btrfs-calc-size
Date: Fri, 20 Sep 2013 19:23:46 +0200	[thread overview]
Message-ID: <20130920172346.GL6810@twin.jikos.cz> (raw)
In-Reply-To: <1379691161-4125-1-git-send-email-jbacik@fusionio.com>

On Fri, Sep 20, 2013 at 11:32:41AM -0400, Josef Bacik wrote:
> 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

Nice!

> +	/* Make a tick count as 5% of the total seeks */
> +	tick_interval = stat->total_seeks / 20;
> +	printf("\tSeek histogram\n");
> +	for (; n; n = rb_next(n)) {
> +		u64 ticks, gticks = 0;
> +
> +		seek = rb_entry(n, struct seek, n);
> +		ticks = seek->count / tick_interval;
> +		if (group_count)
> +			gticks = group_count / tick_interval;

Divsion by zero, core dumped.

>  		total_size = pretty_sizes(stat.total_bytes);

> +		printf("\tTotal size: %s\n", total_size);

>  		free(total_size);

There's the pretty_size thing that can be used directly in printf and
without free(). I've switched them all and committed to integration.
Please send a separate fix for the 0-division problem.

david

      reply	other threads:[~2013-09-20 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 15:32 [PATCH] Btrfs-progs: add a bunch of new statistics to btrfs-calc-size Josef Bacik
2013-09-20 17:23 ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130920172346.GL6810@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).