Commit ea2c9149 authored by Dmitry Smirnov's avatar Dmitry Smirnov

removing upstream files from working tree

parent d73eed76
This diff is collapsed.
CC = gcc
CFLAGS = -Wall -O2 -g -W
ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PROGS = blkparse blktrace verify_blkparse blkrawverify blkiomon
LIBS = -lpthread
SCRIPTS = btrace
ALL = $(PROGS) $(SCRIPTS) btt/btt btreplay/btrecord btreplay/btreplay \
btt/bno_plot.py
all: $(ALL)
btt/btt:
$(MAKE) -C btt
btreplay/btrecord:
$(MAKE) -C btreplay
btreplay/btreplay:
$(MAKE) -C btreplay
%.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
blkparse: blkparse.o blkparse_fmt.o rbtree.o act_mask.o
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
blktrace: blktrace.o act_mask.o
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
verify_blkparse: verify_blkparse.o
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
blkrawverify: blkrawverify.o
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
blkiomon: blkiomon.o rbtree.o
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) -lrt
$(PROGS): | depend
docs:
$(MAKE) -C doc all
$(MAKE) -C btt docs
$(MAKE) -C btreplay docs
docsclean:
$(MAKE) -C doc clean
$(MAKE) -C btt clean
$(MAKE) -C btreplay clean
depend:
@$(CC) -MM $(ALL_CFLAGS) *.c 1> .depend
INSTALL = install
prefix = /usr/local
bindir = $(prefix)/bin
mandir = $(prefix)/man
RPMBUILD = rpmbuild
TAR = tar
export prefix INSTALL TAR
dist: btrace.spec
git-tar-tree HEAD btrace-1.0 > btrace-1.0.tar
@mkdir -p btrace-1.0
@cp btrace.spec btrace-1.0
$(TAR) rf btrace-1.0.tar btrace-1.0/btrace.spec
@rm -rf btrace-1.0
@bzip2 btrace-1.0.tar
rpm: dist
$(RPMBUILD) -ta btrace-1.0.tar.bz2
clean: docsclean
-rm -f *.o $(PROGS) .depend btrace-1.0.tar.bz2
$(MAKE) -C btt clean
$(MAKE) -C btreplay clean
install: all
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8
$(INSTALL) -m 755 $(ALL) $(DESTDIR)$(bindir)
$(INSTALL) -m 644 doc/*.1 $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 doc/*.8 $(DESTDIR)$(mandir)/man8
ifneq ($(wildcard .depend),)
include .depend
endif
Block IO Tracing
----------------
Written by Jens Axboe <axboe@kernel.dk> (initial version and kernel support),
Alan D. Brunelle (threading and splitup into two seperate programs),
Nathan Scott <nathans@sgi.com> (bug fixes, process names, multiple devices)
Also thanks to Tom Zanussi <zanussi@us.ibm.com> for good input and
patches.
Requirements
------------
blktrace was integrated into the mainline kernel between 2.6.16 and 2.6.17-rc1.
The target trace needs to run on a kernel at least that new.
git://git.kernel.dk/blktrace.git
If you don't have git, you can get hourly snapshots from:
http://brick.kernel.dk/snaps/
The snapshots include the full git object database as well. kernel.org has
excessively long mirror times, so if you have git installed, you can pull
the master tree from:
git://git.kernel.dk/blktrace.git
For browsing the repo over http and viewing history etc, you can direct
your browser to:
http://git.kernel.dk/
Usage
-----
$ blktrace -d <dev> [ -r debug_path ] [ -o output ] [ -k ] [ -w time ]
[ -a action ] [ -A action mask ]
-d Use specified device. May also be given last after options.
-r Path to mounted debugfs, defaults to /sys/kernel/debug.
-o File(s) to send output to.
-D Directory to prepend to output file names.
-k Kill running trace.
-w Stop after defined time, in seconds.
-a Only trace specific actions (use more -a options to add actions).
Available actions are:
READ
WRITE
BARRIER
SYNC
QUEUE
REQUEUE
ISSUE
COMPLETE
FS
PC
-A Give the trace mask directly as a number.
-b Sub buffer size in KiB.
-n Number of sub buffers.
-l Run in network listen mode (blktrace server)
-h Run in network client mode, connecting to the given host
-p Network port to use (default 8462)
-s Disable network client use of sendfile() to transfer data
-V Print program version info.
$ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ]
[ -w start:stop ] [ -f output format ] [ -F format spec ]
[ -d <binary> ]
-i Input file containing trace data, or '-' for stdin.
-D Directory to prepend to input file names.
-o Output file. If not given, output is stdout.
-b stdin read batching.
-s Show per-program io statistics.
-h Hash processes by name, not pid.
-t Track individual ios. Will tell you the time a request took to
get queued, to get dispatched, and to get completed.
-q Quiet. Don't display any stats at the end of the trace.
-w Only parse data between the given time interval in seconds. If
'start' isn't given, blkparse defaults the start time to 0.
-d Dump sorted data in binary format
-f Output format. Customize the output format. The format field
identifiers are:
%a - Action
%c - CPU ID
%C - Task command (process) name
%d - Direction (r/w)
%D - Device number
%e - Error number
%M - Major
%m - Minor
%N - Number of bytes
%n - Number of sectors
%p - PID
%P - PDU
%s - Sequence number
%S - Sector number
%t - Time (wallclock - nanoseconds)
%T - Time (wallclock - seconds)
%u - Time (processing - microseconds)
%U - Unplug depth
-F Format specification. The individual specifiers are:
A - Remap
B - Bounce
C - Complete
D - Issue
M - Back merge
F - Front merge
G - Get request
I - Insert
P - Plug
Q - Queue
R - Requeue
S - Sleep requests
T - Unplug timer
U - Unplug IO
W - Bounce
X - Split
-v More verbose for marginal errors.
-V Print program version info.
$ verify_blkparse filename
Verifies an output file from blkparse. All it does is check if
the events in the file are correctly time ordered. If an entry
is found that isn't ordered, it's dumped to stdout.
$ blkrawverify <dev> [<dev>...]
The blkrawverify utility can be used to verify data retrieved
via blktrace. It will check for valid event formats, forward
progressing sequence numbers and time stamps, also does reasonable
checks for other potential issues within invidividual events.
Errors found will be tracked in <dev>.verify.out.
If you want to do live tracing, you can pipe the data between blktrace
and blkparse:
% blktrace -d <device> -o - | blkparse -i -
This has a small risk of displaying some traces a little out of sync, since
it will do batch sorts of input events. Similarly, you can do traces over
the network. The network 'server' must run:
% blktrace -l
to listen to incoming blktrace connections, while the client should use
% blktrace -d /dev/sda -h <server hostname>
to connect and transfer data over the network.
Documentation
-------------
A users guide is distributed with the source. It is in latex, a
'make docs' will build a PDF in doc/. You need tetex and latex installed
to build the document.
Resources
---------
vger hosts a mailing list dedicated to btrace discussion and development.
The list is called linux-btrace@vger.kernel.org, subscribe by sending
a mail to majordomo@vger.kernel.org with 'subscribe linux-btrace' in
the mail body.
2006-09-05, Jens Axboe <axboe@kernel.dk>
#include <strings.h>
#include "blktrace.h"
#define DECLARE_MASK_MAP(mask) { BLK_TC_##mask, #mask, "BLK_TC_"#mask }
#define COMPARE_MASK_MAP(mmp, str) \
(!strcasecmp((mmp)->short_form, (str)) || \
!strcasecmp((mmp)->long_form, (str)))
struct mask_map {
int mask;
char *short_form;
char *long_form;
};
static struct mask_map mask_maps[] = {
DECLARE_MASK_MAP(READ),
DECLARE_MASK_MAP(WRITE),
DECLARE_MASK_MAP(BARRIER),
DECLARE_MASK_MAP(SYNC),
DECLARE_MASK_MAP(QUEUE),
DECLARE_MASK_MAP(REQUEUE),
DECLARE_MASK_MAP(ISSUE),
DECLARE_MASK_MAP(COMPLETE),
DECLARE_MASK_MAP(FS),
DECLARE_MASK_MAP(PC),
DECLARE_MASK_MAP(NOTIFY),
DECLARE_MASK_MAP(AHEAD),
DECLARE_MASK_MAP(META),
DECLARE_MASK_MAP(DISCARD),
DECLARE_MASK_MAP(DRV_DATA),
};
int find_mask_map(char *string)
{
unsigned int i;
for (i = 0; i < sizeof(mask_maps)/sizeof(mask_maps[0]); i++)
if (COMPARE_MASK_MAP(&mask_maps[i], string))
return mask_maps[i].mask;
return -1;
}
int valid_act_opt(int x)
{
return (1 <= x) && (x < (1 << BLK_TC_SHIFT));
}
#ifndef BARRIER_H
#define BARRIER_H
#if defined(__ia64__)
#define store_barrier() asm volatile ("mf" ::: "memory")
#elif defined(__x86_64__)
#define store_barrier() asm volatile("sfence" ::: "memory")
#elif defined(__i386__)
#define store_barrier() asm volatile ("": : :"memory")
#elif defined(__ppc__) || defined(__powerpc__)
#define store_barrier() asm volatile ("eieio" : : : "memory")
#elif defined(__s390__) || defined(__s390x__)
#define store_barrier() asm volatile ("bcr 15,0" : : : "memory")
#elif defined(__alpha__)
#define store_barrier() asm volatile("wmb": : :"memory")
#elif defined(__hppa__)
#define store_barrier() asm volatile("":::"memory")
#elif defined(__sparc__)
#define store_barrier() asm volatile("":::"memory")
#elif defined(__m68000__) || defined(__m68k__) || defined(mc68000) || defined(_M_M68K)
#define store_barrier() asm volatile("":::"memory")
#elif defined(__mips__) /* also mipsel */
#define store_barrier() do { } while(0)
#elif defined(__arm__)
/* taken from linux/arch/arm/kernel/entry-armv.S, thanks to pbrook! */
typedef void (__kernel_dmb_t)(void);
#define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0)
#define store_barrier() __kernel_dmb()
#else
#error Define store_barrier() for your CPU
#endif
#endif
This diff is collapsed.
/*
* I/O monitor based on block queue trace data
*
* Copyright IBM Corp. 2008
*
* Author(s): Martin Peschke <mp3@de.ibm.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BLKIOMON_H
#define BLKIOMON_H
#include <string.h>
#include "stats.h"
#include "blktrace.h"
#define BLKIOMON_SIZE_BUCKETS 16
#define BLKIOMON_D2C_BUCKETS 25
struct blkiomon_stat {
__u64 time;
__u32 size_hist[BLKIOMON_SIZE_BUCKETS];
__u32 d2c_hist[BLKIOMON_D2C_BUCKETS];
__u32 device;
struct minmax size_r;
struct minmax size_w;
struct minmax d2c_r;
struct minmax d2c_w;
struct minmax thrput_r;
struct minmax thrput_w;
__u64 bidir;
};
static struct histlog2 size_hist = {
.first = 0,
.delta = 1024,
.num = BLKIOMON_SIZE_BUCKETS
};
static struct histlog2 d2c_hist = {
.first = 0,
.delta = 8,
.num = BLKIOMON_D2C_BUCKETS
};
static inline void blkiomon_stat_init(struct blkiomon_stat *bstat)
{
memset(bstat, 0, sizeof(*bstat));
minmax_init(&bstat->size_r);
minmax_init(&bstat->size_w);
minmax_init(&bstat->d2c_r);
minmax_init(&bstat->d2c_w);
minmax_init(&bstat->thrput_r);
minmax_init(&bstat->thrput_w);
}
static inline void blkiomon_stat_to_be(struct blkiomon_stat *bstat)
{
histlog2_to_be(bstat->size_hist, &size_hist);
histlog2_to_be(bstat->d2c_hist, &d2c_hist);
minmax_to_be(&bstat->size_r);
minmax_to_be(&bstat->size_w);
minmax_to_be(&bstat->d2c_r);
minmax_to_be(&bstat->d2c_w);
minmax_to_be(&bstat->thrput_r);
minmax_to_be(&bstat->thrput_w);
bstat->bidir = cpu_to_be64(bstat->bidir);
bstat->time = cpu_to_be64(bstat->time);
bstat->device = cpu_to_be32(bstat->device);
}
static inline void blkiomon_stat_merge(struct blkiomon_stat *dst,
struct blkiomon_stat *src)
{
histlog2_merge(&size_hist, dst->size_hist, src->size_hist);
histlog2_merge(&d2c_hist, dst->d2c_hist, src->d2c_hist);
minmax_merge(&dst->size_r, &src->size_r);
minmax_merge(&dst->size_w, &src->size_w);
minmax_merge(&dst->d2c_r, &src->d2c_r);
minmax_merge(&dst->d2c_w, &src->d2c_w);
minmax_merge(&dst->thrput_r, &src->thrput_r);
minmax_merge(&dst->thrput_w, &src->thrput_w);
dst->bidir += src->bidir;
}
static inline void blkiomon_stat_print(FILE *fp, struct blkiomon_stat *p)
{
if (!fp)
return;
fprintf(fp, "\ntime: %s", ctime((void *)&p->time));
fprintf(fp, "device: %d,%d\n", MAJOR(p->device), MINOR(p->device));
minmax_print(fp, "sizes read (bytes)", &p->size_r);
minmax_print(fp, "sizes write (bytes)", &p->size_w);
minmax_print(fp, "d2c read (usec)", &p->d2c_r);
minmax_print(fp, "d2c write (usec)", &p->d2c_w);
minmax_print(fp, "throughput read (bytes/msec)", &p->thrput_r);
minmax_print(fp, "throughput write (bytes/msec)", &p->thrput_w);
histlog2_print(fp, "sizes histogram (bytes)", p->size_hist, &size_hist);
histlog2_print(fp, "d2c histogram (usec)", p->d2c_hist, &d2c_hist);
fprintf(fp, "bidirectional requests: %ld\n", (unsigned long)p->bidir);
}
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/sh
# Copyright (c) 2005 Silicon Graphics, Inc.
# All rights reserved.
#
# Nathan Scott <nathans@sgi.com>
# 14 Sep 2005 Initial version
#
TRACEOPTS=""
PARSEOPTS="-b100000"
USAGE="Usage: btrace [-s] [-t] [-w N] [-n N] [-b N] [-a <trace>...] [-r <dbg mnt>] <dev>..."
DIRNAME=`dirname $0`
while getopts "a:w:n:b:r:sthv" c
do
case $c in
a) TRACEOPTS=$TRACEOPTS" -a "$OPTARG" ";;
w) TRACEOPTS=$TRACEOPTS" -w "$OPTARG" ";;
n) TRACEOPTS=$TRACEOPTS" -n "$OPTARG" ";;
b) TRACEOPTS=$TRACEOPTS" -b "$OPTARG" ";;
r) TRACEOPTS=$TRACEOPTS" -r "$OPTARG" ";;
s) PARSEOPTS=$PARSEOPTS" -s";;
t) PARSEOPTS=$PARSEOPTS" -t";;
h) PARSEOPTS=$PARSEOPTS" -h";;
v) PARSEOPTS=$PARSEOPTS" -v";;
\?) echo $USAGE 1>&2
exit 2
;;
esac
done
shift `expr $OPTIND - 1`
if [ $# -eq 0 ]; then
echo $USAGE 1>&2
exit 2
fi
${DIRNAME}/blktrace ${TRACEOPTS} -o- $@ | ${DIRNAME}/blkparse ${PARSEOPTS} -i-
#
# spec file for package btrace (Version 1.0)
#
# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://www.suse.de/feedback/
#
# norootforbuild
# neededforbuild tetex te_latex gcc
Name: btrace
License: GPL
Group: foo
Version: 1.0
Release: 1
URL: http://brick.kernel.dk/snaps
Summary: Block IO tracer
Source0: %name-%version.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
btrace can show detailed info about what is happening on a block
device io queue. This is valuable for diagnosing and fixing
performance or application problems relating to block layer io.
Authors:
--------
Jens Axboe <axboe@kernel.dk>
%prep
%setup -q
%build
make CFLAGS="$RPM_OPT_FLAGS" all docs
%install
rm -rf $RPM_BUILD_ROOT
make dest=$RPM_BUILD_ROOT prefix=$RPM_BUILD_ROOT/%{_prefix} install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc README doc/blktrace.pdf
/usr/bin/*
/usr/man/*
%changelog -n btrace
* Mon Oct 10 2005 - axboe@suse.de
- Initial version
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment