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

Function main

tools/traffic/traffic.c:50–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int main(int argc, char **argv)
51{
52 int ch, delay = 1, n = 0;
53 int single = 0;
54 unsigned int i, j;
55 struct ff_traffic_args traffic = {0, 0, 0, 0, 0, 0}, otr;
56 struct ff_traffic_args ptraffic[RTE_MAX_LCORE], potr[RTE_MAX_LCORE];
57 int proc_id = 0, max_proc_id = -1;
58 uint64_t rxp, rxb, txp, txb, rxd, txd;
59 uint64_t prxp, prxb, ptxp, ptxb, prxd, ptxd;
60 int title_line = 40;
61
62 ff_ipc_init();
63
64#define DIFF(member) (traffic.member - otr.member)
65#define DIFF_P(member) (ptraffic[j].member - potr[j].member)
66#define ADD_S(member) (traffic.member += ptraffic[j].member)
67
68 while ((ch = getopt(argc, argv, "hp:P:d:n:s")) != -1) {
69 switch(ch) {
70 case 'p':
71 proc_id = atoi(optarg);
72 ff_set_proc_id(proc_id);
73 break;
74 case 'P':
75 max_proc_id = atoi(optarg);
76 if (max_proc_id < 0 || max_proc_id >= RTE_MAX_LCORE) {
77 usage();
78 ff_ipc_exit();
79 return -1;
80 }
81 if (max_proc_id > title_line - 2)
82 title_line = max_proc_id + 2;
83 break;
84 case 'd':
85 delay = atoi(optarg) ?: 1;
86 break;
87 case 'n':
88 n = atoi(optarg);
89 break;
90 case 's':
91 single = 1;
92 break;
93 case 'h':
94 default:
95 usage();
96 ff_ipc_exit();
97 return -1;
98 }
99 }
100
101 if (single) {
102 if (max_proc_id == -1) {
103 if (traffic_status(&traffic)) {
104 printf("fstack ipc message error !\n");
105 ff_ipc_exit();
106 return -1;
107 }

Callers

nothing calls this directly

Calls 7

ff_ipc_initFunction · 0.85
ff_set_proc_idFunction · 0.85
ff_ipc_exitFunction · 0.85
traffic_statusFunction · 0.85
usageFunction · 0.70
getoptFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected