app/testpmd: fix CPU cycles per pkt stats on transmit modes
PATCH 1/1 app/testpmd: fix CPU cycles per pkt stats on transmit modes
In txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all
---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------
---------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------
+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
--- app/test-pmd/testpmd.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
app/test-pmd/testpmd.c +17 -7
@@ -1961,13 +1961,23 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border);#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES #define CYC_PER_MHZ 1E6 -if (total_recv >0 ) -printf ("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 -" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, - (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); +if (total_recv >0 || total_xmit >0 ) { +if (strcmp (cur_fwd_eng->fwd_mode_name,"txonly" ) ==0 || +strcmp (cur_fwd_eng->fwd_mode_name,"flowgen" ) ==0 ) +printf ("\n CPU cycles/packet=%.2F (total cycles=" +"%" PRIu64" / total %s packets=%" PRIu64") at %" + PRIu64" MHz Clock\n" , + (double ) fwd_cycles / total_xmit, + fwd_cycles, cur_fwd_eng->fwd_mode_name, total_xmit, + (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); +else +printf ("\n CPU cycles/packet=%.2F (total cycles=" +"%" PRIu64" / total %s packets=%" PRIu64") at %" + PRIu64" MHz Clock\n" , + (double ) fwd_cycles / total_recv, + fwd_cycles, cur_fwd_eng->fwd_mode_name, total_recv, + (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); + }#endif }
Signature · 1 line
2.7.4
<snip>
Quoted 71 lines
Subject: [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes
In txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
----------------------------------------------------------------------------------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------+++++++++++++++ Accumulated forward statistics for all +++++++++++++++ ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz ClockSigned-off-by Phil Yang <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>Fixes 53324971a14e ("app/testpmd: display/clear forwarding stats ondemand")
Cc: [email protected]
Cc: [email protected]--- app/test-pmd/testpmd.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-04989d22..798b8e0 100644
app/test-pmd/testpmd.c +0
-0@@ -1961,13 +1961,23 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border); #ifdef
RTE_TEST_PMD_RECORD_CORE_CYCLES#defineCYC_PER_MHZ1E6app/test-pmd/testpmd.c +8
-7-if (total_recv >0 ) -printf ("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 -" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, - (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); +if (total_recv >0 || total_xmit >0 ) { +if (strcmp (cur_fwd_eng->fwd_mode_name,"txonly" ) ==0 || +strcmp (cur_fwd_eng->fwd_mode_name,"flowgen" ) ==0 ) + printf("\n CPU cycles/packet=%.2F (total cycles=" + "%"PRIu64" / total %s packets=%"PRIu64") at %" + PRIu64" MHz Clock\n", + (double) fwd_cycles / total_xmit, + fwd_cycles, cur_fwd_eng->fwd_mode_name,
total_xmit,app/test-pmd/testpmd.c +7
-0+ (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); + else + printf("\n CPU cycles/packet=%.2F (total cycles=" +"%" PRIu64" / total %s packets=%" PRIu64") at %" + PRIu64" MHz Clock\n" , + (double ) fwd_cycles / total_recv, + fwd_cycles, cur_fwd_eng->fwd_mode_name,
total_recv,
app/test-pmd/testpmd.c
Quoted 2 lines
app/test-pmd/testpmd.c +2
-0+ (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); + }
nit. Only difference between the two 'printf' calls are total_recv vs total_xmit. Can be consolidated into a single printf.
Quoted 5 lines
#endif
}--
2.7.4
Quoted 81 lines
-----Original Message-----
From: Honnappa Nagarahalli <[email protected]>
Sent: Friday, June 19, 2020 3:29 AM
To: Phil Yang <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Ruifeng Wang <[email protected]>; nd <[email protected]>; [email protected]; [email protected]; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit modes<snip>
Quoted 1 line
Subject: [PATCH] app/testpmd: fix CPU cycles per pkt stats on transmit
modes
Quoted 2 lines
In txonly and flowgen forwarding mode, calculating CPU per packets with
total
Quoted 1 line
received packets is not accurate. Use total transmitted packets for these
cases.
Quoted 16 lines
The error output under txonly mode:
testpmd> show fwd stats all---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
----------------------------------------------------------------------------------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------Quoted 5 lines
+++++++++++++++ Accumulated forward statistics for all +++++++++++++++ ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++Quoted 22 lines
++++++++
CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz ClockSigned-off-by Phil Yang <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>Fixes 53324971a14e ("app/testpmd: display/clear forwarding stats ondemand")
Cc: [email protected]
Cc: [email protected]--- app/test-pmd/testpmd.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-04989d22..798b8e0 100644
app/test-pmd/testpmd.c +0
-0@@ -1961,13 +1961,23 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border); #ifdef
RTE_TEST_PMD_RECORD_CORE_CYCLES#defineCYC_PER_MHZ1E6app/test-pmd/testpmd.c fwd_stats_display(void)
Quoted 9 lines
app/test-pmd/testpmd.c +2
-7-if (total_recv >0 ) -printf ("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 -" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, - (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); +if (total_recv >0 || total_xmit >0 ) { + if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0|| > + strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0) > + printf("\n CPU cycles/packet=%.2F (total cycles=" > + "%"PRIu64" / total %s packets=%"PRIu64") at %" > + PRIu64" MHz Clock\n", > + (double) fwd_cycles / total_xmit, > + fwd_cycles, cur_fwd_eng->fwd_mode_name,
Quoted 13 lines
app/test-pmd/testpmd.c
Quoted 11 lines
total_xmit,app/test-pmd/testpmd.c +7
-0+ (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); + else + printf("\n CPU cycles/packet=%.2F (total cycles=" +"%" PRIu64" / total %s packets=%" PRIu64") at %" + PRIu64" MHz Clock\n" , + (double ) fwd_cycles / total_recv, + fwd_cycles, cur_fwd_eng->fwd_mode_name,
total_recv,app/test-pmd/testpmd.c +2
-0+ (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); + }nit. Only difference between the two 'printf' calls are
total_recvvstotal_xmit. Can be consolidated into a single printf.
OK. I can use a local flag and a ternary operator to print the ingress and the egress packets respectively.
I will update it in V2.
Thanks,
Phil
Quoted 6 lines
Quoted 6 lines
#endif
}--
2.7.4
PATCH v2 1/1 app/testpmd: fix CPU cycles per pkt stats on transmit modes
In reply to Phil YangIn txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all
---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------
---------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------
+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
---
v2:
Consolidate the output into a single printf. (Honnappa Nagarahalli)
app/test-pmd/testpmd.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
app/test-pmd/testpmd.c +15 -6
@@ -1961,13 +1961,22 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border);#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES #define CYC_PER_MHZ 1E6 -if (total_recv >0 ) +if (total_recv >0 || total_xmit >0 ) { +uint8_t ingress; +if (strcmp (cur_fwd_eng->fwd_mode_name,"txonly" ) ==0 || +strcmp (cur_fwd_eng->fwd_mode_name,"flowgen" ) ==0 ) + ingress =0 ; +else + ingress =1 ; +printf ("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 -" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, - (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); +"%" PRIu64" / total %s packets=%" PRIu64") at %" + PRIu64" MHz Clock\n" , ((double ) fwd_cycles / + (ingress ? total_recv : total_xmit)), + fwd_cycles, cur_fwd_eng->fwd_mode_name, + (ingress ? total_recv : total_xmit), + (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); + }#endif }
Signature · 1 line
2.7.4
<snip>
Quoted 52 lines
Subject: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes
In txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
----------------------------------------------------------------------------------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------+++++++++++++++ Accumulated forward statistics for all +++++++++++++++ ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz ClockSigned-off-by Phil Yang <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>Fixes 53324971a14e ("app/testpmd: display/clear forwarding stats ondemand")
Cc: [email protected]
Cc: [email protected]
---
v2:
Consolidate the output into a single printf. (Honnappa Nagarahalli)app/test-pmd/testpmd.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-04989d22..826d7dd 100644
app/test-pmd/testpmd.c +0
-0@@ -1961,13 +1961,22 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border); #ifdef
RTE_TEST_PMD_RECORD_CORE_CYCLES#defineCYC_PER_MHZ1E6
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1968
Quoted 6 lines
app/test-pmd/testpmd.c +5
-1-if (total_recv >0 ) +if (total_recv >0 || total_xmit >0 ) { +uint8_t ingress; +if (strcmp (cur_fwd_eng->fwd_mode_name,"txonly" ) ==0 || +strcmp (cur_fwd_eng->fwd_mode_name,"flowgen" ) ==0 ) + ingress =0 ;
This can be 'total_pkts = total_recv'
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1970
Quoted 2 lines
app/test-pmd/testpmd.c +2
-0+else + ingress =1 ;
This can be 'total_pkts = total_xmit'
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1975
Quoted 10 lines
app/test-pmd/testpmd.c +4
-5+ printf("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 -" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, - (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); + "%"PRIu64" / total %s packets=%"PRIu64") at %" + PRIu64" MHz Clock\n", ((double) fwd_cycles / + (ingress ? total_recv : total_xmit)),
Can be just 'total_pkts'.
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1977
Quoted 2 lines
app/test-pmd/testpmd.c +2
-0+ fwd_cycles, cur_fwd_eng->fwd_mode_name, + (ingress ? total_recv : total_xmit),
Can be just 'total_pkts'.
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1981
Quoted 4 lines
app/test-pmd/testpmd.c +2
-0+ (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); + }#endif }
Otherwise,
Quoted 3 lines
--
2.7.4
Quoted 73 lines
-----Original Message-----
From: Honnappa Nagarahalli <[email protected]>
Sent: Monday, June 22, 2020 11:40 AM
To: Phil Yang <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Ruifeng Wang <[email protected]>; nd <[email protected]>; [email protected]; [email protected]; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes<snip>
Quoted 22 lines
Subject: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes
In txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
----------------------------------------------------------------------------------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------Quoted 5 lines
+++++++++++++++ Accumulated forward statistics for all +++++++++++++++ ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++Quoted 25 lines
++++++++++
CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz ClockSigned-off-by Phil Yang <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>Fixes 53324971a14e ("app/testpmd: display/clear forwarding stats ondemand")
Cc: [email protected]
Cc: [email protected]
---
v2:
Consolidate the output into a single printf. (Honnappa Nagarahalli)app/test-pmd/testpmd.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-04989d22..826d7dd 100644
app/test-pmd/testpmd.c +0
-0@@ -1961,13 +1961,22 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border); #ifdef
RTE_TEST_PMD_RECORD_CORE_CYCLES#defineCYC_PER_MHZ1E6app/test-pmd/testpmd.c fwd_stats_display(void)
Quoted 4 lines
app/test-pmd/testpmd.c +3
-1-if (total_recv >0 ) +if (total_recv >0 || total_xmit >0 ) { +uint8_t ingress; + if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0|| > + strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0)
Quoted 6 lines
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1968
Quoted 1 line
app/test-pmd/testpmd.c +1
-0+ ingress =0 ;This can be '
total_pkts=total_recv'app/test-pmd/testpmd.c fwd_stats_display(void) · line 1970
Quoted 2 lines
app/test-pmd/testpmd.c +2
-0+else + ingress =1 ;This can be '
total_pkts=total_xmit'
Agree. Much better.
Updated in V3.
Thanks,
Phil
Quoted 27 lines
app/test-pmd/testpmd.c fwd_stats_display(void) · line 1975
Quoted 11 lines
app/test-pmd/testpmd.c +4
-5+ printf("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 -" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, - (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); + "%"PRIu64" / total %s packets=%"PRIu64") at %" + PRIu64" MHz Clock\n", ((double) fwd_cycles / + (ingress ? total_recv : total_xmit)),Can be just '
total_pkts'.app/test-pmd/testpmd.c fwd_stats_display(void) · line 1977
Quoted 2 lines
app/test-pmd/testpmd.c +2
-0+ fwd_cycles, cur_fwd_eng->fwd_mode_name, + (ingress ? total_recv : total_xmit),Can be just '
total_pkts'.app/test-pmd/testpmd.c fwd_stats_display(void) · line 1981
Quoted 4 lines
app/test-pmd/testpmd.c +2
-0+ (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); + }#endif }Otherwise,
Reviewed-by Honnappa Nagarahalli <[email protected]>Quoted 3 lines
--
2.7.4
PATCH v3 1/1 app/testpmd: fix CPU cycles per pkt stats on transmit modes
In reply to Phil YangIn txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all
---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------
---------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------
+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
---
v3:
replace ingress flag with total_pkts. (Honnappa Nagarahalli)
v2:
Consolidate the output into a single printf. (Honnappa Nagarahalli)
app/test-pmd/testpmd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
app/test-pmd/testpmd.c +12 -4
@@ -1961,13 +1961,21 @@ fwd_stats_display(void) acc_stats_border, acc_stats_border);#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES #define CYC_PER_MHZ 1E6 -if (total_recv >0 ) +if (total_recv >0 || total_xmit >0 ) { +uint64_t total_pkts =0 ; +if (strcmp (cur_fwd_eng->fwd_mode_name,"txonly" ) ==0 || +strcmp (cur_fwd_eng->fwd_mode_name,"flowgen" ) ==0 ) + total_pkts = total_xmit; +else + total_pkts = total_recv; +printf ("\n CPU cycles/packet=%.2F (total cycles=" -"%" PRIu64" / total RX packets=%" PRIu64") at %" PRIu64 +"%" PRIu64" / total %s packets=%" PRIu64") at %" PRIu64" MHz Clock\n" , - (double ) fwd_cycles / total_recv, - fwd_cycles, total_recv, + (double ) fwd_cycles / total_pkts, + fwd_cycles, cur_fwd_eng->fwd_mode_name, total_pkts, (uint64_t )(rte_get_tsc_hz () /CYC_PER_MHZ )); + }#endif }
Signature · 1 line
2.7.4
Quoted 27 lines · Phil Yang
In txonly and flowgen forwarding mode, calculating CPU per packets with total received packets is not accurate. Use total transmitted packets for these cases.
The error output under txonly mode:
testpmd> show fwd stats all---------------------- Forward statistics for port 0 -------------------
RX-packets: 0 RX-dropped: 0 RX-total: 0
TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751
TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
----------------------------------------------------------------------------------------------- Forward statistics for port 1 -------------------
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200
TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts]
-------------------------------------------------------------------------+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++
RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697
TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++CPU cycles/packet=54984156291.00 \
(total cycles=54984156291 / total RX packets=1) at 200 MHz Clock
Quoted 6 lines
Fixes 53324971a14e ("app/testpmd: display/clear forwarding stats on demand")Signed-off-by Phil Yang <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>
Applied to dpdk-next-net/master, thanks.