blktrace.git
21 months agobtt: make device/devno use PATH_MAX to avoid overflow
Jens Axboe [Wed, 2 May 2018 16:24:17 +0000 (10:24 -0600)]
btt: make device/devno use PATH_MAX to avoid overflow

Herbo Zhang reports:

I found a bug in blktrace/btt/devmap.c. The code is just as follows:

https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git/tree/btt/devmap.c?id=8349ad2f2d19422a6241f94ea84d696b21de4757

       struct devmap {

struct list_head head;
char device[32], devno[32];    // #1
};

LIST_HEAD(all_devmaps);

static int dev_map_add(char *line)
{
struct devmap *dmp;

if (strstr(line, "Device") != NULL)
return 1;

dmp = malloc(sizeof(struct devmap));
if (sscanf(line, "%s %s", dmp->device, dmp->devno) != 2) {  //#2
free(dmp);
return 1;
}

list_add_tail(&dmp->head, &all_devmaps);
return 0;
}

int dev_map_read(char *fname)
{
char line[256];   // #3
FILE *fp = my_fopen(fname, "r");

if (!fp) {
perror(fname);
return 1;
}

while (fscanf(fp, "%255[a-zA-Z0-9 :.,/_-]\n", line) == 1) {
if (dev_map_add(line))
break;
}

fclose(fp);
return 0;
}

 The line length is 256, but the dmp->device, dmp->devno  max length
is only 32. We can put strings longer than 32 into dmp->device and
dmp->devno , and then they will be overflowed.

 we can trigger this bug just as follows:

 $ python -c "print 'A'*256" > ./test
    $ btt -M ./test

    *** Error in btt': free(): invalid next size (fast): 0x000055ad7349b250 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f7f158ce7e5]
    /lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f7f158d6e0a]
    /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f7f158da98c]
    btt(+0x32e0)[0x55ad7306f2e0]
    btt(+0x2c5f)[0x55ad7306ec5f]
    btt(+0x251f)[0x55ad7306e51f]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7f15877830]
    btt(+0x26b9)[0x55ad7306e6b9]
    ======= Memory map: ========
    55ad7306c000-55ad7307f000 r-xp 00000000 08:14 3698139
      /usr/bin/btt
    55ad7327e000-55ad7327f000 r--p 00012000 08:14 3698139
      /usr/bin/btt
    55ad7327f000-55ad73280000 rw-p 00013000 08:14 3698139
      /usr/bin/btt
    55ad73280000-55ad73285000 rw-p 00000000 00:00 0
    55ad7349a000-55ad734bb000 rw-p 00000000 00:00 0
      [heap]
    7f7f10000000-7f7f10021000 rw-p 00000000 00:00 0
    7f7f10021000-7f7f14000000 ---p 00000000 00:00 0
    7f7f15640000-7f7f15656000 r-xp 00000000 08:14 14942237
      /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f7f15656000-7f7f15855000 ---p 00016000 08:14 14942237
      /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f7f15855000-7f7f15856000 r--p 00015000 08:14 14942237
      /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f7f15856000-7f7f15857000 rw-p 00016000 08:14 14942237
      /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f7f15857000-7f7f15a16000 r-xp 00000000 08:14 14948477
      /lib/x86_64-linux-gnu/libc-2.23.so
    7f7f15a16000-7f7f15c16000 ---p 001bf000 08:14 14948477
      /lib/x86_64-linux-gnu/libc-2.23.so
    7f7f15c16000-7f7f15c1a000 r--p 001bf000 08:14 14948477
      /lib/x86_64-linux-gnu/libc-2.23.so
    7f7f15c1a000-7f7f15c1c000 rw-p 001c3000 08:14 14948477
      /lib/x86_64-linux-gnu/libc-2.23.so
    7f7f15c1c000-7f7f15c20000 rw-p 00000000 00:00 0
    7f7f15c20000-7f7f15c46000 r-xp 00000000 08:14 14948478
      /lib/x86_64-linux-gnu/ld-2.23.so
    7f7f15e16000-7f7f15e19000 rw-p 00000000 00:00 0
    7f7f15e42000-7f7f15e45000 rw-p 00000000 00:00 0
    7f7f15e45000-7f7f15e46000 r--p 00025000 08:14 14948478
      /lib/x86_64-linux-gnu/ld-2.23.so
    7f7f15e46000-7f7f15e47000 rw-p 00026000 08:14 14948478
      /lib/x86_64-linux-gnu/ld-2.23.so
    7f7f15e47000-7f7f15e48000 rw-p 00000000 00:00 0
    7ffdebe5c000-7ffdebe7d000 rw-p 00000000 00:00 0
      [stack]
    7ffdebebc000-7ffdebebe000 r--p 00000000 00:00 0
      [vvar]
    7ffdebebe000-7ffdebec0000 r-xp 00000000 00:00 0
      [vdso]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
      [vsyscall]
    [1]    6272 abort      btt -M test

Signed-off-by: Jens Axboe <axboe@kernel.dk>
22 months agoblkparse: add documetation for 'R' requeue request
Weiping Zhang [Sat, 7 Apr 2018 09:12:18 +0000 (17:12 +0800)]
blkparse: add documetation for 'R' requeue request

Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
22 months agoblkparse: remove duplicated entry for flag M
Weiping Zhang [Sat, 7 Apr 2018 09:12:00 +0000 (17:12 +0800)]
blkparse: remove duplicated entry for flag M

