mirror of https://github.com/F-Stack/f-stack.git
The `ff_traffic` and `ff_top`'s `-P` argument support bigger than 38.
This commit is contained in:
parent
820bf67ffe
commit
a7607b336a
|
@ -57,6 +57,7 @@ int main(int argc, char **argv)
|
||||||
float sys, usr, idle;
|
float sys, usr, idle;
|
||||||
float psys, pusr, pidle;
|
float psys, pusr, pidle;
|
||||||
unsigned long loops, ploops;
|
unsigned long loops, ploops;
|
||||||
|
int title_line = 40;
|
||||||
|
|
||||||
ff_ipc_init();
|
ff_ipc_init();
|
||||||
|
|
||||||
|
@ -76,6 +77,8 @@ int main(int argc, char **argv)
|
||||||
ff_ipc_exit();
|
ff_ipc_exit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (max_proc_id > title_line - 2)
|
||||||
|
title_line = max_proc_id + 2;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
delay = atoi(optarg) ?: 1;
|
delay = atoi(optarg) ?: 1;
|
||||||
|
@ -99,7 +102,7 @@ int main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i % 40 == 0) {
|
if (i % title_line == 0) {
|
||||||
printf("|---------|---------|---------|---------------|\n");
|
printf("|---------|---------|---------|---------------|\n");
|
||||||
printf("|%9s|%9s|%9s|%15s|\n", "idle", "sys", "usr", "loop");
|
printf("|%9s|%9s|%9s|%15s|\n", "idle", "sys", "usr", "loop");
|
||||||
printf("|---------|---------|---------|---------------|\n");
|
printf("|---------|---------|---------|---------------|\n");
|
||||||
|
@ -117,7 +120,7 @@ int main(int argc, char **argv)
|
||||||
/*
|
/*
|
||||||
* get and show cpu usage from proc_id to max_proc_id.
|
* get and show cpu usage from proc_id to max_proc_id.
|
||||||
*/
|
*/
|
||||||
if (i % (40 / (max_proc_id - proc_id + 2)) == 0) {
|
if (i % (title_line / (max_proc_id - proc_id + 2)) == 0) {
|
||||||
printf("|---------|---------|---------|"
|
printf("|---------|---------|---------|"
|
||||||
"---------|---------------|\n");
|
"---------|---------------|\n");
|
||||||
printf("|%9s|%9s|%9s|%9s|%15s|\n",
|
printf("|%9s|%9s|%9s|%9s|%15s|\n",
|
||||||
|
|
|
@ -57,6 +57,7 @@ int main(int argc, char **argv)
|
||||||
int proc_id = 0, max_proc_id = -1;
|
int proc_id = 0, max_proc_id = -1;
|
||||||
uint64_t rxp, rxb, txp, txb;
|
uint64_t rxp, rxb, txp, txb;
|
||||||
uint64_t prxp, prxb, ptxp, ptxb;
|
uint64_t prxp, prxb, ptxp, ptxb;
|
||||||
|
int title_line = 40;
|
||||||
|
|
||||||
ff_ipc_init();
|
ff_ipc_init();
|
||||||
|
|
||||||
|
@ -77,6 +78,8 @@ int main(int argc, char **argv)
|
||||||
ff_ipc_exit();
|
ff_ipc_exit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (max_proc_id > title_line - 2)
|
||||||
|
title_line = max_proc_id + 2;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
delay = atoi(optarg) ?: 1;
|
delay = atoi(optarg) ?: 1;
|
||||||
|
@ -140,7 +143,7 @@ int main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i % 40 == 0) {
|
if (i % title_line == 0) {
|
||||||
printf("|--------------------|--------------------|");
|
printf("|--------------------|--------------------|");
|
||||||
printf("--------------------|--------------------|\n");
|
printf("--------------------|--------------------|\n");
|
||||||
printf("|%20s|%20s|%20s|%20s|\n", "rx packets", "rx bytes",
|
printf("|%20s|%20s|%20s|%20s|\n", "rx packets", "rx bytes",
|
||||||
|
@ -161,7 +164,7 @@ int main(int argc, char **argv)
|
||||||
/*
|
/*
|
||||||
* get and show traffic from proc_id to max_proc_id.
|
* get and show traffic from proc_id to max_proc_id.
|
||||||
*/
|
*/
|
||||||
if (i % (40 / (max_proc_id - proc_id + 2)) == 0) {
|
if (i % (title_line / (max_proc_id - proc_id + 2)) == 0) {
|
||||||
printf("|---------|--------------------|--------------------|"
|
printf("|---------|--------------------|--------------------|"
|
||||||
"--------------------|--------------------|\n");
|
"--------------------|--------------------|\n");
|
||||||
printf("|%9s|%20s|%20s|%20s|%20s|\n",
|
printf("|%9s|%20s|%20s|%20s|%20s|\n",
|
||||||
|
|
Loading…
Reference in New Issue