Commit e534c26e authored by Bas Zoetekouw's avatar Bas Zoetekouw Committed by Dmitry Smirnov

Imported Debian snapshot 0~git-20070718142546-1

parent 0185ae54
......@@ -14,7 +14,7 @@ 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/data/git/blktrace.git
git://git.kernel.dk/blktrace.git
If you don't have git, you can get hourly snapshots from:
......@@ -24,7 +24,7 @@ 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/data/git/blktrace.git
git://git.kernel.dk/blktrace.git
For browsing the repo over http and viewing history etc, you can direct
your browser to:
......@@ -89,7 +89,7 @@ $ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ]
%a - Action
%c - CPU ID
%C - Task command name
%C - Task command (process) name
%d - Direction (r/w)
%D - Device number
%e - Error number
......
......@@ -2,17 +2,32 @@
#define BARRIER_H
#if defined(__ia64__)
#define store_barrier() asm volatile ("mf" ::: "memory")
#define store_barrier() asm volatile ("mf" ::: "memory")
#elif defined(__x86_64__)
#define store_barrier() asm volatile("sfence" ::: "memory")
#define store_barrier() asm volatile("sfence" ::: "memory")
#elif defined(__i386__)
#define store_barrier() asm volatile ("": : :"memory")
#define store_barrier() asm volatile ("": : :"memory")
#elif defined(__ppc__) || defined(__powerpc__)
#define store_barrier() asm volatile ("eieio" : : : "memory")
#define store_barrier() asm volatile ("eieio" : : : "memory")
#elif defined(__s390__) || defined(__s390x__)
#define store_barrier() asm volatile ("bcr 15,0" : : : "memory")
#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__)
#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
#error Define store_barrier() for your CPU
#endif
#endif
......@@ -1149,10 +1149,10 @@ static inline void __account_m(struct io_stats *ios, struct blk_io_trace *t,
{
if (rw) {
ios->mwrites++;
ios->qwrite_kb += t_kb(t);
ios->mwrite_kb += t_kb(t);
} else {
ios->mreads++;
ios->qread_kb += t_kb(t);
ios->mread_kb += t_kb(t);
}
}
......@@ -1506,15 +1506,14 @@ static void dump_io_stats(struct per_dev_info *pdi, struct io_stats *ios,
fprintf(ofp, " Reads Queued: %s, %siB\t", size_cnv(x, ios->qreads, 0), size_cnv(y, ios->qread_kb, 1));
fprintf(ofp, " Writes Queued: %s, %siB\n", size_cnv(x, ios->qwrites, 0), size_cnv(y, ios->qwrite_kb, 1));
fprintf(ofp, " Read Dispatches: %s, %siB\t", size_cnv(x, ios->ireads, 0), size_cnv(y, ios->iread_kb, 1));
fprintf(ofp, " Write Dispatches: %s, %siB\n", size_cnv(x, ios->iwrites, 0), size_cnv(y, ios->iwrite_kb, 1));
fprintf(ofp, " Reads Requeued: %s\t\t", size_cnv(x, ios->rrqueue, 0));
fprintf(ofp, " Writes Requeued: %s\n", size_cnv(x, ios->wrqueue, 0));
fprintf(ofp, " Reads Completed: %s, %siB\t", size_cnv(x, ios->creads, 0), size_cnv(y, ios->cread_kb, 1));
fprintf(ofp, " Writes Completed: %s, %siB\n", size_cnv(x, ios->cwrites, 0), size_cnv(y, ios->cwrite_kb, 1));
fprintf(ofp, " Read Merges: %'8lu%8c\t", ios->mreads, ' ');
fprintf(ofp, " Write Merges: %'8lu\n", ios->mwrites);
fprintf(ofp, " Read Merges: %s, %siB\t", size_cnv(x, ios->mreads, 0), size_cnv(y, ios->mread_kb, 1));
fprintf(ofp, " Write Merges: %s, %siB\n", size_cnv(x, ios->mwrites, 0), size_cnv(y, ios->mwrite_kb, 1));
if (pdi) {
fprintf(ofp, " Read depth: %'8u%8c\t", pdi->max_depth[0], ' ');
fprintf(ofp, " Write depth: %'8u\n", pdi->max_depth[1]);
......@@ -1646,6 +1645,8 @@ static void show_device_and_cpu_stats(void)
total.cwrite_kb += ios->cwrite_kb;
total.iread_kb += ios->iread_kb;
total.iwrite_kb += ios->iwrite_kb;
total.mread_kb += ios->mread_kb;
total.mwrite_kb += ios->mwrite_kb;
total.timer_unplugs += ios->timer_unplugs;
total.io_unplugs += ios->io_unplugs;
......@@ -2612,7 +2613,7 @@ int main(int argc, char *argv[])
while (optind < argc) {
if (is_pipe(argv[optind]) && !pipeline) {
pipeline = 1;
pipename = strdup(optarg);
pipename = strdup(argv[optind]);
} else if (resize_devices(argv[optind]) != 0)
return 1;
optind++;
......
......@@ -65,8 +65,10 @@ static inline void fill_rwbs(char *rwbs, struct blk_io_trace *t)
if (w)
rwbs[i++] = 'W';
else
else if (t->bytes)
rwbs[i++] = 'R';
else
rwbs[i++] = 'N';
if (a)
rwbs[i++] = 'A';
if (b)
......@@ -314,13 +316,23 @@ static void process_default(char *act, struct per_cpu_info *pci,
fprintf(ofp, "[%d]\n", t->error);
} else {
if (elapsed != -1ULL) {
fprintf(ofp, "%llu + %u (%8llu) [%d]\n",
(unsigned long long) t->sector,
t_sec(t), elapsed, t->error);
if (t_sec(t))
fprintf(ofp, "%llu + %u (%8llu) [%d]\n",
(unsigned long long) t->sector,
t_sec(t), elapsed, t->error);
else
fprintf(ofp, "%llu (%8llu) [%d]\n",
(unsigned long long) t->sector,
elapsed, t->error);
} else {
fprintf(ofp, "%llu + %u [%d]\n",
(unsigned long long) t->sector,
t_sec(t), t->error);
if (t_sec(t))
fprintf(ofp, "%llu + %u [%d]\n",
(unsigned long long) t->sector,
t_sec(t), t->error);
else
fprintf(ofp, "%llu [%d]\n",
(unsigned long long) t->sector,
t->error);
}
}
break;
......@@ -338,13 +350,20 @@ static void process_default(char *act, struct per_cpu_info *pci,
fprintf(ofp, "[%s]\n", name);
} else {
if (elapsed != -1ULL) {
fprintf(ofp, "%llu + %u (%8llu) [%s]\n",
(unsigned long long) t->sector,
t_sec(t), elapsed, name);
if (t_sec(t))
fprintf(ofp, "%llu + %u (%8llu) [%s]\n",
(unsigned long long) t->sector,
t_sec(t), elapsed, name);
else
fprintf(ofp, "(%8llu) [%s]\n", elapsed,
name);
} else {
fprintf(ofp, "%llu + %u [%s]\n",
(unsigned long long) t->sector,
t_sec(t), name);
if (t_sec(t))
fprintf(ofp, "%llu + %u [%s]\n",
(unsigned long long) t->sector,
t_sec(t), name);
else
fprintf(ofp, "[%s]\n", name);
}
}
break;
......@@ -353,8 +372,11 @@ static void process_default(char *act, struct per_cpu_info *pci,
case 'F': /* Front merge */
case 'G': /* Get request */
case 'S': /* Sleep request */
fprintf(ofp, "%llu + %u [%s]\n", (unsigned long long) t->sector,
t_sec(t), name);
if (t_sec(t))
fprintf(ofp, "%llu + %u [%s]\n",
(unsigned long long) t->sector, t_sec(t), name);
else
fprintf(ofp, "[%s]\n", name);
break;
case 'P': /* Plug */
......
......@@ -31,6 +31,7 @@ struct io_stats {
unsigned long ireads, iwrites, rrqueue, wrqueue;
unsigned long long qread_kb, qwrite_kb, cread_kb, cwrite_kb;
unsigned long long iread_kb, iwrite_kb;
unsigned long long mread_kb, mwrite_kb;
unsigned long io_unplugs, timer_unplugs;
};
......
......@@ -9,16 +9,17 @@
TRACEOPTS=""
PARSEOPTS="-b100000"
SUMMARIZE=""
USAGE="Usage: btrace [-s] [-t] [-S] [-w N] [-a <trace>...] <dev>..."
USAGE="Usage: btrace [-s] [-t] [-S] [-w N] [-a <trace>...] [-r <dbg mnt]<dev>..."
DIRNAME=`dirname $0`
while getopts "a:stSw:hv" c
while getopts "a:r:stSw:hv" 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";;
......
#
# OCFLAGS:
# COUNT_IOS - Counts struct io's left at end
# DEBUG - Various and sundy debug asserts
# NDEBUG - Defined: no asserts, Undefined: asserts
#
CC = gcc
CFLAGS = -Wall -O2 -W -g
# CFLAGS = -Wall -g -W -UDO_INLINE -DDEBUG
ALL_CFLAGS = $(CFLAGS) -I.. -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
INCS = -I. -I..
OCFLAGS = -UCOUNT_IOS -UDEBUG -DNDEBUG
XCFLAGS = -Wall -W -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CFLAGS = $(INCS) -O2 $(XCFLAGS) $(OCFLAGS)
PROGS = btt
#ELIBS = -lefence
#PLIBS = -lpthread
LIBS = $(PLIBS) $(ELIBS)
OBJS = args.o bt_timeline.o devmap.o devs.o dip_rb.o iostat.o latency.o \
misc.o output.o proc.o seek.o trace.o trace_complete.o trace_im.o \
trace_issue.o trace_queue.o trace_remap.o trace_requeue.o rbtree.o \
mmap.o trace_plug.o
mmap.o trace_plug.o bno_dump.o unplug_hist.o
all: depend $(PROGS)
rbtree.o: ../rbtree.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
$(CC) -o $*.o -c $(CFLAGS) $<
depend:
@$(CC) -MM $(ALL_CFLAGS) -I.. *.c 1> .depend
@$(CC) -MM $(CFLAGS) -I.. *.c 1> .depend
clean: docsclean
-rm -f *.o $(PROGS) .depend
%.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
$(CC) -o $*.o -c $(CFLAGS) $<
btt: $(OBJS)
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
$(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
docs:
$(MAKE) -C doc all
......
......@@ -3,77 +3,7 @@ blktrace Timeline
Alan D. Brunelle (initial version)
Usage
-----
Usage: btt
[ -d <seconds> | --range-delta=<seconds> ]
[ -D <dev;...> | --devices=<dev;...> ]
[ -e <exe,...> | --exes=<exe,...> ]
[ -h | --help ]
[ -i <input name> | --input-file=<input name> ]
[ -I <output name> | --iostat=<output name> ]
[ -l <output name> | --d2c-latencies=<output name> ]
[ -M <dev map> | --dev-maps=<dev map>
[ -o <output name> | --output-file=<output name> ]
[ -p <output name> | --per-io-dump=<output name> ]
[ -q <output name> | --q2c-latencies=<output name> ]
[ -s <output name> | --seeks=<output name> ]
[ -S <interval> | --iostat-interval=<interval> ]
[ -t <sec> | --time-start=<sec> ]
[ -T <sec> | --time-end=<sec> ]
[ -V | --version ]
[ -v | --verbose ]
You are required to specify an input file (-i)
The -d option allows you to specify the granularity which determines
"activity" with regard to the .dat files -- this specific the time
(in seconds) that must elapse without a particular event occuring to
signify inactivity. The larger the number, the fewer ranges output --
the default is 0.1 seconds.
The -D option supplies the devices which should be looked at when
analyzing the input. This is a ":" separated list of devices, devices are
specified by a mjr,mnr tuple (e.g.: -D "8,0:8,8" specifies two devices
with major 8 and minor 0 and 8 respectively).
The -e option supplies the list of executables that will have I/Os
analyzed.
The -I option directs btt to output iostat-like data to the specified
file. Refer to the iostat (sysstat) documentation for details on the
data columns. The -S option specifies the interval to use between data
output, it defaults to once per second.
The -l and -q options allow one to output per-IO D2C and Q2C latencies
respectively. The supplied argument provides the basis for the output
name for each device.
The -M option takes in a file generated by the provided script
(gen_disk_info.py), and allows for better output of device names.
The -p option will generate a file that contains a list of all IO
"sequences" - showing the parts of each IO (Q, A, I/M, D, & C).
The -s option instructs btt to output seek data, the argument provided
is the basis for file names output. There are two files per device,
read seeks and write seeks.
The -t/-T options allow one to set a start and/or end time for analyzing
- analyzing will only be done for traces after -t's argument and before
-T's argument. (-t and -T are optional, so if you specify just -t,
analysis will occur for all traces after the time specified. Similarly,
if only -T is specified, analysis stops after -T's seconds.)
Overview
--------
btt will take in binary dump data from blkparse, and analyze the events,
producing a series of output from the analysis. It will also build .dat
files containing "range data" -- showing things like Q activity (periods
of time while Q events are being produced), C activity (likewise for
command completions), and etc.
Please refer to the documentation for details.
Resources
---------
......@@ -83,4 +13,5 @@ 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_18, Alan D. Brunelle <alan.brunelle@hp.com>
2006-04-16, Alan D. Brunelle <Alan.Brunelle@hp.com>
......@@ -27,14 +27,28 @@
#include <fcntl.h>
#include "globals.h"
#define S_OPTS "Ad:D:e:hi:I:l:M:o:p:q:s:S:t:T:Vv"
#define SETBUFFER_SIZE (64 * 1024)
#define S_OPTS "aAB:d:D:e:hi:I:l:M:o:p:q:s:S:t:T:u:Vv"
static struct option l_opts[] = {
{
.name = "seek-absolute",
.has_arg = no_argument,
.flag = NULL,
.val = 'a'
},
{
.name = "all-data",
.has_arg = no_argument,
.flag = NULL,
.val = 'A'
},
{
.name = "dump-blocknos",
.has_arg = required_argument,
.flag = NULL,
.val = 'B'
},
{
.name = "range-delta",
.has_arg = required_argument,
......@@ -125,6 +139,12 @@ static struct option l_opts[] = {
.flag = NULL,
.val = 'T'
},
{
.name = "unplug-hist",
.has_arg = required_argument,
.flag = NULL,
.val = 'u'
},
{
.name = "version",
.has_arg = no_argument,
......@@ -143,7 +163,9 @@ static struct option l_opts[] = {
};
static char usage_str[] = \
"\n[ -A | --all-data ]\n" \
"\n[ -a | --seek-absolute ]\n" \
"[ -A | --all-data ]\n" \
"[ -B <output name> | --dump-blocknos=<output name> ]\n" \
"[ -d <seconds> | --range-delta=<seconds> ]\n" \
"[ -D <dev;...> | --devices=<dev;...> ]\n" \
"[ -e <exe,...> | --exes=<exe,...> ]\n" \
......@@ -159,24 +181,61 @@ static char usage_str[] = \
"[ -S <interval> | --iostat-interval=<interval> ]\n" \
"[ -t <sec> | --time-start=<sec> ]\n" \
"[ -T <sec> | --time-end=<sec> ]\n" \
"[ -u <output name> | --unplug-hist=<output name> ] \n" \
"[ -V | --version ]\n" \
"[ -v | --verbose ]\n\n";
static struct file_info *arg_files = NULL;
static void usage(char *prog)
{
fprintf(stderr, "Usage: %s %s %s", prog, bt_timeline_version,
usage_str);
}
static FILE *setup_ofile(char *fname)
{
if (fname) {
char *buf;
FILE *ofp = fopen(fname, "w");
if (!ofp) {
perror(fname);
exit(1);
}
buf = malloc(SETBUFFER_SIZE);
assert(buf);
setbuffer(ofp, buf, SETBUFFER_SIZE);
add_file(&arg_files, ofp, fname);
add_buf(buf);
return ofp;
}
return NULL;
}
void clean_args(void)
{
clean_files(&arg_files);
}
void handle_args(int argc, char *argv[])
{
int c;
while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) != -1) {
switch (c) {
case 'a':
seek_absolute = 1;
break;
case 'A':
output_all_data = 1;
break;
case 'B':
bno_dump_name = strdup(optarg);
break;
case 'd':
sscanf(optarg, "%lf", &range_delta);
break;
......@@ -228,6 +287,9 @@ void handle_args(int argc, char *argv[])
sscanf(optarg, "%lf", &t_aend);
time_bounded = 1;
break;
case 'u':
unplug_hist_name = strdup(optarg);
break;
case 'v':
verbose = 1;
break;
......@@ -273,21 +335,6 @@ void handle_args(int argc, char *argv[])
free(fname);
}
if (iostat_name != NULL) {
iostat_ofp = fopen(iostat_name, "w");
if (iostat_ofp == NULL) {
perror(iostat_name);
exit(1);
}
setbuffer(iostat_ofp, malloc(64 * 1024), 64 * 1024);
}
if (per_io_name != NULL) {
per_io_ofp = fopen(per_io_name, "w");
if (per_io_ofp == NULL) {
perror(per_io_name);
exit(1);
}
setbuffer(per_io_ofp, malloc(64 * 1024), 64 * 1024);
}
iostat_ofp = setup_ofile(iostat_name);
per_io_ofp = setup_ofile(per_io_name);
}
/*
* blktrace output analysis: generate a timeline & gather statistics
*
* Copyright (C) 2006 Alan D. Brunelle <Alan.Brunelle@hp.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
*
*/
#include "globals.h"
struct bno_dump {
FILE *rfp, *wfp, *cfp;
};
static struct file_info *bno_dump_files = NULL;
static FILE *bno_dump_open(__u32 device, char rwc)
{
FILE *fp;
char *oname;
int mjr, mnr;
mjr = device >> MINORBITS;
mnr = device & ((1 << MINORBITS) - 1);
oname = malloc(strlen(bno_dump_name) + 32);
sprintf(oname, "%s_%03d,%03d_%c.dat", bno_dump_name, mjr, mnr, rwc);
if ((fp = fopen(oname, "w")) == NULL)
perror(oname);
else
add_file(&bno_dump_files, fp, oname);
return fp;
}
void *bno_dump_init(__u32 device)
{
struct bno_dump *bdp;
if (bno_dump_name == NULL) return NULL;
bdp = malloc(sizeof(*bdp));
bdp->rfp = bno_dump_open(device, 'r');
bdp->wfp = bno_dump_open(device, 'w');
bdp->cfp = bno_dump_open(device, 'c');
return bdp;
}
void bno_dump_exit(void *param)
{
/*
* Associated files will be auto-cleaned by bno_dump_clean
*/
free(param);
}
static inline void bno_dump_write(FILE *fp, struct io *iop)
{
fprintf(fp, "%15.9lf %lld %lld\n",
BIT_TIME(iop->t.time),
(long long)BIT_START(iop), (long long)BIT_END(iop));
}
void bno_dump_add(void *handle, struct io *iop)
{
# define RW_FP(bdp, iop) (IOP_READ(iop) ? bdp->rfp : bdp->wfp)
struct bno_dump *bdp = handle;
if (bdp) {
if (RW_FP(bdp, iop))
bno_dump_write(RW_FP(bdp, iop), iop);
if (bdp->cfp)
bno_dump_write(bdp->cfp, iop);
}
}
void bno_dump_clean(void)
{
clean_files(&bno_dump_files);
}
......@@ -27,10 +27,10 @@
char bt_timeline_version[] = "0.99.1";
char *devices, *exes, *input_name, *output_name, *seek_name;
char *d2c_name, *q2c_name, *per_io_name;
char *devices, *exes, *input_name, *output_name, *seek_name, *bno_dump_name;
char *d2c_name, *q2c_name, *per_io_name, *unplug_hist_name;
FILE *ranges_ofp, *avgs_ofp, *per_io_ofp;
int verbose, done, time_bounded, output_all_data;
int verbose, done, time_bounded, output_all_data, seek_absolute;
double t_astart, t_aend;
unsigned long n_traces;
struct avgs_info all_avgs;
......@@ -39,6 +39,9 @@ time_t genesis, last_vtrace;
LIST_HEAD(all_devs);
LIST_HEAD(all_procs);
LIST_HEAD(free_ios);
LIST_HEAD(free_bilinks);
LIST_HEAD(rmhd);
LIST_HEAD(retries);
__u64 q_histo[N_HIST_BKTS], d_histo[N_HIST_BKTS];
double range_delta = 0.1;
......@@ -48,12 +51,15 @@ __u64 next_retry_check = 0;
struct region_info all_regions = {
.qranges = LIST_HEAD_INIT(all_regions.qranges),
.cranges = LIST_HEAD_INIT(all_regions.cranges),
.qr_cur = NULL,
.cr_cur = NULL
};
#if defined(DEBUG)
int rb_tree_size;
int rb_tree_size;
#endif
#if defined(COUNT_IOS)
unsigned long nios_reused, nios_alloced, nios_freed;
LIST_HEAD(cios);
#endif
int process(void);
......@@ -67,6 +73,31 @@ int main(int argc, char *argv[])
if (process() || output_avgs(avgs_ofp) || output_ranges(ranges_ofp))
return 1;
if (iostat_ofp) {
fprintf(iostat_ofp, "\n");
iostat_dump_stats(iostat_last_stamp, 1);
}
if (ranges_ofp != stdout)
fclose(ranges_ofp);
if (avgs_ofp != stdout)
fclose(avgs_ofp);
seek_clean();
latency_clean();
bno_dump_clean();
dev_map_exit();
dip_exit();
pip_exit();
io_free_all();
bilink_free_all();
region_exit(&all_regions);
free(input_name);
if (output_name) free(output_name);
clean_bufs();
return 0;
}
......@@ -79,7 +110,7 @@ int process(void)
{
int ret = 0;
struct io *iop = io_alloc();
struct timeval tvs, tvi, tve;
struct timeval tvs, tve;
genesis = last_vtrace = time(NULL);
gettimeofday(&tvs, NULL);
......@@ -90,31 +121,44 @@ int process(void)
io_release(iop);
do_retries(0);
gettimeofday(&tvi, NULL);
if (iostat_ofp) {
fprintf(iostat_ofp, "\n");
iostat_dump_stats(iostat_last_stamp, 1);
}
seek_clean();
latency_clean();
gettimeofday(&tve, NULL);
if (verbose) {
double tps, dt_input = tv2dbl(&tvi) - tv2dbl(&tvs);
double tps, dt_input = tv2dbl(&tve) - tv2dbl(&tvs);
tps = (double)n_traces / dt_input;
printf("%10lu traces @ %.1lf Ktps\t%.6lf+%.6lf=%.6lf\n",
printf("\r "
" \r");
printf("%10lu traces @ %.1lf Ktps in %.6lf seconds\n",
n_traces, tps/1000.0,
dt_input, tv2dbl(&tve) - tv2dbl(&tvi),
tv2dbl(&tve) - tv2dbl(&tvs));
#if defined(DEBUG)
printf("\ttree = |%d|\n", rb_tree_size);
if (rb_tree_size > 0)
dump_rb_trees();
#endif
dt_input);
# if defined(DEBUG)
printf("\ttree = |%d|\n", rb_tree_size);
if (rb_tree_size > 0)
dump_rb_trees();
# endif
# if defined(COUNT_IOS)
{
struct io *_iop;
struct list_head *_p;
FILE *_ofp = fopen("cios.txt", "w");
printf("(%ld + %ld) = %ld - %ld = %ld\n",
nios_alloced, nios_reused,
nios_alloced + nios_reused,
nios_freed,
(nios_alloced + nios_reused)
- nios_freed);
__list_for_each(_p, &cios) {
_iop = list_entry(_p, struct io,
cio_head);