Re: Tiny fio performance bug with debug enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux