Right now, blkparse keeps going until there's a delay in events read.
Add an option to cap the number of pending entries (-b) and default to
1024 events.
unsigned long long iread_kb, iwrite_kb;
};
-#define S_OPTS "i:o:"
+#define S_OPTS "i:o:b:"
static struct option l_opts[] = {
{
.name = "input",
.flag = NULL,
.val = 'o'
},
+ {
+ .name = "batch",
+ .has_arg = 1,
+ .flag = NULL,
+ .val = 'b'
+ },
{
.name = NULL,
.has_arg = 0,
static char *dev, *output_name;
+#define RB_BATCH_DEFAULT (1024)
+static int rb_batch = RB_BATCH_DEFAULT;
+
#define is_done() (*(volatile int *)(&done))
static volatile int done;
offset += pdu_len;
events++;
- } while (!is_done());
+ } while (!is_done() && events < rb_batch);
return events;
}
case 'o':
output_name = strdup(optarg);
break;
+ case 'b':
+ rb_batch = atoi(optarg);
+ if (rb_batch <= 0)
+ rb_batch = RB_BATCH_DEFAULT;
+ break;
default:
usage(argv[0]);
return 1;