Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/120291/?format=api
http://patchwork.dpdk.org/api/patches/120291/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20221129153329.181652-5-rjarry@redhat.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20221129153329.181652-5-rjarry@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221129153329.181652-5-rjarry@redhat.com", "date": "2022-11-29T15:33:29", "name": "[v3,4/4] testpmd: report lcore usage", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "37646a5341e029149bb7da0ee98192a58e3c87b7", "submitter": { "id": 2850, "url": "http://patchwork.dpdk.org/api/people/2850/?format=api", "name": "Robin Jarry", "email": "rjarry@redhat.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20221129153329.181652-5-rjarry@redhat.com/mbox/", "series": [ { "id": 25930, "url": "http://patchwork.dpdk.org/api/series/25930/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=25930", "date": "2022-11-29T15:33:25", "name": "lcore telemetry improvements", "version": 3, "mbox": "http://patchwork.dpdk.org/series/25930/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/120291/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/120291/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 5F929A00C3;\n\tTue, 29 Nov 2022 16:34:01 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4463942D20;\n\tTue, 29 Nov 2022 16:33:45 +0100 (CET)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 7A8BA42D11\n for <dev@dpdk.org>; Tue, 29 Nov 2022 16:33:41 +0100 (CET)", "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-625-Nsh8-lccMu2KH4IM_7DLjw-1; Tue, 29 Nov 2022 10:33:39 -0500", "from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com\n [10.11.54.5])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01DD9185A7A9;\n Tue, 29 Nov 2022 15:33:39 +0000 (UTC)", "from paul.home (unknown [10.39.208.38])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 2CEB04EA52;\n Tue, 29 Nov 2022 15:33:38 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1669736020;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=Jdxyl2qP4uhP0KGzNPJ0aJqu+jbpBzG+WvRa4zJ8mxg=;\n b=GuQgE4e5U1FEjTgLg3EBUKYwhHSa4TezetuU+FZ9XPrw0Mq7E9HtaV2QaheccmLlxXEe95\n xUGs7A8FbqMhfJ5p2tgxYD8/tc34bHZnFRQ3u8DSd3EzuPlINk2KqT3vm1g94HFRsb5Mzv\n j9pNxxKbXoQ4++OuFVCfKnPNvgU9390=", "X-MC-Unique": "Nsh8-lccMu2KH4IM_7DLjw-1", "From": "Robin Jarry <rjarry@redhat.com>", "To": "dev@dpdk.org", "Cc": "Robin Jarry <rjarry@redhat.com>,\n =?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>", "Subject": "[PATCH v3 4/4] testpmd: report lcore usage", "Date": "Tue, 29 Nov 2022 16:33:29 +0100", "Message-Id": "<20221129153329.181652-5-rjarry@redhat.com>", "In-Reply-To": "<20221129153329.181652-1-rjarry@redhat.com>", "References": "<20221123102612.1688865-1-rjarry@redhat.com>\n <20221129153329.181652-1-rjarry@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.5", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Reuse the --record-core-cycles option to account for busy cycles. One\nturn of packet_fwd_t is considered \"busy\" if there was at least one\nreceived or transmitted packet.\n\nAdd a new busy_cycles field in struct fwd_stream. Update get_end_cycles\nto accept an additional argument for the number of processed packets.\nUpdate fwd_stream.busy_cycles when the number of packets is greater than\nzero.\n\nWhen --record-core-cycles is specified, register a callback with\nrte_lcore_register_usage_cb(). In the callback, use the new lcore_id\nfield in struct fwd_lcore to identify the correct index in fwd_lcores\nand return the sum of busy/total cycles of all fwd_streams.\n\nThis makes the cycles counters available in rte_lcore_dump() and the\nlcore telemetry API:\n\n testpmd> dump_lcores\n lcore 3, socket 0, role RTE, cpuset 3\n lcore 4, socket 0, role RTE, cpuset 4, busy cycles 1228584096/9239923140\n lcore 5, socket 0, role RTE, cpuset 5, busy cycles 1255661768/9218141538\n\n --> /eal/lcore/info,4\n {\n \"/eal/lcore/info\": {\n \"lcore_id\": 4,\n \"socket\": 0,\n \"role\": \"RTE\",\n \"cpuset\": [\n 4\n ],\n \"busy_cycles\": 10623340318,\n \"total_cycles\": 55331167354\n }\n }\n\nSigned-off-by: Robin Jarry <rjarry@redhat.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\n---\nv2 -> v3: no change\n\nv1 -> v2: adjusted to new lcore_usage api\n\n app/test-pmd/5tswap.c | 5 +++--\n app/test-pmd/csumonly.c | 6 +++---\n app/test-pmd/flowgen.c | 2 +-\n app/test-pmd/icmpecho.c | 6 +++---\n app/test-pmd/iofwd.c | 5 +++--\n app/test-pmd/macfwd.c | 5 +++--\n app/test-pmd/macswap.c | 5 +++--\n app/test-pmd/noisy_vnf.c | 4 ++++\n app/test-pmd/rxonly.c | 5 +++--\n app/test-pmd/shared_rxq_fwd.c | 5 +++--\n app/test-pmd/testpmd.c | 39 ++++++++++++++++++++++++++++++++++-\n app/test-pmd/testpmd.h | 14 +++++++++----\n app/test-pmd/txonly.c | 7 ++++---\n 13 files changed, 81 insertions(+), 27 deletions(-)", "diff": "diff --git a/app/test-pmd/5tswap.c b/app/test-pmd/5tswap.c\nindex f041a5e1d530..03225075716c 100644\n--- a/app/test-pmd/5tswap.c\n+++ b/app/test-pmd/5tswap.c\n@@ -116,7 +116,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \n \tfs->rx_packets += nb_rx;\n \ttxp = &ports[fs->tx_port];\n@@ -182,7 +182,8 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)\n \t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n \t\t} while (++nb_tx < nb_rx);\n \t}\n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex 1c2459851522..03e141221a56 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -868,7 +868,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \n \tfs->rx_packets += nb_rx;\n \trx_bad_ip_csum = 0;\n@@ -1200,8 +1200,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t\trte_pktmbuf_free(tx_pkts_burst[nb_tx]);\n \t\t} while (++nb_tx < nb_rx);\n \t}\n-\n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c\nindex fd6abc0f4124..7b2f0ffdf0f5 100644\n--- a/app/test-pmd/flowgen.c\n+++ b/app/test-pmd/flowgen.c\n@@ -196,7 +196,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)\n \n \tRTE_PER_LCORE(_next_flow) = next_flow;\n \n-\tget_end_cycles(fs, start_tsc);\n+\tget_end_cycles(fs, start_tsc, nb_tx);\n }\n \n static int\ndiff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c\nindex 066f2a3ab79b..2fc9f96dc95f 100644\n--- a/app/test-pmd/icmpecho.c\n+++ b/app/test-pmd/icmpecho.c\n@@ -303,7 +303,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \n \tfs->rx_packets += nb_rx;\n \tnb_replies = 0;\n@@ -508,8 +508,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)\n \t\t\t} while (++nb_tx < nb_replies);\n \t\t}\n \t}\n-\n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c\nindex 8fafdec548ad..e5a2dbe20c69 100644\n--- a/app/test-pmd/iofwd.c\n+++ b/app/test-pmd/iofwd.c\n@@ -59,7 +59,7 @@ pkt_burst_io_forward(struct fwd_stream *fs)\n \t\t\tpkts_burst, nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \tfs->rx_packets += nb_rx;\n \n \tnb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,\n@@ -84,7 +84,8 @@ pkt_burst_io_forward(struct fwd_stream *fs)\n \t\t} while (++nb_tx < nb_rx);\n \t}\n \n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c\nindex beb220fbb462..9db623999970 100644\n--- a/app/test-pmd/macfwd.c\n+++ b/app/test-pmd/macfwd.c\n@@ -65,7 +65,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \n \tfs->rx_packets += nb_rx;\n \ttxp = &ports[fs->tx_port];\n@@ -115,7 +115,8 @@ pkt_burst_mac_forward(struct fwd_stream *fs)\n \t\t} while (++nb_tx < nb_rx);\n \t}\n \n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c\nindex 4f8deb338296..4db134ac1d91 100644\n--- a/app/test-pmd/macswap.c\n+++ b/app/test-pmd/macswap.c\n@@ -66,7 +66,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \n \tfs->rx_packets += nb_rx;\n \ttxp = &ports[fs->tx_port];\n@@ -93,7 +93,8 @@ pkt_burst_mac_swap(struct fwd_stream *fs)\n \t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n \t\t} while (++nb_tx < nb_rx);\n \t}\n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c\nindex c65ec6f06a5c..290bdcda45f0 100644\n--- a/app/test-pmd/noisy_vnf.c\n+++ b/app/test-pmd/noisy_vnf.c\n@@ -152,6 +152,9 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs)\n \tuint64_t delta_ms;\n \tbool needs_flush = false;\n \tuint64_t now;\n+\tuint64_t start_tsc = 0;\n+\n+\tget_start_cycles(&start_tsc);\n \n \tnb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,\n \t\t\tpkts_burst, nb_pkt_per_burst);\n@@ -219,6 +222,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs)\n \t\tfs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, sent);\n \t\tncf->prev_time = rte_get_timer_cycles();\n \t}\n+\tget_end_cycles(fs, start_tsc, nb_rx + nb_tx);\n }\n \n #define NOISY_STRSIZE 256\ndiff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c\nindex d528d4f34e60..519202339e16 100644\n--- a/app/test-pmd/rxonly.c\n+++ b/app/test-pmd/rxonly.c\n@@ -58,13 +58,14 @@ pkt_burst_receive(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \n \tfs->rx_packets += nb_rx;\n \tfor (i = 0; i < nb_rx; i++)\n \t\trte_pktmbuf_free(pkts_burst[i]);\n \n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/shared_rxq_fwd.c b/app/test-pmd/shared_rxq_fwd.c\nindex 2e9047804b5b..395b73bfe52e 100644\n--- a/app/test-pmd/shared_rxq_fwd.c\n+++ b/app/test-pmd/shared_rxq_fwd.c\n@@ -102,9 +102,10 @@ shared_rxq_fwd(struct fwd_stream *fs)\n \t\t\t\t nb_pkt_per_burst);\n \tinc_rx_burst_stats(fs, nb_rx);\n \tif (unlikely(nb_rx == 0))\n-\t\treturn;\n+\t\tgoto end;\n \tforward_shared_rxq(fs, nb_rx, pkts_burst);\n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_rx);\n }\n \n static void\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 134d79a55547..6ad91334d352 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -2053,7 +2053,7 @@ fwd_stats_display(void)\n \t\t\t\tfs->rx_bad_outer_ip_csum;\n \n \t\tif (record_core_cycles)\n-\t\t\tfwd_cycles += fs->core_cycles;\n+\t\t\tfwd_cycles += fs->busy_cycles;\n \t}\n \tfor (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {\n \t\tpt_id = fwd_ports_ids[i];\n@@ -2184,6 +2184,7 @@ fwd_stats_reset(void)\n \n \t\tmemset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats));\n \t\tmemset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats));\n+\t\tfs->busy_cycles = 0;\n \t\tfs->core_cycles = 0;\n \t}\n }\n@@ -2260,6 +2261,7 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)\n \ttics_datum = rte_rdtsc();\n \ttics_per_1sec = rte_get_timer_hz();\n #endif\n+\tfc->lcore_id = rte_lcore_id();\n \tfsm = &fwd_streams[fc->stream_idx];\n \tnb_fs = fc->stream_nb;\n \tdo {\n@@ -2288,6 +2290,37 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)\n \t} while (! fc->stopped);\n }\n \n+static int\n+lcore_usage_callback(unsigned int lcore_id, uint64_t *busy_cycles, uint64_t *total_cycles)\n+{\n+\tstruct fwd_stream **fsm;\n+\tstruct fwd_lcore *fc;\n+\tstreamid_t nb_fs;\n+\tstreamid_t sm_id;\n+\tint c;\n+\n+\tfor (c = 0; c < nb_lcores; c++) {\n+\t\tfc = fwd_lcores[c];\n+\t\tif (fc->lcore_id != lcore_id)\n+\t\t\tcontinue;\n+\n+\t\tfsm = &fwd_streams[fc->stream_idx];\n+\t\tnb_fs = fc->stream_nb;\n+\t\t*busy_cycles = 0;\n+\t\t*total_cycles = 0;\n+\n+\t\tfor (sm_id = 0; sm_id < nb_fs; sm_id++)\n+\t\t\tif (!fsm[sm_id]->disabled) {\n+\t\t\t\t*busy_cycles += fsm[sm_id]->busy_cycles;\n+\t\t\t\t*total_cycles += fsm[sm_id]->core_cycles;\n+\t\t\t}\n+\n+\t\treturn 0;\n+\t}\n+\n+\treturn -1;\n+}\n+\n static int\n start_pkt_forward_on_core(void *fwd_arg)\n {\n@@ -4522,6 +4555,10 @@ main(int argc, char** argv)\n \t\trte_stats_bitrate_reg(bitrate_data);\n \t}\n #endif\n+\n+\tif (record_core_cycles)\n+\t\trte_lcore_register_usage_cb(lcore_usage_callback);\n+\n #ifdef RTE_LIB_CMDLINE\n \tif (init_cmdline() != 0)\n \t\trte_exit(EXIT_FAILURE,\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 7d24d25970d2..5dbf5d1c465c 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -174,7 +174,8 @@ struct fwd_stream {\n #ifdef RTE_LIB_GRO\n \tunsigned int gro_times;\t/**< GRO operation times */\n #endif\n-\tuint64_t core_cycles; /**< used for RX and TX processing */\n+\tuint64_t busy_cycles; /**< used with --record-core-cycles */\n+\tuint64_t core_cycles; /**< used with --record-core-cycles */\n \tstruct pkt_burst_stats rx_burst_stats;\n \tstruct pkt_burst_stats tx_burst_stats;\n \tstruct fwd_lcore *lcore; /**< Lcore being scheduled. */\n@@ -360,6 +361,7 @@ struct fwd_lcore {\n \tstreamid_t stream_nb; /**< number of streams in \"fwd_streams\" */\n \tlcoreid_t cpuid_idx; /**< index of logical core in CPU id table */\n \tvolatile char stopped; /**< stop forwarding when set */\n+\tunsigned int lcore_id; /**< return value of rte_lcore_id() */\n };\n \n /*\n@@ -836,10 +838,14 @@ get_start_cycles(uint64_t *start_tsc)\n }\n \n static inline void\n-get_end_cycles(struct fwd_stream *fs, uint64_t start_tsc)\n+get_end_cycles(struct fwd_stream *fs, uint64_t start_tsc, uint64_t nb_packets)\n {\n-\tif (record_core_cycles)\n-\t\tfs->core_cycles += rte_rdtsc() - start_tsc;\n+\tif (record_core_cycles) {\n+\t\tuint64_t cycles = rte_rdtsc() - start_tsc;\n+\t\tfs->core_cycles += cycles;\n+\t\tif (nb_packets > 0)\n+\t\t\tfs->busy_cycles += cycles;\n+\t}\n }\n \n static inline void\ndiff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c\nindex 021624952daa..ad37626ff63c 100644\n--- a/app/test-pmd/txonly.c\n+++ b/app/test-pmd/txonly.c\n@@ -331,7 +331,7 @@ pkt_burst_transmit(struct fwd_stream *fs)\n \tstruct rte_mbuf *pkt;\n \tstruct rte_mempool *mbp;\n \tstruct rte_ether_hdr eth_hdr;\n-\tuint16_t nb_tx;\n+\tuint16_t nb_tx = 0;\n \tuint16_t nb_pkt;\n \tuint16_t vlan_tci, vlan_tci_outer;\n \tuint32_t retry;\n@@ -392,7 +392,7 @@ pkt_burst_transmit(struct fwd_stream *fs)\n \t}\n \n \tif (nb_pkt == 0)\n-\t\treturn;\n+\t\tgoto end;\n \n \tnb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt);\n \n@@ -426,7 +426,8 @@ pkt_burst_transmit(struct fwd_stream *fs)\n \t\t} while (++nb_tx < nb_pkt);\n \t}\n \n-\tget_end_cycles(fs, start_tsc);\n+end:\n+\tget_end_cycles(fs, start_tsc, nb_tx);\n }\n \n static int\n", "prefixes": [ "v3", "4/4" ] }{ "id": 120291, "url": "