From: Jens Axboe <jens.axboe@oracle.com>
To: David Andersen <dga@cs.cmu.edu>
Cc: fio@vger.kernel.org
Subject: Re: Tiny fio performance bug with debug enabled
Date: Fri, 19 Mar 2010 08:07:10 +0100 [thread overview]
Message-ID: <20100319070709.GL5768@kernel.dk> (raw)
In-Reply-To: <3D141235-660E-4F6D-8179-F106156B78A4@cs.cmu.edu>
On Thu, Mar 18 2010, David Andersen wrote:
> Hi, fio hackers:
>
> Version 285d451f5c3e034463ea49a5ba99e8e0eb1b83a2
> (snapshot from yesterday)
>
> Tiny performance tweak with -DFIO_INC_DEBUG enabled but no debug flags specified (the default if building from source): the dprint macro calls getpid() before checking to see whether or not it's going to actually do anything. This causes a bit of a slowdown if you've built with debugging but aren't using it. The fix is to simply swap them:
>
> debug.h:
>
> #define dprint(type, str, args...) \
> do { \
> assert(type < FD_DEBUG_MAX); \
> if ((((1 << type)) & fio_debug) == 0) \
> break; \
> pid_t pid = getpid(); \
>
> I wasn't sure what the style guidelines were for non-initial declaration & assignment, though...
>
> Reproducing: run fio under 'perf'; observe 1.x% of time taken by getpid(). :)
Thanks, I'll commit a fix for that.
--
Jens Axboe
prev parent reply other threads:[~2010-03-19 7:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-19 3:10 Tiny fio performance bug with debug enabled David Andersen
2010-03-19 7:07 ` Jens Axboe [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=20100319070709.GL5768@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=dga@cs.cmu.edu \
--cc=fio@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