#include "rbtree.h"
#include "jhash.h"
-static char blkparse_version[] = "0.99.3";
+static char blkparse_version[] = "1.0.0";
struct skip_info {
unsigned long start, end;
static struct per_process_info *ppi_list;
static int ppi_list_entries;
-#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vV"
static struct option l_opts[] = {
{
.name = "act-mask",
.flag = NULL,
.val = 'i'
},
+ {
+ .name = "no-msgs",
+ .has_arg = no_argument,
+ .flag = NULL,
+ .val = 'M'
+ },
{
.name = "output",
.has_arg = required_argument,
static int verbose;
static unsigned int act_mask = -1U;
static int stats_printed;
+static int bin_output_msgs = 1;
int data_is_native = -1;
static FILE *dump_fp;
struct timespec abs_start_time;
static unsigned long long start_timestamp;
+static int have_drv_data = 0;
+
#define JHASH_RANDOM (0x3af5f2ee)
#define CPUS_PER_LONG (8 * sizeof(unsigned long))
break;
+ case BLK_TN_MESSAGE:
+ if (bit->pdu_len > 0) {
+ char msg[bit->pdu_len+1];
+
+ memcpy(msg, (char *)payload, bit->pdu_len);
+ msg[bit->pdu_len] = '\0';
+
+ fprintf(ofp,
+ "%3d,%-3d %2d %8s %5d.%09lu %5u %2s %3s %s\n",
+ MAJOR(bit->device), MINOR(bit->device),
+ bit->cpu, "0", (int) SECONDS(bit->time),
+ (unsigned long) NANO_SECONDS(bit->time),
+ 0, "m", "N", msg);
+ }
+ break;
+
default:
/* Ignore unknown notify events */
;
case __BLK_TA_REMAP:
log_generic(pci, t, "A");
break;
+ case __BLK_TA_DRV_DATA:
+ have_drv_data = 1;
+ /* dump to binary file only */
+ break;
default:
fprintf(stderr, "Bad fs action %x\n", t->action);
break;
struct per_dev_info *pdi)
{
if (text_output) {
- if (t->action & BLK_TC_ACT(BLK_TC_PC))
+ if (t->action == BLK_TN_MESSAGE)
+ handle_notify(t);
+ else if (t->action & BLK_TC_ACT(BLK_TC_PC))
dump_trace_pc(t, pdi, pci);
else
dump_trace_fs(t, pdi, pci);
pdi->events++;
- output_binary(t, sizeof(*t) + t->pdu_len);
+ if (bin_output_msgs ||
+ !(t->action & BLK_TC_ACT(BLK_TC_NOTIFY) &&
+ t->action == BLK_TN_MESSAGE))
+ output_binary(t, sizeof(*t) + t->pdu_len);
}
/*
/*
* not a real trace, so grab and handle it here
*/
- if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY)) {
+ if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && bit->action != BLK_TN_MESSAGE) {
handle_notify(bit);
output_binary(bit, sizeof(*bit) + bit->pdu_len);
continue;
if (verify_trace(bit))
goto err;
- if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY)) {
+ if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && bit->action != BLK_TN_MESSAGE) {
handle_notify(bit);
output_binary(bit, sizeof(*bit) + bit->pdu_len);
bit_free(bit);
return 0;
}
-#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vV"
+#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vVM"
static char usage_str[] = "\n\n" \
"-i <file> | --input=<file>\n" \
"[ -a <action field> | --act-mask=<action field> ]\n" \
"[ -s | --per-program-stats ]\n" \
"[ -t | --track-ios ]\n" \
"[ -w <time> | --stopwatch=<time> ]\n" \
+ "[ -M | --no-msgs\n" \
"[ -v | --verbose ]\n" \
"[ -V | --version ]\n\n" \
"\t-b stdin read batching\n" \
"\t to get queued, to get dispatched, and to get completed\n" \
"\t-w Only parse data between the given time interval in seconds.\n" \
"\t If 'start' isn't given, blkparse defaults the start time to 0\n" \
+ "\t-M Do not output messages to binary file\n" \
"\t-v More verbose for marginal errors\n" \
"\t-V Print program version info\n\n";
case 'd':
dump_binary = optarg;
break;
+ case 'M':
+ bin_output_msgs = 0;
+ break;
default:
usage(argv[0]);
return 1;
if (!ret)
show_stats();
+ if (have_drv_data && !dump_binary)
+ printf("\ndiscarded traces containing low-level device driver "
+ "specific data (only available in binary output)\n");
+
if (ofp_buffer) {
fflush(ofp);
free(ofp_buffer);