feat: update c files
This commit is contained in:
parent
166092bd6f
commit
0f61b50a76
@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Version 0.2.0 - 2025-12-13
|
||||||
|
|
||||||
|
The rtop tool now includes updated C source code. This improves the tool's functionality and performance.
|
||||||
|
|
||||||
|
**Changes:** 2 files, 97 lines
|
||||||
|
**Languages:** C (97 lines)
|
||||||
|
|
||||||
## Version 0.1.0 - 2025-12-13
|
## Version 0.1.0 - 2025-12-13
|
||||||
|
|
||||||
The application now includes a CPU tab with core usage and temperature details. Users can view memory, process, network, disk, and filesystem statistics, along with improved memory detail views.
|
The application now includes a CPU tab with core usage and temperature details. Users can view memory, process, network, disk, and filesystem statistics, along with improved memory detail views.
|
||||||
|
|||||||
@ -48,6 +48,7 @@ static void print_help(const char *program) {
|
|||||||
printf("\nNavigation:\n");
|
printf("\nNavigation:\n");
|
||||||
printf(" Left/Right arrows Switch tabs\n");
|
printf(" Left/Right arrows Switch tabs\n");
|
||||||
printf(" 1-5 Jump to tab\n");
|
printf(" 1-5 Jump to tab\n");
|
||||||
|
printf(" ESC Pause (for copy/paste)\n");
|
||||||
printf(" q Quit\n");
|
printf(" q Quit\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ int main(int argc, char *argv[]) {
|
|||||||
double rotate_interval = 0.0;
|
double rotate_interval = 0.0;
|
||||||
int sort_by_mem = 0;
|
int sort_by_mem = 0;
|
||||||
int current_tab = TAB_CPU;
|
int current_tab = TAB_CPU;
|
||||||
|
int paused = 0;
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"delay", required_argument, 0, 'd'},
|
{"delay", required_argument, 0, 'd'},
|
||||||
@ -148,6 +150,7 @@ int main(int argc, char *argv[]) {
|
|||||||
double rotate_elapsed = 0.0;
|
double rotate_elapsed = 0.0;
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
|
if (!paused) {
|
||||||
system_info_update(&sys);
|
system_info_update(&sys);
|
||||||
cpu_info_update(&cpu, refresh_interval);
|
cpu_info_update(&cpu, refresh_interval);
|
||||||
memory_info_update(&mem, refresh_interval);
|
memory_info_update(&mem, refresh_interval);
|
||||||
@ -197,6 +200,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
display_footer(&term, refresh_interval);
|
display_footer(&term, refresh_interval);
|
||||||
terminal_buffer_flush(&term);
|
terminal_buffer_flush(&term);
|
||||||
|
}
|
||||||
|
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
@ -210,15 +214,20 @@ int main(int argc, char *argv[]) {
|
|||||||
int key = read_key();
|
int key = read_key();
|
||||||
if (key == 'q' || key == 'Q') {
|
if (key == 'q' || key == 'Q') {
|
||||||
running = 0;
|
running = 0;
|
||||||
|
} else if (key == 27) {
|
||||||
|
paused = 1;
|
||||||
} else if (key == 1003) {
|
} else if (key == 1003) {
|
||||||
current_tab = (current_tab + 1) % TAB_COUNT;
|
current_tab = (current_tab + 1) % TAB_COUNT;
|
||||||
rotate_elapsed = 0.0;
|
rotate_elapsed = 0.0;
|
||||||
|
paused = 0;
|
||||||
} else if (key == 1004) {
|
} else if (key == 1004) {
|
||||||
current_tab = (current_tab - 1 + TAB_COUNT) % TAB_COUNT;
|
current_tab = (current_tab - 1 + TAB_COUNT) % TAB_COUNT;
|
||||||
rotate_elapsed = 0.0;
|
rotate_elapsed = 0.0;
|
||||||
|
paused = 0;
|
||||||
} else if (key >= '1' && key <= '5') {
|
} else if (key >= '1' && key <= '5') {
|
||||||
current_tab = key - '1';
|
current_tab = key - '1';
|
||||||
rotate_elapsed = 0.0;
|
rotate_elapsed = 0.0;
|
||||||
|
paused = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user