remove dupliated entry 'M' for man page of blkparse.

Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoblktrace: don't stop tracer if not setup trace successfully
weiping zhang [Mon, 15 Jan 2018 15:53:42 +0000 (23:53 +0800)]
blktrace: don't stop tracer if not setup trace successfully

if we run blktrace on same device twice, the second time will failed
to ioctl(BLKTRACESETUP), then it will call __stop_tracer, which lead
the first blktrace failed to access debugfs entries. So this patch add
a check to handle this case, to avoid stop tracer uncondionally.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agofix parallel build failures
Robin H. Johnson [Tue, 23 Jan 2018 22:57:55 +0000 (17:57 -0500)]
fix parallel build failures

When building in parallel, the btreplay/btrecord and btreplay/btreplay
targets cause make to kick off two jobs for `make -C btreplay` and they
sometimes end up clobbering each other.  We could fix this by making one
a dependency of the other, but it's a bit cleaner to refactor things to
be based on subdirs.  This way changes in subdirs also get noticed:
  $ touch btreplay/*.[ch]
  $ make
  <btreplay is now correctly updated>

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agorespect LDFLAGS when linking programs
Robin H. Johnson [Tue, 23 Jan 2018 22:47:19 +0000 (17:47 -0500)]
respect LDFLAGS when linking programs

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agobtt: Fix overlapping IO stats.
Gwendal Grignou [Fri, 18 Aug 2017 22:00:22 +0000 (15:00 -0700)]
btt: Fix overlapping IO stats.

Keep scanning the tree for overlapping IO otherwise Q2G and process
traces will be incorrect.

Let assume we have 2 IOs:

A                                      A+a
|---------------------------------------|
       B                B+b
       |-----------------|

In the red/black tree we have:

                    o -> [A,A+a]
                   / \
                left right
                 /    \
           [...]o      o -> [B, B+b]

In the current code, if we would not be able to find [B+b] in the tree:
B is greater than A, so we won't go left
B+b is smaller than A+a, so we are not going right either.

When we have a [X, X+x] IO to look for:
We need to check for right when either:
 X+x >= A+a (for merged IO)
and
 X > A (for overlapping IO)

TEST=Check with a trace with overlapping IO: Q2C and Q2G are expected.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agobtt/devs: silence warning on sprintf overflow
Jens Axboe [Sun, 5 Nov 2017 15:54:41 +0000 (08:54 -0700)]
btt/devs: silence warning on sprintf overflow

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agojhash: fix annoying gcc fall through warnings
Jens Axboe [Sun, 5 Nov 2017 15:52:21 +0000 (08:52 -0700)]
jhash: fix annoying gcc fall through warnings

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoBlktrace 1.2.0 blktrace-1.2.0
Jens Axboe [Sun, 5 Nov 2017 04:13:06 +0000 (22:13 -0600)]
Blktrace 1.2.0

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoblktrace: abort if device ioctl setup fails
Jens Axboe [Sun, 5 Nov 2017 04:10:00 +0000 (22:10 -0600)]
blktrace: abort if device ioctl setup fails

If we fail doing the BLKTRACESETUP ioctl, blktrace still marches on
and sets up the rest. This results in errors like the below:

blktrace /dev/sdf
BLKTRACESETUP(2) /dev/sdf failed: 5/Input/output error
Thread 1 failed open /sys/kernel/debug/block/(null)/trace1: 2/No such file or directory
Thread 3 failed open /sys/kernel/debug/block/(null)/trace3: 2/No such file or directory
Thread 2 failed open /sys/kernel/debug/block/(null)/trace2: 2/No such file or directory
[...]
FAILED to start thread on CPU 0: 1/Operation not permitted
FAILED to start thread on CPU 1: 1/Operation not permitted
FAILED to start thread on CPU 2: 1/Operation not permitted

and blktrace continues to run, though it can't do anything in this
state.

If the ioctl setup fails, just abort.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoblktrace: Create empty output files for non-existent cpus
Jan Kara [Thu, 26 Jan 2017 10:23:55 +0000 (11:23 +0100)]
blktrace: Create empty output files for non-existent cpus

When CPU number space is sparse, we don't start threads for non-existent
CPUs. As a result, there are no output files created for these CPUs
which confuses tools like blkparse which expect that CPU numbers are
contiguous. Create fake empty files for non-existent CPUs so that other
tools don't have to bother.

Note that in network mode, the server will create all files in the range
0..max_cpus automatically.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoblktrace: Reorganize creation of output file name
Jan Kara [Thu, 26 Jan 2017 10:23:54 +0000 (11:23 +0100)]
blktrace: Reorganize creation of output file name

We would like to generate output file name without having corresponding
iop structure. Reorganize the function to allow that. Also fix couple of
overflows possible when generating the file name when we are modifying
the code anyway.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoblktrace: Add support for sparse CPU numbers
Jan Kara [Thu, 26 Jan 2017 10:23:53 +0000 (11:23 +0100)]
blktrace: Add support for sparse CPU numbers

On some machines CPU numbers do not form a contiguous interval. In such
cases blktrace will fail to start threads for missing CPUs and exit
effectively rendering itself unusable.

Add support into blktrace to handle systems with sparse CPU numbers.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoiowatcher: link with -lrt
Thomas Petazzoni [Tue, 23 Aug 2016 14:41:21 +0000 (16:41 +0200)]
iowatcher: link with -lrt

Some C libraries (notably uClibc) have the posix_spawn*() functions in
librt, so let's link iowatcher with -lrt.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoblktrace: remove -k from manpage synopsis
Eric Sandeen [Wed, 18 May 2016 16:15:07 +0000 (11:15 -0500)]
blktrace: remove -k from manpage synopsis

An earlier commit:

  fb7f8667 blktrace: disable kill option - take 2

removed the "-k" option documentation, but left
it in the synopsis.

This is a bit unusual and unhelpful and probably
unintended; remove it from the synopsis as well.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoFixup graph name in help text
Jan Kara [Thu, 5 May 2016 15:17:12 +0000 (17:17 +0200)]
Fixup graph name in help text

Proper graph name is queue-depth, not queue_depth.

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoSeparate prefix in legend with space
Jan Kara [Thu, 5 May 2016 15:17:11 +0000 (17:17 +0200)]
Separate prefix in legend with space

Trace label isn't properly separated with space from suffix (Read /
Write). Fix it.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoDon't prepend blktrace destination dir if we didn't run blktrace
Jan Kara [Thu, 5 May 2016 15:17:10 +0000 (17:17 +0200)]
Don't prepend blktrace destination dir if we didn't run blktrace

When user specifies trace files directly via -t option, it doesn't make
sense to prepend blktrace destination directory to them (it is
especially confusing if you specify absolute path names with -t option
and this logic breaks the path names). So avoid that.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoZero sectors are strange
Jan Kara [Thu, 5 May 2016 15:17:09 +0000 (17:17 +0200)]
Zero sectors are strange

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agobtt: Replace overlapping IO
Jan Kara [Thu, 5 May 2016 15:17:08 +0000 (17:17 +0200)]
btt: Replace overlapping IO

Currently btt keeps the original IO in its RB-tree even if it sees new
IO that is beginning at the same sector. However such IO most likely
means that we have just lost the completion event for the IO that is
still in the tree. So in such case replacing the IO in RB-tree makes
more sense to avoid bogus IOs being reported as taking huge amount of
time.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoiowatcher: Use queue events if issue not available
Jan Kara [Thu, 5 May 2016 15:17:07 +0000 (17:17 +0200)]
iowatcher: Use queue events if issue not available

Currently queue depth and latency graphs are generated from ISSUE and
COMPLETE events. For traces which miss the ISSUE events (e.g. from
device mapper) use QUEUE events instead. The result won't be as great
but it still conveys some useful information.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoProcess notify events outside of given interval
Jan Kara [Thu, 5 May 2016 15:17:06 +0000 (17:17 +0200)]
Process notify events outside of given interval

When parsing blktrace data, process notify events even outside the
specified interval. This way we can learn about time stamps, process
names etc.

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoUse maximum over all traces for queue depth
Jan Kara [Thu, 5 May 2016 15:17:05 +0000 (17:17 +0200)]
Use maximum over all traces for queue depth

So far we used maximum of the first trace for the maximum range of the
queue depth graph. Use maximum over all traces similarly as for other
line graphs.

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agoBetter max estimate for line graphs
Jan Kara [Thu, 5 May 2016 15:17:04 +0000 (17:17 +0200)]
Better max estimate for line graphs

Use maximum of rolling average as the upper range end for the line graph
to use better the available space in the plot.

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agobtt/unplug_hist: fix bad memset
Jens Axboe [Tue, 3 May 2016 14:34:50 +0000 (08:34 -0600)]
btt/unplug_hist: fix bad memset

Just replace the malloc/memset with a calloc().

Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agobtreplay: remove timestamps
Olaf Hering [Fri, 20 Feb 2015 08:06:39 +0000 (09:06 +0100)]
btreplay: remove timestamps

Using __DATE__ and __TIME__ will break reproducible builds. The
resulting binary will change with each rebuild even if the source and
toolchain is identical.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agobtreplay: make Ctrl-C work
Roman Pen [Sat, 23 Apr 2016 11:44:10 +0000 (13:44 +0200)]
btreplay: make Ctrl-C work

is_reap_done() must also check that SIGINT or SIGTERM have come, or
we hang forever with such backtraces after Ctrl-C:

 (gdb) thr a a bt

 Thread 3 (Thread 0x7fbff8ff9700 (LWP 12607)):
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
 #1  0x0000000000402698 in replay_rec () at btreplay.c:1035
 #2  0x00007fc001fe5454 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
 #3  0x00007fc001d1eecd in ?? () from /lib/x86_64-linux-gnu/libc.so.6
 #4  0x0000000000000000 in ?? ()

 Thread 2 (Thread 0x7fbfea7fc700 (LWP 12611)):
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
 #1  0x0000000000402698 in replay_rec () at btreplay.c:1035
 #2  0x00007fc001fe5454 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
 #3  0x00007fc001d1eecd in ?? () from /lib/x86_64-linux-gnu/libc.so.6
 #4  0x0000000000000000 in ?? ()

 Thread 1 (Thread 0x7fc00282e700 (LWP 12597)):
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
 #1  0x0000000000402303 in __wait_cv () at btreplay.c:413
 #2  0x0000000000401ae8 in main () at btreplay.c:426

Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: <linux-btrace@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agobtreplay: fix sched_{set|get}affinity
Roman Pen [Sat, 23 Apr 2016 11:44:09 +0000 (13:44 +0200)]
btreplay: fix sched_{set|get}affinity

getpid() is a pid of a process, at least tid must be provided.
But if zero is passed, then calling thread will be used.
That exactly what is needed.

Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: <linux-btrace@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
3 years agobtreplay: fix memory corruption caused by CPU_ZERO_S
Roman Pen [Sat, 23 Apr 2016 11:44:08 +0000 (13:44 +0200)]
btreplay: fix memory corruption caused by CPU_ZERO_S

Size should be provided, not cpus number.

Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: <linux-btrace@vger.kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
4 years agoblktrace: Use number of online CPUs
Abutalib Aghayev [Tue, 9 Feb 2016 15:17:50 +0000 (08:17 -0700)]
blktrace: Use number of online CPUs

Currently, blktrace uses _SC_NPROCESSORS_CONF to find out the number of
CPUs.  This is a problem, because if you reduce the number of online
CPUs by passing kernel parameter maxcpus, then blktrace fails to start
with the error:

FAILED to start thread on CPU 4: 22/Invalid argument
FAILED to start thread on CPU 5: 22/Invalid argument
...

The attached patch fixes it to use _SC_NPROCESSORS_ONLN.

Signed-off-by: Jens Axboe <axboe@fb.com>
4 years agoAdd the "-a discard" filter option to the blktrace.8 man page
John Groves [Fri, 8 Jan 2016 18:46:03 +0000 (11:46 -0700)]
Add the "-a discard" filter option to the blktrace.8 man page

Signed-off-by: Jens Axboe <axboe@fb.com>
4 years agoFix warnings on newer gcc
Jens Axboe [Tue, 15 Sep 2015 14:48:06 +0000 (08:48 -0600)]
Fix warnings on newer gcc

Signed-off-by: Jens Axboe <axboe@fb.com>
4 years agoinclude sys/types.h for dev_t definition
Khem Raj [Tue, 15 Sep 2015 00:05:21 +0000 (00:05 +0000)]
include sys/types.h for dev_t definition

Avoids the build failures when sys/types.h does not get included
indirectly through other headers.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
4 years agobtreplay: Fix typo in scaling up the dynamic cpu set size.
Josef Cejka [Thu, 20 Aug 2015 15:52:51 +0000 (11:52 -0400)]
btreplay: Fix typo in scaling up the dynamic cpu set size.

In get_ncpus, we default to using 4096 CPUs if _SC_NPROCESSORS_CONF isn't
enabled.  If that is insufficient, sched_getaffinity will fail and we
retry after doubling the size of the cpu_set_t allocation.  There's a typo
in there that means we don't actually double the size and will loop
forever allocating the same sized cpu_set_t instead.

Signed-off-by: Josef Cejka <jcejka@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
5 years agoRefer to sda instead of hda in man pages
Olaf Hering [Wed, 18 Feb 2015 12:03:55 +0000 (13:03 +0100)]
Refer to sda instead of hda in man pages

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
5 years agoiowatcher: wrap system() in a checker function
Jens Axboe [Thu, 25 Sep 2014 21:17:06 +0000 (15:17 -0600)]
iowatcher: wrap system() in a checker function

Kills the errors on unchecked return of system()

Signed-off-by: Jens Axboe <axboe@fb.com>
5 years agoMerge branch 'for-upstream' of https://github.com/andyprice/blktrace
Jens Axboe [Thu, 25 Sep 2014 21:11:24 +0000 (15:11 -0600)]
Merge branch 'for-upstream' of https://github.com/andyprice/blktrace

Andrew says:

Here are some trivial tweaks which I found were needed or desirable while
adding iowatcher to the blktrace packaging in Fedora. They improve the
integration of iowatcher into the tree and reduce duplication of docs.

5 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mason/blktrace
Jens Axboe [Thu, 25 Sep 2014 21:11:06 +0000 (15:11 -0600)]
Merge git://git./linux/kernel/git/mason/blktrace

Signed-off-by: Jens Axboe <axboe@fb.com>
Conflicts:
iowatcher/Makefile

5 years agoAdd iowatcher requirements to README
Andrew Price [Thu, 25 Sep 2014 20:00:31 +0000 (21:00 +0100)]
Add iowatcher requirements to README

Merge the requirements bits of iowatcher/README into README

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: check the return value from write()
Chris Mason [Thu, 25 Sep 2014 20:13:17 +0000 (16:13 -0400)]
iowatcher: check the return value from write()

Signed-off-by: Chris Mason <clm@fb.com>
5 years agoiowatcher: fixup the Makefile
Chris Mason [Thu, 25 Sep 2014 20:12:21 +0000 (16:12 -0400)]
iowatcher: fixup the Makefile

We were setting C=gcc instead of CC=gcc, and using -O0.  Fix both.

Signed-off-by: Chris Mason <clm@fb.com>
5 years agoiowatcher: Remove iowatcher/README
Andrew Price [Thu, 25 Sep 2014 19:49:47 +0000 (20:49 +0100)]
iowatcher: Remove iowatcher/README

This README is getting out-of-date and its contents are duplicated in
the iowatcher manpage which is up-to-date, so remove it to reduce
duplication of effort.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Move iowatcher.1 into doc directory
Andrew Price [Thu, 25 Sep 2014 19:47:57 +0000 (20:47 +0100)]
iowatcher: Move iowatcher.1 into doc directory

iowatcher's manpage wasn't being installed with the other manpages so
add it to the doc directory.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Add iowatcher to .gitignore
Andrew Price [Thu, 25 Sep 2014 19:45:44 +0000 (20:45 +0100)]
iowatcher: Add iowatcher to .gitignore

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoMakefile: ensure that iowatcher gets cleaned
Jens Axboe [Wed, 24 Sep 2014 20:49:04 +0000 (14:49 -0600)]
Makefile: ensure that iowatcher gets cleaned

Signed-off-by: Jens Axboe <axboe@fb.com>
5 years agoblktrace 1.1.0 blktrace-1.1.0
Jens Axboe [Wed, 24 Sep 2014 19:52:31 +0000 (13:52 -0600)]
blktrace 1.1.0

Bump it up to a full 1.1 since we now include iowatcher.

Signed-off-by: Jens Axboe <axboe@fb.com>
5 years agoiowatcher: add iowatcher to the main blktrace Makefile
Chris Mason [Wed, 24 Sep 2014 19:09:51 +0000 (12:09 -0700)]
iowatcher: add iowatcher to the main blktrace Makefile

Signed-off-by: Chris Mason <clm@fb.com>
5 years agoMerge the iowatcher repository
Chris Mason [Wed, 24 Sep 2014 19:03:35 +0000 (12:03 -0700)]
Merge the iowatcher repository

5 years agoiowatcher: Properly initialize trace.name in find_trace_file
Chris Mason [Wed, 24 Sep 2014 16:44:45 +0000 (09:44 -0700)]
iowatcher: Properly initialize trace.name in find_trace_file

Signed-off-by: Chris Mason <clm@fb.com>
5 years agoiowatcher: Fix up some strcpy and strcat usage
Andrew Price [Sun, 27 Apr 2014 05:16:01 +0000 (06:16 +0100)]
iowatcher: Fix up some strcpy and strcat usage

Fix an unchecked strcpy and strcat in plot_io_movie():

  $ ./iowatcher -t foo --movie -o foo.ogv -l $(printf 'x%.0s' {1..300})
  [...]
  *** buffer overflow detected ***: ./iowatcher terminated

There was also very similar code in plot_io() so a new function
plot_io_legend() was added to factor out the common string building code
and replace the buggy code with asprintf().

Also add a closedir() call to an error path in traces_list() to plug a
resource leak and make iowatcher Coverity-clean (ignoring some
false-positives).

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Clean up some unused functions, make others static
Andrew Price [Sun, 27 Apr 2014 02:58:40 +0000 (03:58 +0100)]
iowatcher: Clean up some unused functions, make others static

Adding -Wmissing-prototypes showed some functions could be made static
and my 'findunused' script showed some functions weren't being called.

This patch was tested by building from scratch and running with various
combinations of options.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Update usage info and improve man page
Andrew Price [Sun, 27 Apr 2014 02:32:17 +0000 (03:32 +0100)]
iowatcher: Update usage info and improve man page

Bring the man page and usage string up-to-date with the new -p behaviour
and improve the formatting and content of the man page.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Convert start_mpstat to run_program
Andrew Price [Sun, 27 Apr 2014 00:55:57 +0000 (01:55 +0100)]
iowatcher: Convert start_mpstat to run_program

For consistency and deduplication, use run_program in start_mpstat.  Add
the ability to pass a path to run_program, which will be opened in the
spawned process and used as stdout, in order to capture mpstat output.
This fixes a tricky descriptor leak in start_mpstat which could have
caused a race condition if it was fixed with close().

Some output formatting tweaks have also been added and a bug from a
previous patch, where tracers were killed immediately when -p wasn't
specified, has been fixed.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Convert start_blktrace to run_program
Andrew Price [Sat, 26 Apr 2014 22:00:58 +0000 (23:00 +0100)]
iowatcher: Convert start_blktrace to run_program

Rework start_blktrace and use run_program to launch blktrace. Move the
argv-building into the function so that it's easier to work with and
clean it up a bit. Add a signal parameter to wait_program to optionally
kill the pid with a given signal before waiting for it.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Rework --prog to make arg processing safer
Andrew Price [Sat, 26 Apr 2014 17:22:53 +0000 (18:22 +0100)]
iowatcher: Rework --prog to make arg processing safer

Previously the --prog option required the program-to-be-run to be
specified as a single string. This meant that shell escaping would be
lost in translation and a sub-shell would be run. Rework --prog to not
take an argument and accept the arguments left after option processing
has ended as the argv for the program-to-be-run.

As we have the program as an argv, run_program2() can now be used to run
it, and now that run_program() is no longer used we can remove it and
remove the '2' from run_program2.

New usage example:

 # iowatcher -p -t foo -d /dev/sda3 sleep 10
 running blktrace blktrace -b 8192 -a queue -a complete -a issue -a notify -D . -d /dev/sda3 -o foo
 running 'sleep' '10'
 sleep exited with 0
 ...

Docs have been updated accordingly.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Separate program running from waiting
Andrew Price [Sat, 26 Apr 2014 14:31:19 +0000 (15:31 +0100)]
iowatcher: Separate program running from waiting

Until now run_program2() was a replacement for system() so it always
waited for the process to end before returning. To make this function
more useful move the waiting code into a separate function and add a
mechanism to expect a specific exit code.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Correct a couple of calloc calls
Andrew Price [Sat, 26 Apr 2014 02:49:22 +0000 (03:49 +0100)]
iowatcher: Correct a couple of calloc calls

(Caught by Coverity.) tf->gdd_writes and tf->gdd_reads are arrays of
pointers so update their allocations to use the correct element size.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Simplify temp movie directory creation
Andrew Price [Sat, 26 Apr 2014 01:56:17 +0000 (02:56 +0100)]
iowatcher: Simplify temp movie directory creation

plot_io_movie() was calling create_movie_temp_dir() which unnecessarily
strdup()ed a string constant leaving plot_io_movie() to free it. Replace
the strdup() with a mutable char array and get rid of the free(). Merge
the few remaining lines which create the movie dir into plot_io_movie().

Also prune a duplicate declaration of start_mpstat() in tracers.h

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Merge trace dumping functions into one
Andrew Price [Fri, 28 Mar 2014 01:47:27 +0000 (01:47 +0000)]
iowatcher: Merge trace dumping functions into one

Now that combine_blktrace_devs() takes a list of traces it's fairly
generic so we might as well merge blktrace_to_dump() into it. The latter
can be replaced with a call using a list with a single entry.

combine_blktrace_devs() is renamed dump_traces() because that's what it
does.

Also eradicate the big global char array 'line' that was being used in a
bunch of places along with some more unnecessary strdup()s.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Check program exit code properly
Andrew Price [Fri, 28 Mar 2014 01:42:47 +0000 (01:42 +0000)]
iowatcher: Check program exit code properly

The return value of posix_spawnp() was being checked but the exit status
of the child process was being ignored. This adds checks and error
reporting based on the status that waitpid returns.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Fix up directory trace processing
Andrew Price [Thu, 27 Mar 2014 21:59:38 +0000 (21:59 +0000)]
iowatcher: Fix up directory trace processing

Similar to the fix for spaces in file names in commit 5d845e3, this
patch fixes processing of directories with spaces in their names by
using posix_spawnp() to run the blkparse command instead of system(). In
doing so, combine_blktrace_devs() and match_trace() have been reworked
to use a list structure instead of doing a lot of strdup()ing and string
appending.

Also make sure that trailing slashes are removed from the directory name
before attempting to use it as the base of the .dump filename.

Update the -t entry in the manpage to mention directory behaviour, too.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Handle REQUEUE events
Jan Kara [Thu, 4 Apr 2013 10:18:28 +0000 (06:18 -0400)]
iowatcher: Handle REQUEUE events

When requeue event happens we have to decrease number of in-flight
requests. Otherwise they drift away.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Make seconds unsigned
Jan Kara [Thu, 4 Apr 2013 10:18:27 +0000 (06:18 -0400)]
iowatcher: Make seconds unsigned

Compiler was giving some warnings about signed vs unsigned comparisons.
Although these were harmless, make seconds unsigned because they really
are.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Remove duplicate defines from blkparse.c
Jan Kara [Thu, 4 Apr 2013 10:18:26 +0000 (06:18 -0400)]
iowatcher: Remove duplicate defines from blkparse.c

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Skip events beyond max_seconds
Jan Kara [Thu, 4 Apr 2013 10:18:25 +0000 (06:18 -0400)]
iowatcher: Skip events beyond max_seconds

Skip events beyond max_seconds.  This not only saves CPU time but also
prevents memory corruption because not all functions were checking that
given time is in the expected range. Also remove now unnecessary checks
in the called functions.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Do not add events out of time range to the plot
Jan Kara [Thu, 4 Apr 2013 10:18:24 +0000 (06:18 -0400)]
iowatcher: Do not add events out of time range to the plot

If the event is out of time range that should be plotted, do not add it.
It will corrupt memory...

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fine tune the ticks
Chris Mason [Tue, 24 Sep 2013 19:30:35 +0000 (15:30 -0400)]
iowatcher: Fine tune the ticks

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Update the README for a few new options
Chris Mason [Tue, 24 Sep 2013 19:30:23 +0000 (15:30 -0400)]
iowatcher: Update the README for a few new options

5 years agoiowatcher: Fix processing of trace filenames containing spaces
Andrew Price [Fri, 8 Nov 2013 10:06:54 +0000 (10:06 +0000)]
iowatcher: Fix processing of trace filenames containing spaces

blktrace_to_dump passes filenames containing spaces to blkparse via
system() so only the first chunk of the string is taken to be the
filename by the subprocess.

This switches to using posix_spawnp() so that we can present the
filename as an element of argv and avoid iowatcher failing in these
cases.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Add bounds checking in find_step
Andrew Price [Wed, 6 Nov 2013 16:11:18 +0000 (16:11 +0000)]
iowatcher: Add bounds checking in find_step

Check the value of cur_mini_step is sane before using it as an index to
mini_step array.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Fix a label overflow in plot_io
Andrew Price [Thu, 5 Sep 2013 16:35:04 +0000 (17:35 +0100)]
iowatcher: Fix a label overflow in plot_io

The length of the label option wasn't being checked before strcpy()ing
it into a char[256]. Use strncpy instead.

Signed-off-by: Andrew Price <anprice@redhat.com>
5 years agoiowatcher: Don't print a legend on the tput graphs during movies
Chris Mason [Mon, 21 Jan 2013 16:22:58 +0000 (11:22 -0500)]
iowatcher: Don't print a legend on the tput graphs during movies

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Update the FSF address in all files
Chris Mason [Mon, 21 Jan 2013 15:28:33 +0000 (10:28 -0500)]
iowatcher: Update the FSF address in all files

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Update the COPYING file to the correct address
Chris Mason [Mon, 21 Jan 2013 15:17:44 +0000 (10:17 -0500)]
iowatcher: Update the COPYING file to the correct address

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Add support for fio bandwith logs (-F logfile)
Chris Mason [Fri, 18 Jan 2013 16:08:39 +0000 (11:08 -0500)]
iowatcher: Add support for fio bandwith logs (-F logfile)

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix formatting errors in the iowatcher.1 man page.
Chris Mason [Thu, 17 Jan 2013 17:45:42 +0000 (12:45 -0500)]
iowatcher: Fix formatting errors in the iowatcher.1 man page.

Thanks to Andrew Price for sending me the corrected version

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix mpstat handling when the number of CPUs is not
Chris Mason [Thu, 17 Jan 2013 03:25:28 +0000 (22:25 -0500)]
iowatcher: Fix mpstat handling when the number of CPUs is not
in the mpstat output

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Handle traces to more than once device at a time
Chris Mason [Tue, 15 Jan 2013 01:59:06 +0000 (20:59 -0500)]
iowatcher: Handle traces to more than once device at a time

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: iowatcher: specify ffmpeg codec
Nikita Danilov [Wed, 19 Dec 2012 18:27:21 +0000 (11:27 -0700)]
iowatcher: iowatcher: specify ffmpeg codec

    Add -C option to specify ffmped video code to use.

    Allow ffmpeg video codec to be specified on the command line. "libx264" is
    default.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Add a man page for iowatcher
Andrew Price [Wed, 19 Dec 2012 18:54:45 +0000 (11:54 -0700)]
iowatcher: Add a man page for iowatcher

Adds a man page from iowatcher. Borrows some documentation from the
README file but covers all of the options found in main.c

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix spindle rotation in the movie mode
Chris Mason [Mon, 14 Jan 2013 21:05:13 +0000 (16:05 -0500)]
iowatcher: Fix spindle rotation in the movie mode

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix some rounding errors around the max offset
Chris Mason [Fri, 26 Oct 2012 19:23:40 +0000 (15:23 -0400)]
iowatcher: Fix some rounding errors around the max offset

set_gdd_bit makes sure that we don't try to set bits past the max offset
we used to allocate our gdd array.

But, it only does this when the function is first called, and the whole
byte range for the IO we're recording may go past max offset.  This adds
a check to be sure we stay in the right range.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix crash due to missing queue action
Jan Kara [Tue, 23 Oct 2012 09:05:31 +0000 (11:05 +0200)]
iowatcher: Fix crash due to missing queue action

When queue action was missing from a trace, handling of dispatch didn't
quite get things right and crashed due to NULL pointer dereference.
Fix it.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Add -K command line option to keep the movie svg files
Chris Mason [Mon, 22 Oct 2012 15:51:41 +0000 (11:51 -0400)]
iowatcher: Add -K command line option to keep the movie svg files

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Only hash IOs if there are completion or issue events
Chris Mason [Mon, 22 Oct 2012 15:22:55 +0000 (11:22 -0400)]
iowatcher: Only hash IOs if there are completion or issue events

We use an IO hash table to keep track of the IOs in flight, and this is
used to calculate the latencies from when we issue the IO to when
we complete the IO.

But if there are no completion events, io is never removed from the hash
table.  It grows very large and slows down the run.

Since we already scan all the events looking for outliers, this commit
checks for each major type of event during the scan.  If there are
no completion and no issue events, we don't bother inserting things
into the hash table.

If there are no completion events, we clean up during the issue event.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: iowatcher: support png2theora for videos
Eric Sandeen [Thu, 18 Oct 2012 21:42:38 +0000 (15:42 -0600)]
iowatcher: iowatcher: support png2theora for videos

ffmpeg is not available on all distributions, so include Theora
as an option, via png2theora, if the output movie filename ends
in .ogg or .ogv

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix path name handling when the trace files are in the current directory
Chris Mason [Wed, 17 Oct 2012 19:45:49 +0000 (15:45 -0400)]
iowatcher: Fix path name handling when the trace files are in the current directory

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: Fix buffer overwrite issue
Yuanhan Liu [Fri, 12 Oct 2012 16:09:29 +0000 (10:09 -0600)]
iowatcher: Fix buffer overwrite issue

Current code allocates buffer for path based on strdup, which would let
the size of path equals to the size of blktrace_dest_dir. But the code
next that joins it with the filename of dump file, which would overwrite
the buffer, and triggered an issue like following:

$ ./iowatcher -t trace.dump -o trace.svg
Unable to find trace file ./trace.dumpY
                                      ^

Refactoring join_path a bit to fix this issue.

Cc: Liu Bo <liub.liubo@gmail.com>
Signed-off-by: Yuanhan Liu <yliu.null@gmail.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agoiowatcher: add blktrace destination options
Liu Bo [Fri, 28 Sep 2012 03:55:14 +0000 (21:55 -0600)]
iowatcher: add blktrace destination options

Add 'D' for blktrace destination options so that we can save trace
in the destination directory.

Signed-off-by: Liu Bo <liub.liubo@gmail.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
5 years agosignal condition variable at end of stop_tracers
Robert Schiele [Mon, 8 Sep 2014 07:38:52 +0000 (09:38 +0200)]
signal condition variable at end of stop_tracers

stop_tracers modifies tp->is_done and thus must signal the condition
variable tracer_wait_unblock is waiting on to monitor tp->is_done.
Not doing so might cause the tool to deadlock if stop_tracers is
called while a tracer thread is in tracer_wait_unblock.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
5 years agoremove unused barrier.h
Riku Voipio [Fri, 11 Apr 2014 11:51:19 +0000 (14:51 +0300)]
remove unused barrier.h

While looking for things that needs porting for Aarch64,
barrier.h from blktrace was identified. However, a deeper
look shows that this file is not actually used anymore
in blktrace.

Remove unused file to avoid future confusion.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
6 years agoblktrace bno_plot.py: output comprehensive message when gnuplot not found
Eiichi Tsukata [Tue, 3 Dec 2013 12:04:59 +0000 (21:04 +0900)]
blktrace bno_plot.py: output comprehensive message when gnuplot not found

Currently, bno_plot.py uses os.execvp which does not show enough information
when executed command is not found. For example, when gnuplot is not found
bno_plot.py shows the following messages:

    Traceback (most recent call last):
      File "/usr/local/bin/bno_plot.py", line 123, in <module>
        os.execvp(cmd[0], cmd)
      File "/usr/lib64/python2.7/os.py", line 344, in execvp
        _execvpe(file, args)
      File "/usr/lib64/python2.7/os.py", line 368, in _execvpe
        func(file, *argrest)
    OSError: [Errno 2] No such file or directory

Users can't understand what happend directly from the message.

Instead of os.execvp, this patch uses os.system which shows the following
messages when gnuplot not found:

    sh: gnuplot: command not found

Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoblktrace blkreplay: convert to use a dynamic cpu_set_t
Nathan Zimmer [Mon, 15 Apr 2013 14:53:36 +0000 (09:53 -0500)]
blktrace blkreplay: convert to use a dynamic cpu_set_t

Some distros have changed CPU_SETSIZE in glibc to 4096 since that matches
the NR_CPUS in the linux kernel config file.  Some distros have decided to
leave CPU_SETSIZE at 1024. This is a problem if you want to run that distro
on a very large machine.

CPU_SETSIZE is use by the struct cpu_set_t.  This means you to deal with cpus
greater the 1024 you must use the dynamic cpu sets, which involves converting
from things like CPU_SET to CPU_SET_S.

Cc: Jens Axboe <axboe@kernel.dk>
Modified by Jens to fix the CPU_{SET,ZERO}_S pointer mixup.

Signed-off-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoblktrace: use number of configured cpus instead of online cpus
Nathan Zimmer [Mon, 15 Apr 2013 14:53:35 +0000 (09:53 -0500)]
blktrace: use number of configured cpus instead of online cpus

We want to run on all online processors.  However is there is a hole in the
online cpumask this won't happen.  We need the number of configured processors
instead of online.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agobtreplay: use sysconf to get the number of configured cpus
Nathan Zimmer [Mon, 15 Apr 2013 14:53:34 +0000 (09:53 -0500)]
btreplay: use sysconf to get the number of configured cpus

We should use the standard methods for getting the number of cpus in the
system when they are available.  It is good practice to leave the old ways in
place for people stuck on older systems.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agobtreplay: Machines are now large enough that holes need to be dealt with
Nathan Zimmer [Mon, 15 Apr 2013 14:53:33 +0000 (09:53 -0500)]
btreplay: Machines are now large enough that holes need to be dealt with

The current method fails if once we hit the first offlined cpu.  This
will correct that case.  However this still underreports the number cpus if
the last cpu are offlined.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoverify_blkparse: Change max_cpus to deal with systems larger the 512
Nathan Zimmer [Mon, 15 Apr 2013 14:53:32 +0000 (09:53 -0500)]
verify_blkparse: Change max_cpus to deal with systems larger the 512

verify_blkpars has troubles with systems larger then 512.
Also there is issue in the scanning code causing the cpu number to be
truncated to the first two digits. i.e cpu 542 would be read as 54.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMore accurate calculation of the total read/write values
Ivan Dyukov [Tue, 19 Mar 2013 14:16:27 +0000 (08:16 -0600)]
More accurate calculation of the total read/write values

If block device has many request with size less than 1K,
blkparse ignores such requests because it treats each request
in Kb.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 years agoiowatcher: Per process IO graphs
Jan Kara [Mon, 10 Sep 2012 08:09:48 +0000 (10:09 +0200)]
iowatcher: Per process IO graphs

Add support for displaying different processes with different color in
the IO graph and movie.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>