MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pkt_burst_stats_display

Function pkt_burst_stats_display

dpdk/app/test-pmd/testpmd.c:1922–1987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1920}
1921
1922static void
1923pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
1924{
1925 uint64_t total_burst, sburst;
1926 uint64_t nb_burst;
1927 uint64_t burst_stats[4];
1928 uint16_t pktnb_stats[4];
1929 uint16_t nb_pkt;
1930 int burst_percent[4], sburstp;
1931 int i;
1932
1933 /*
1934 * First compute the total number of packet bursts and the
1935 * two highest numbers of bursts of the same number of packets.
1936 */
1937 memset(&burst_stats, 0x0, sizeof(burst_stats));
1938 memset(&pktnb_stats, 0x0, sizeof(pktnb_stats));
1939
1940 /* Show stats for 0 burst size always */
1941 total_burst = pbs->pkt_burst_spread[0];
1942 burst_stats[0] = pbs->pkt_burst_spread[0];
1943 pktnb_stats[0] = 0;
1944
1945 /* Find the next 2 burst sizes with highest occurrences. */
1946 for (nb_pkt = 1; nb_pkt < MAX_PKT_BURST + 1; nb_pkt++) {
1947 nb_burst = pbs->pkt_burst_spread[nb_pkt];
1948
1949 if (nb_burst == 0)
1950 continue;
1951
1952 total_burst += nb_burst;
1953
1954 if (nb_burst > burst_stats[1]) {
1955 burst_stats[2] = burst_stats[1];
1956 pktnb_stats[2] = pktnb_stats[1];
1957 burst_stats[1] = nb_burst;
1958 pktnb_stats[1] = nb_pkt;
1959 } else if (nb_burst > burst_stats[2]) {
1960 burst_stats[2] = nb_burst;
1961 pktnb_stats[2] = nb_pkt;
1962 }
1963 }
1964 if (total_burst == 0)
1965 return;
1966
1967 printf(" %s-bursts : %"PRIu64" [", rx_tx, total_burst);
1968 for (i = 0, sburst = 0, sburstp = 0; i < 4; i++) {
1969 if (i == 3) {
1970 printf("%d%% of other]\n", 100 - sburstp);
1971 return;
1972 }
1973
1974 sburst += burst_stats[i];
1975 if (sburst == total_burst) {
1976 printf("%d%% of %d pkts]\n",
1977 100 - sburstp, (int) pktnb_stats[i]);
1978 return;
1979 }

Callers 2

fwd_stream_stats_displayFunction · 0.85
fwd_stats_displayFunction · 0.85

Calls 2

memsetFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected