svsematest: Streamline usage and man page
Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
parent
2f904fe540
commit
5317558c74
|
@ -4,15 +4,15 @@
|
|||
\fBsvsematest\fR \- Start two threads or fork two processes and measure the latency of SYSV semaphores
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
svsematest [-a|-a PROC] [-b USEC] [-d DIST] [-f] [-i INTV] [-l loops] [-p PRIO] [-t|-t NUM]
|
||||
svsematest [-a|--affinity NUM] [-b|--breaktrace USEC] [-d|--distance DIST] [-D|--duration TIME] [-f|--fork [OPT]] [-i|--interval INTV] [-l|--loops LOOPS] [-p|--prio PRIO] [-S|--smp] [-t|--threads [NUM]]
|
||||
.br
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
The program \fBsvsematest\fR starts two threads or, optionally, forks two processes that are synchronized via SYSV semaphores and measures the latency between releasing a semaphore on one side and getting it on the other side.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B \-a, \-\-affinity[=PROC]
|
||||
Run on processor number PROC. If PROC is not specified, run on current processor.
|
||||
.B \-a, \-\-affinity[=NUM]
|
||||
Run on processor number NUM. If PROC is not specified, run on current processor.
|
||||
.TP
|
||||
.B \-b, \-\-breaktrace=USEC
|
||||
Send break trace command when latency > USEC. This is a debugging option to control the latency tracer in the realtime preemption patch.
|
||||
|
|
|
@ -218,33 +218,34 @@ union semun {
|
|||
};
|
||||
|
||||
|
||||
static void display_help(void)
|
||||
static void display_help(int error)
|
||||
{
|
||||
printf("svsematest V %1.2f\n", VERSION);
|
||||
puts("Usage: svsematest <options>");
|
||||
puts("Function: test SYSV semaphore latency");
|
||||
puts(
|
||||
"Options:\n"
|
||||
printf("Usage:\n"
|
||||
"svsematest <options>\n\n"
|
||||
"Function: test SYSV semaphore latency\n\n"
|
||||
"Avaiable options:\n"
|
||||
"-a [NUM] --affinity run thread #N on processor #N, if possible\n"
|
||||
" with NUM pin all threads to the processor NUM\n"
|
||||
"-b USEC --breaktrace=USEC send break trace command when latency > USEC\n"
|
||||
"-d DIST --distance=DIST distance of thread intervals in us default=500\n"
|
||||
"-f --fork fork new processes instead of creating threads\n"
|
||||
"-D --duration=TIME specify a length for the test run.\n"
|
||||
" Append 'm', 'h', or 'd' to specify minutes, hours or\n"
|
||||
" days.\n"
|
||||
"-f [OPT] --fork[=OPT] fork new processes instead of creating threads\n"
|
||||
"-i INTV --interval=INTV base interval of thread in us default=1000\n"
|
||||
"-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n"
|
||||
"-D --duration=TIME specify a length for the test run.\n"
|
||||
" Append 'm', 'h', or 'd' to specify minutes, hours or days.\n"
|
||||
"-p PRIO --prio=PRIO priority\n"
|
||||
"-S --smp SMP testing: options -a -t and same priority\n"
|
||||
" of all threads\n"
|
||||
"-t --threads one thread per available processor\n"
|
||||
"-t [NUM] --threads=NUM number of threads:\n"
|
||||
"-t [NUM] --threads[=NUM] number of threads:\n"
|
||||
" without NUM, threads = max_cpus\n"
|
||||
" without -t default = 1\n");
|
||||
exit(1);
|
||||
" without -t default = 1\n"
|
||||
);
|
||||
exit(error);
|
||||
}
|
||||
|
||||
|
||||
static int setaffinity = AFFINITY_UNSPECIFIED;
|
||||
static int affinity;
|
||||
static int priority;
|
||||
|
@ -269,17 +270,17 @@ static void process_options (int argc, char *argv[])
|
|||
{"affinity", optional_argument, NULL, 'a'},
|
||||
{"breaktrace", required_argument, NULL, 'b'},
|
||||
{"distance", required_argument, NULL, 'd'},
|
||||
{"duration", required_argument, NULL, 'D'},
|
||||
{"fork", optional_argument, NULL, 'f'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"interval", required_argument, NULL, 'i'},
|
||||
{"loops", required_argument, NULL, 'l'},
|
||||
{"duration", required_argument, NULL, 'D'},
|
||||
{"priority", required_argument, NULL, 'p'},
|
||||
{"smp", no_argument, NULL, 'S'},
|
||||
{"threads", optional_argument, NULL, 't'},
|
||||
{"help", no_argument, NULL, '?'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
int c = getopt_long (argc, argv, "a::b:d:f::i:l:D:p:St::h",
|
||||
int c = getopt_long (argc, argv, "a::b:d:D:f::hi:l:p:St::",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
@ -301,6 +302,7 @@ static void process_options (int argc, char *argv[])
|
|||
break;
|
||||
case 'b': thistracelimit = atoi(optarg); break;
|
||||
case 'd': distance = atoi(optarg); break;
|
||||
case 'D': duration = parse_time_string(optarg); break;
|
||||
case 'f':
|
||||
if (optarg != NULL) {
|
||||
wasforked = 1;
|
||||
|
@ -312,9 +314,9 @@ static void process_options (int argc, char *argv[])
|
|||
} else
|
||||
mustfork = 1;
|
||||
break;
|
||||
case 'h': display_help(0); break;
|
||||
case 'i': interval = atoi(optarg); break;
|
||||
case 'l': max_cycles = atoi(optarg); break;
|
||||
case 'D': duration = parse_time_string(optarg); break;
|
||||
case 'p': priority = atoi(optarg); break;
|
||||
case 'S':
|
||||
smp = 1;
|
||||
|
@ -333,8 +335,9 @@ static void process_options (int argc, char *argv[])
|
|||
else
|
||||
num_threads = max_cpus;
|
||||
break;
|
||||
case 'h': error = 1; break;
|
||||
case '?': error = 1; break;
|
||||
default:
|
||||
display_help(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,7 +368,7 @@ static void process_options (int argc, char *argv[])
|
|||
tracelimit = thistracelimit;
|
||||
}
|
||||
if (error)
|
||||
display_help ();
|
||||
display_help(error);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue