Allow setting the lock back limit in ovnisort

This commit is contained in:
Rodrigo Arias 2023-03-24 12:36:57 +01:00 committed by Rodrigo Arias Mallo
parent a04fc71ae9
commit f35741bac7

View File

@ -49,7 +49,7 @@ enum operation_mode { SORT,
static char *tracedir = NULL;
static enum operation_mode operation_mode = SORT;
static const size_t max_look_back = 1000000;
static size_t max_look_back = 1000000;
static void
ring_reset(struct ring *r)
@ -404,6 +404,9 @@ usage(void)
rerr(" -c Enable check mode: don't sort, ensure the\n");
rerr(" trace is already sorted.\n");
rerr("\n");
rerr(" -n Set the number of events to look back.\n");
rerr(" Defaul: %ld\n", max_look_back);
rerr("\n");
rerr(" tracedir The trace directory generated by ovni.\n");
rerr("\n");
@ -415,11 +418,14 @@ parse_args(int argc, char *argv[])
{
int opt;
while ((opt = getopt(argc, argv, "c")) != -1) {
while ((opt = getopt(argc, argv, "cn:")) != -1) {
switch (opt) {
case 'c':
operation_mode = CHECK;
break;
case 'n':
max_look_back = atol(optarg);
break;
default: /* '?' */
usage();
}