608 |
|
int x=1; |
609 |
|
|
610 |
|
if(*title){ |
611 |
+ |
clear(); |
612 |
|
move (num_lines-3, 1); |
613 |
|
printw("Sorting by %-64s", display_config->sortby); |
614 |
|
|
779 |
|
|
780 |
|
display_config.network_io_total_tx=1; |
781 |
|
display_config.network_io_total_rx=1; |
782 |
< |
display_config.network_all_stats=1; |
782 |
> |
display_config.network_all_stats=0; |
783 |
|
|
784 |
< |
display_config.disk_io_total_write=0; |
785 |
< |
display_config.disk_io_total_read=0; |
784 |
> |
display_config.disk_io_total_write=1; |
785 |
> |
display_config.disk_io_total_read=1; |
786 |
|
display_config.disk_io_all_stats=0; |
787 |
|
|
788 |
|
display_config.disk_total_used=0; |
906 |
|
|
907 |
|
ch=getc(stdin); |
908 |
|
switch(ch){ |
909 |
+ |
|
910 |
+ |
/* Quit */ |
911 |
|
case 'Q': |
912 |
|
case 'q': |
913 |
|
endwin(); |
914 |
|
exit(0); |
915 |
|
break; |
916 |
|
|
917 |
+ |
/* Sort by */ |
918 |
|
case 'C': |
919 |
|
sortby_ptr=cmp_cpu_used; |
920 |
|
strlcpy(display_config.sortby, CPU_USED, SORTBYMAXNAME); |
947 |
|
sortby_ptr=cmp_network_io_total; |
948 |
|
} |
949 |
|
break; |
950 |
+ |
case 'D': |
951 |
+ |
if(sortby_ptr==cmp_disk_io_total){ |
952 |
+ |
strlcpy(display_config.sortby, DISKIOR, SORTBYMAXNAME); |
953 |
+ |
sortby_ptr=cmp_disk_io_total_read; |
954 |
+ |
}else if(sortby_ptr==cmp_disk_io_total_read){ |
955 |
+ |
strlcpy(display_config.sortby, DISKIOW, SORTBYMAXNAME); |
956 |
+ |
sortby_ptr=cmp_disk_io_total_write; |
957 |
+ |
}else{ |
958 |
+ |
strlcpy(display_config.sortby, DISKIO, SORTBYMAXNAME); |
959 |
+ |
sortby_ptr=cmp_disk_io_total; |
960 |
+ |
} |
961 |
+ |
break; |
962 |
|
|
963 |
< |
} |
963 |
> |
/* Display */ |
964 |
|
|
965 |
< |
title=1; |
965 |
> |
case 'd': |
966 |
> |
if(display_config.disk_io_total_read){ |
967 |
> |
display_config.disk_io_total_read=0; |
968 |
> |
display_config.disk_io_total_write=0; |
969 |
> |
}else{ |
970 |
> |
display_config.disk_io_total_read=1; |
971 |
> |
display_config.disk_io_total_write=1; |
972 |
> |
} |
973 |
> |
break; |
974 |
> |
case 'n': |
975 |
> |
if(display_config.network_io_total_rx){ |
976 |
> |
display_config.network_io_total_rx=0; |
977 |
> |
display_config.network_io_total_tx=0; |
978 |
> |
}else{ |
979 |
> |
display_config.network_io_total_rx=1; |
980 |
> |
display_config.network_io_total_tx=1; |
981 |
> |
} |
982 |
> |
break; |
983 |
> |
case 'm': |
984 |
> |
if(display_config.memory_used_pecent){ |
985 |
> |
display_config.memory_used_pecent=0; |
986 |
> |
}else{ |
987 |
> |
display_config.memory_used_pecent=1; |
988 |
> |
} |
989 |
> |
break; |
990 |
> |
|
991 |
> |
case 's': |
992 |
> |
if(display_config.swap_used_pecent){ |
993 |
> |
display_config.swap_used_pecent=0; |
994 |
> |
}else{ |
995 |
> |
display_config.swap_used_pecent=1; |
996 |
> |
} |
997 |
> |
break; |
998 |
> |
case 'l': |
999 |
> |
if(display_config.load_1){ |
1000 |
> |
display_config.load_1=0; |
1001 |
> |
}else{ |
1002 |
> |
display_config.load_1=1; |
1003 |
> |
} |
1004 |
> |
break; |
1005 |
> |
case 'p': |
1006 |
> |
if(display_config.pages_in){ |
1007 |
> |
display_config.pages_in=0; |
1008 |
> |
display_config.pages_out=0; |
1009 |
> |
}else{ |
1010 |
> |
display_config.pages_in=1; |
1011 |
> |
display_config.pages_out=1; |
1012 |
> |
} |
1013 |
> |
break; |
1014 |
> |
case 'c': |
1015 |
> |
if(display_config.cpu_used){ |
1016 |
> |
display_config.cpu_used=0; |
1017 |
> |
}else{ |
1018 |
> |
display_config.cpu_used=1; |
1019 |
> |
} |
1020 |
> |
break; |
1021 |
> |
|
1022 |
> |
default: |
1023 |
> |
/* Invalid key.. Ignore.. Set Title to -1, as the |
1024 |
> |
* title++ will then make that "0" (false) so a |
1025 |
> |
* screen redraw will not happen */ |
1026 |
> |
title=-1; |
1027 |
> |
break; |
1028 |
> |
} |
1029 |
> |
|
1030 |
> |
/* Increment title so it becomes true (and making the screen update */ |
1031 |
> |
title++; |
1032 |
|
|
1033 |
|
} |
1034 |
|
if(FD_ISSET(data_fileno, &infds)){ |