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

Function packet_per_second_stats

dpdk/app/test-flow-perf/main.c:1739–1805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1737}
1738
1739static void
1740packet_per_second_stats(void)
1741{
1742 struct lcore_info *old;
1743 struct lcore_info *li, *oli;
1744 int nr_lines = 0;
1745 int i;
1746
1747 old = rte_zmalloc("old",
1748 sizeof(struct lcore_info) * RTE_MAX_LCORE, 0);
1749 if (old == NULL)
1750 rte_exit(EXIT_FAILURE, "No Memory available!\n");
1751
1752 memcpy(old, lcore_infos,
1753 sizeof(struct lcore_info) * RTE_MAX_LCORE);
1754
1755 while (!force_quit) {
1756 uint64_t total_tx_pkts = 0;
1757 uint64_t total_rx_pkts = 0;
1758 uint64_t total_tx_drops = 0;
1759 uint64_t tx_delta, rx_delta, drops_delta;
1760 int nr_valid_core = 0;
1761
1762 sleep(1);
1763
1764 if (nr_lines) {
1765 char go_up_nr_lines[16];
1766
1767 sprintf(go_up_nr_lines, "%c[%dA\r", 27, nr_lines);
1768 printf("%s\r", go_up_nr_lines);
1769 }
1770
1771 printf("\n%6s %16s %16s %16s\n", "core", "tx", "tx drops", "rx");
1772 printf("%6s %16s %16s %16s\n", "------", "----------------",
1773 "----------------", "----------------");
1774 nr_lines = 3;
1775 for (i = 0; i < RTE_MAX_LCORE; i++) {
1776 li = &lcore_infos[i];
1777 oli = &old[i];
1778 if (li->mode != LCORE_MODE_PKT)
1779 continue;
1780
1781 tx_delta = li->tx_pkts - oli->tx_pkts;
1782 rx_delta = li->rx_pkts - oli->rx_pkts;
1783 drops_delta = li->tx_drops - oli->tx_drops;
1784 printf("%6d %'16"PRId64" %'16"PRId64" %'16"PRId64"\n",
1785 i, tx_delta, drops_delta, rx_delta);
1786
1787 total_tx_pkts += tx_delta;
1788 total_rx_pkts += rx_delta;
1789 total_tx_drops += drops_delta;
1790
1791 nr_valid_core++;
1792 nr_lines += 1;
1793 }
1794
1795 if (nr_valid_core > 1) {
1796 printf("%6s %'16"PRId64" %'16"PRId64" %'16"PRId64"\n",

Callers 1

start_forwardingFunction · 0.85

Calls 5

rte_zmallocFunction · 0.85
rte_exitFunction · 0.85
sprintfFunction · 0.85
memcpyFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected