rt-tests/SOURCES/add-h-option-to-queuelat.patch

73 lines
2.3 KiB
Diff

From 05a1ceb9b490b2cb0aff2f10c4753849df05dec0 Mon Sep 17 00:00:00 2001
From: Marcelo Tosatti <mtosatti@redhat.com>
Date: Tue, 4 Sep 2018 08:56:34 -0300
Subject: [PATCH 1/2] add -h option to queuelat
Add -h (help) option to queuelat, which lists all
options.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/queuelat/README | 1 +
src/queuelat/queuelat.c | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/queuelat/README b/src/queuelat/README
index 790de3e13c17..4ffdb3753bbd 100644
--- a/src/queuelat/README
+++ b/src/queuelat/README
@@ -51,6 +51,7 @@ cycles_per_packet: number of cycles to process one packet (int).
mpps(million-packet-per-sec): million packets per second (float).
tsc_freq_mhz: TSC frequency in MHz, as measured by TSC PIT calibration
(search for "Detected XXX MHz processor" in dmesg, and use the integer part).
+timeout: timeout (in seconds).
How it works
============
diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
index 8bfed274ccab..2230d04bf391 100644
--- a/src/queuelat/queuelat.c
+++ b/src/queuelat/queuelat.c
@@ -532,6 +532,18 @@ int calculate_nr_packets_drain_per_block(void)
return nr_packets_drain_per_block;
}
+
+void print_help(void)
+{
+ printf("usage: queuelat [options]\n");
+ printf("-h show this help menu\n");
+ printf("-m max-queue-len (maximum latency allowed, in nanoseconds) (int)\n");
+ printf("-c cycles-per-packet (number of cycles to process one packet (int)\n");
+ printf("-p million-packet-per-sec (million packets per second) (float)\n");
+ printf("-f tsc-freq-mhz (TSC frequency in MHz) (float)\n");
+ printf("-t timeout (timeout, in seconds) (int)\n");
+}
+
int main(int argc, char **argv)
{
double tsc_freq_mhz;
@@ -549,7 +561,7 @@ int main(int argc, char **argv)
opterr = 0;
- while ((c = getopt (argc, argv, "m:c:p:f:t:q:")) != -1)
+ while ((c = getopt (argc, argv, "m:c:p:f:t:q:h")) != -1)
switch (c)
{
case 'm':
@@ -570,6 +582,9 @@ int main(int argc, char **argv)
case 'q':
qvalue = optarg;
break;
+ case 'h':
+ print_help();
+ return 0;
case '?':
if (optopt == 'm' || optopt == 'c' || optopt == 'p' ||
optopt == 'f' || optopt == 't' || optopt == 'q')
--
2.14.4