Skip to contentSkip to conversation

add -h option to queuelat

PATCH John Kacur 1 participant 2 messages Sep 19, 2018 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

John Kacur

author
#2 lore raw
Quoted 58 lines · Marcelo Tosatti

Add -h (help) option to queuelat, which lists all
options.

---
 src/queuelat/README     |    1 +
 src/queuelat/queuelat.c |   17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

Index: rt-tests/src/queuelat/README
===================================================================

src/queuelat/README +1 -0
@@ -51,6 +51,7 @@
 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
 ============

Index: rt-tests/src/queuelat/queuelat.c
===================================================================

src/queuelat/queuelat.c +13 -1
@@ -532,6 +532,18 @@
 	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 @@
 
 	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':

src/queuelat/queuelat.c line 590

Quoted 9 lines
src/queuelat/queuelat.c +3 -0
@@ -570,6 +582,9 @@
 		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')

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw

Re: [patch 2/2] Add queuelat manpage

Quoted 66 lines · Marcelo Tosatti

Add a man page for queuelat, with a short introduction and description for each option.

---
 src/queuelat/queuelat.8 |   59 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

Index: rt-tests/src/queuelat/queuelat.8
===================================================================

src/queuelat/queuelat.8 new file +49 -0
@@ -0,0 +1,59 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.TH QUEUELAT 8 "Sept 3, 2018"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+queuelat \- Queue latency test program
+.SH SYNOPSIS
+.B queuelat
+.RI "[\-h] [\-m " max-queue-len "] [\-c " cycles-per-packet "] [\-p " mpps "] [\-f " tsc-freq "] [\-t " timeout "] \
+
+.SH DESCRIPTION
+queuelat simulates a network queue checking for latency
+violations in packet processing.
+
+.SH OPTIONS
+A summary of options is included below.
+.TP
+.B \-h
+Show help
+.br
+.TP
+.B \-m max-queue-len
+Maximum allowed latency, in nanoseconds. If latency to process
+.br
+any packet exceeds this value, the program quits,
+writing
+.br
+a message to the trace buffer.
+.TP
+.B \-c cycles-per-packet
+Estimated number of cycles it takes to process one packet.
+.br
+This value should come from the envisioned packet
+.br
+forwarding application being simulated.
+.TP
+.B \-p mpps
+Million packets per second that arrive for processing.
+.TP

src/queuelat/queuelat.8 line 59

Quoted 10 lines
src/queuelat/queuelat.8 new file +10 -0
+.B \-f tsc-freq-mhz
+TSC frequency in MHz.
+.TP
+.B \-t timeout
+Timeout in seconds to quit the program.
+
+
+.SH AUTHOR
+queuelat was written by Marcelo Tosatti <[email protected]>
+.br