From: Nicholas Richardson <richardsonnick@google.com>
To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org
Cc: nrrichar@ncsu.edu, promanov@google.com, arunkaly@google.com,
Nick Richardson <richardsonnick@google.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Ye Bin <yebin10@huawei.com>, Leesoo Ahn <dev@ooseel.net>,
Di Zhu <zhudi21@huawei.com>, Yejune Deng <yejune.deng@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/3] pktgen: Add output for imix results
Date: Tue, 17 Aug 2021 23:51:38 +0000 [thread overview]
Message-ID: <20210817235141.1136355-4-richardsonnick@google.com> (raw)
In-Reply-To: <20210817235141.1136355-1-richardsonnick@google.com>
From: Nick Richardson <richardsonnick@google.com>
The bps for imix mode is calculated by:
sum(imix_entry.size) / time_elapsed
The actual counts of each imix_entry are displayed under the
"Current:" section of the interface output in the following format:
imix_size_counts: size_1,count_1 size_2,count_2 ... size_n,count_n
Example (count = 200000):
imix_weights: 256,1 859,3 205,2
imix_size_counts: 256,32082 859,99796 205,68122
Result: OK: 17992362(c17964678+d27684) usec, 200000 (859byte,0frags)
11115pps 47Mb/sec (47977140bps) errors: 0
Summary of changes:
Calculate bps based on imix counters when in IMIX mode.
Add output for IMIX counters.
Signed-off-by: Nick Richardson <richardsonnick@google.com>
---
net/core/pktgen.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 9e78edf0f69b..699f76779f0c 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -695,6 +695,18 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
(unsigned long long)pkt_dev->sofar,
(unsigned long long)pkt_dev->errors);
+ if (pkt_dev->n_imix_entries > 0) {
+ int i;
+
+ seq_puts(seq, " imix_size_counts: ");
+ for (i = 0; i < pkt_dev->n_imix_entries; i++) {
+ seq_printf(seq, "%llu,%llu ",
+ pkt_dev->imix_entries[i].size,
+ pkt_dev->imix_entries[i].count_so_far);
+ }
+ seq_puts(seq, "\n");
+ }
+
seq_printf(seq,
" started: %lluus stopped: %lluus idle: %lluus\n",
(unsigned long long) ktime_to_us(pkt_dev->started_at),
@@ -3281,7 +3293,19 @@ static void show_results(struct pktgen_dev *pkt_dev, int nr_frags)
pps = div64_u64(pkt_dev->sofar * NSEC_PER_SEC,
ktime_to_ns(elapsed));
- bps = pps * 8 * pkt_dev->cur_pkt_size;
+ if (pkt_dev->n_imix_entries > 0) {
+ int i;
+ struct imix_pkt *entry;
+
+ bps = 0;
+ for (i = 0; i < pkt_dev->n_imix_entries; i++) {
+ entry = &pkt_dev->imix_entries[i];
+ bps += entry->size * entry->count_so_far;
+ }
+ bps = div64_u64(bps * 8 * NSEC_PER_SEC, ktime_to_ns(elapsed));
+ } else {
+ bps = pps * 8 * pkt_dev->cur_pkt_size;
+ }
mbps = bps;
do_div(mbps, 1000000);
--
2.33.0.rc1.237.g0d66db33f3-goog
next prev parent reply other threads:[~2021-08-17 23:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 23:51 [PATCH v3 0/3] pktgen: Add IMIX mode Nicholas Richardson
2021-08-17 23:51 ` [PATCH v3 1/3] pktgen: Parse internet mix (imix) input Nicholas Richardson
2021-08-17 23:51 ` [PATCH v3 2/3] pktgen: Add imix distribution bins Nicholas Richardson
2021-08-17 23:51 ` Nicholas Richardson [this message]
2021-08-18 0:32 ` [PATCH v3 0/3] pktgen: Add IMIX mode Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210817235141.1136355-4-richardsonnick@google.com \
--to=richardsonnick@google.com \
--cc=arunkaly@google.com \
--cc=davem@davemloft.net \
--cc=dev@ooseel.net \
--cc=gustavoars@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nrrichar@ncsu.edu \
--cc=promanov@google.com \
--cc=yebin10@huawei.com \
--cc=yejune.deng@gmail.com \
--cc=zhudi21@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®