#include "rbtree.h"
#include "jhash.h"
-static char blkparse_version[] = "0.99";
+static char blkparse_version[] = "0.99.1";
struct skip_info {
unsigned long start, end;
static struct per_process_info *ppi_list;
static int ppi_list_entries;
-#define S_OPTS "a:A:i:o:b:stqw:f:F:vVhD:"
+#define S_OPTS "a:A:i:o:b:stqw:f:F:vVhD:d:"
static struct option l_opts[] = {
{
.name = "act-mask",
.flag = NULL,
.val = 'D'
},
+ {
+ .name = "dump-binary",
+ .has_arg = required_argument,
+ .flag = NULL,
+ .val = 'd'
+ },
{
.name = NULL,
}
static int stats_printed;
int data_is_native = -1;
+static int dump_fd;
+static char *dump_binary;
+
static unsigned int t_alloc_cache;
static unsigned int bit_alloc_cache;
#define CPU_IDX(cpu) ((cpu) / CPUS_PER_LONG)
#define CPU_BIT(cpu) ((cpu) & (CPUS_PER_LONG - 1))
+static void output_binary(void *buf, int len)
+{
+ if (dump_binary) {
+ int n = write(dump_fd, buf, len);
+ if (n != len) {
+ perror(dump_binary);
+ close(dump_fd);
+ dump_binary = NULL;
+ }
+ }
+}
+
static void resize_cpu_info(struct per_dev_info *pdi, int cpu)
{
struct per_cpu_info *cpus = pdi->cpus;
pdi->first_reported_time = t->time;
pdi->events++;
+
+ output_binary(t, sizeof(*t) + t->pdu_len);
}
/*
*/
if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY)) {
add_ppm_hash(bit->pid, (char *) bit + sizeof(*bit));
+ output_binary(bit, sizeof(*bit) + bit->pdu_len);
continue;
}
"\t-i Input file containing trace data, or '-' for stdin\n" \
"\t-D Directory to prepend to input file names\n" \
"\t-o Output file. If not given, output is stdout\n" \
+ "\t-d Output file. If specified, binary data is written to file\n" \
"\t-b stdin read batching\n" \
"\t-s Show per-program io statistics\n" \
"\t-h Hash processes by name, not pid\n" \
case 'V':
printf("%s version %s\n", argv[0], blkparse_version);
return 0;
+ case 'd':
+ dump_binary = optarg;
+ break;
default:
usage(argv[0]);
return 1;
return 1;
}
+ if (dump_binary) {
+ dump_fd = creat(dump_binary, 0666);
+ if (dump_fd < 0) {
+ perror(dump_binary);
+ dump_binary = NULL;
+ return 1;
+ }
+ }
+
if (pipeline)
ret = do_stdin();
else