get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/120110/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 120110,
    "url": "https://patches.dpdk.org/api/patches/120110/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20221123101931.1688238-5-rjarry@redhat.com/",
    "project": {
        "id": 1,
        "url": "https://patches.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": "<20221123101931.1688238-5-rjarry@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221123101931.1688238-5-rjarry@redhat.com",
    "date": "2022-11-23T10:19:31",
    "name": "[RFC,4/4] testpmd: report lcore usage",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "7568ba65e1f807b2c45ce3bb01d63eb71be7f2d7",
    "submitter": {
        "id": 2850,
        "url": "https://patches.dpdk.org/api/people/2850/?format=api",
        "name": "Robin Jarry",
        "email": "rjarry@redhat.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20221123101931.1688238-5-rjarry@redhat.com/mbox/",
    "series": [
        {
            "id": 25870,
            "url": "https://patches.dpdk.org/api/series/25870/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=25870",
            "date": "2022-11-23T10:19:27",
            "name": "lcore telemetry improvements",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/25870/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/120110/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/120110/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 71652A09E5;\n\tWed, 23 Nov 2022 11:20:03 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B2DDE42DA7;\n\tWed, 23 Nov 2022 11:19:50 +0100 (CET)",
            "from relay11.mail.gandi.net (relay11.mail.gandi.net\n [217.70.178.231])\n by mails.dpdk.org (Postfix) with ESMTP id EBC6742DA5\n for <dev@dpdk.org>; Wed, 23 Nov 2022 11:19:49 +0100 (CET)",
            "(Authenticated sender: robin@jarry.cc)\n by mail.gandi.net (Postfix) with ESMTPSA id 583D110000C;\n Wed, 23 Nov 2022 10:19:47 +0000 (UTC)"
        ],
        "From": "Robin Jarry <rjarry@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n Jerin Jacob <jerinj@marvell.com>, Kevin Laatz <kevin.laatz@intel.com>,\n Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>, =?utf-8?q?Mattias_R?=\n\t=?utf-8?q?=C3=B6nnblom?= <hofors@lysator.liu.se>, =?utf-8?q?Morten_Br=C3=B8?=\n\t=?utf-8?q?rup?= <mb@smartsharesystems.com>, Robin Jarry <rjarry@redhat.com>",
        "Subject": "[RFC PATCH 4/4] testpmd: report lcore usage",
        "Date": "Wed, 23 Nov 2022 11:19:31 +0100",
        "Message-Id": "<20221123101931.1688238-5-rjarry@redhat.com>",
        "X-Mailer": "git-send-email 2.38.1",
        "In-Reply-To": "<20221123101931.1688238-1-rjarry@redhat.com>",
        "References": "<20221123101931.1688238-1-rjarry@redhat.com>",
        "MIME-Version": "1.0",
        "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 two new interval_cycles and busy_cycles fields to the fwd_stream\nstructure. The core_cycles field cannot be reset to zero without\nbreaking the current behaviour.\n\nUpdate get_end_cycles() to accept an additional argument for the number\nof processed packets.\n\nEvery 10s, copy the number of cycles (busy and total) into a moving\naverage buffer. The buffer holds 6 samples of 10s and is rotated when\nfull.\n\nWhen --record-core-cycles is specified, register a callback with\nrte_lcore_register_busy_percent_cb(). In the callback, access the\naverage buffer to compute the percentage of busy cycles.\n\nExample:\n\n  testpmd> show lcores\n  lcore 3, socket 0, role RTE, cpuset 3, busy N/A\n  lcore 4, socket 0, role RTE, cpuset 4, busy 39% last 60 sec\n\nSigned-off-by: Robin Jarry <rjarry@redhat.com>\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        | 69 +++++++++++++++++++++++++++++++++--\n app/test-pmd/testpmd.h        | 25 +++++++++++--\n app/test-pmd/txonly.c         |  7 ++--\n 13 files changed, 120 insertions(+), 29 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..450bc281fd69 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -2248,20 +2248,26 @@ static void\n run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)\n {\n \tstruct fwd_stream **fsm;\n+\tuint64_t tics_per_1sec;\n+\tuint64_t tics_current;\n+\tuint64_t tics;\n \tstreamid_t nb_fs;\n \tstreamid_t sm_id;\n+\tint interval, loop;\n #ifdef RTE_LIB_BITRATESTATS\n-\tuint64_t tics_per_1sec;\n \tuint64_t tics_datum;\n-\tuint64_t tics_current;\n \tuint16_t i, cnt_ports;\n \n \tcnt_ports = nb_ports;\n \ttics_datum = rte_rdtsc();\n-\ttics_per_1sec = rte_get_timer_hz();\n #endif\n+\ttics_per_1sec = rte_get_timer_hz();\n+\ttics = rte_rdtsc();\n \tfsm = &fwd_streams[fc->stream_idx];\n \tnb_fs = fc->stream_nb;\n+\tfc->lcore_id = rte_lcore_id();\n+\tinterval = 0;\n+\tloop = 0;\n \tdo {\n \t\tfor (sm_id = 0; sm_id < nb_fs; sm_id++)\n \t\t\tif (!fsm[sm_id]->disabled)\n@@ -2284,8 +2290,58 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)\n \t\t\t\tlatencystats_lcore_id == rte_lcore_id())\n \t\t\trte_latencystats_update();\n #endif\n-\n+\t\tif (record_core_cycles && ++loop == 1024) {\n+\t\t\tloop = 0;\n+\t\t\ttics_current = rte_rdtsc();\n+\t\t\tif (tics_current - tics >= tics_per_1sec * LCORE_CYCLES_INTERVAL_LEN) {\n+\t\t\t\tfor (sm_id = 0; sm_id < nb_fs; sm_id++) {\n+\t\t\t\t\tstruct fwd_stream *fs = fsm[sm_id];\n+\t\t\t\t\tif (fs->disabled)\n+\t\t\t\t\t\tcontinue;\n+\t\t\t\t\tfc->cycles[interval].busy += fs->interval_cycles.busy;\n+\t\t\t\t\tfc->cycles[interval].total += fs->interval_cycles.total;\n+\t\t\t\t\tfs->interval_cycles.busy = 0;\n+\t\t\t\t\tfs->interval_cycles.total = 0;\n+\t\t\t\t}\n+\t\t\t\tinterval += 1;\n+\t\t\t\tif (interval == LCORE_CYCLES_INTERVAL_COUNT) {\n+\t\t\t\t\tmemmove(&fc->cycles[0], &fc->cycles[1],\n+\t\t\t\t\t\t(LCORE_CYCLES_INTERVAL_COUNT - 1)\n+\t\t\t\t\t\t* sizeof(fc->cycles[0]));\n+\t\t\t\t\tinterval = 0;\n+\t\t\t\t}\n+\t\t\t\tfc->cycles[interval].busy = 0;\n+\t\t\t\tfc->cycles[interval].total = 0;\n+\t\t\t\ttics = tics_current;\n+\t\t\t}\n+\t\t}\n \t} while (! fc->stopped);\n+\tmemset(&fc->cycles, 0, sizeof(fc->cycles));\n+}\n+\n+static int\n+lcore_busy_percent_callback(unsigned int lcore_id)\n+{\n+\tuint64_t busy_cycles, total_cycles;\n+\tstruct fwd_lcore *fc;\n+\tint i, 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+\t\tbusy_cycles = total_cycles = 0;\n+\n+\t\tfor (i = 0; i < LCORE_CYCLES_INTERVAL_COUNT; i++) {\n+\t\t\tbusy_cycles += fc->cycles[i].busy;\n+\t\t\ttotal_cycles += fc->cycles[i].total;\n+\t\t}\n+\t\tif (total_cycles == 0)\n+\t\t\treturn -1;\n+\t\treturn 100 * busy_cycles / total_cycles;\n+\t}\n+\n+\treturn -1;\n }\n \n static int\n@@ -4522,6 +4578,11 @@ 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_busy_percent_cb(lcore_busy_percent_callback,\n+\t\t\tLCORE_CYCLES_INTERVAL_LEN * LCORE_CYCLES_INTERVAL_COUNT);\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..684a06919986 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -145,6 +145,14 @@ extern const struct rss_type_info rss_type_table[];\n  */\n extern char dynf_names[64][RTE_MBUF_DYN_NAMESIZE];\n \n+/**\n+ * Used with --record-core-cycles.\n+ */\n+struct lcore_cycles {\n+\tuint64_t busy;\n+\tuint64_t total;\n+};\n+\n /**\n  * The data structure associated with a forwarding stream between a receive\n  * port/queue and a transmit port/queue.\n@@ -175,6 +183,7 @@ struct fwd_stream {\n \tunsigned int gro_times;\t/**< GRO operation times */\n #endif\n \tuint64_t     core_cycles; /**< used for RX and TX processing */\n+\tstruct lcore_cycles interval_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@@ -341,6 +350,9 @@ struct rte_port {\n \tstruct xstat_display_info xstats_info;\n };\n \n+#define LCORE_CYCLES_INTERVAL_COUNT 6\n+#define LCORE_CYCLES_INTERVAL_LEN 10\n+\n /**\n  * The data structure associated with each forwarding logical core.\n  * The logical cores are internally numbered by a core index from 0 to\n@@ -360,6 +372,8 @@ 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+\tstruct lcore_cycles cycles[LCORE_CYCLES_INTERVAL_COUNT];  /**< busy percent stats */\n };\n \n /*\n@@ -836,10 +850,15 @@ 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\tfs->interval_cycles.total += cycles;\n+\t\tif (nb_packets > 0)\n+\t\t\tfs->interval_cycles.busy += 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": [
        "RFC",
        "4/4"
    ]
}