reworked monitor command
the monitor command now uses ncurses for a better ui experience, with this change i have reworked some of the code and the list is now sorted by CPU usage. processes can now be filtered with using '/', the process list will update in real time so you can find the process you are looking fro faster
This commit is contained in:
BIN
builtins.o
BIN
builtins.o
Binary file not shown.
BIN
line_reader.o
BIN
line_reader.o
Binary file not shown.
1116
system_monitor.c
1116
system_monitor.c
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <ncurses.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -24,6 +25,23 @@ typedef struct {
|
||||
int process_count;
|
||||
} SystemStats;
|
||||
|
||||
typedef struct {
|
||||
WINDOW *main_win;
|
||||
WINDOW *header_win;
|
||||
WINDOW *stats_win;
|
||||
WINDOW *process_win;
|
||||
WINDOW *status_win;
|
||||
WINDOW *search_win;
|
||||
int terminal_height;
|
||||
int terminal_width;
|
||||
int selected_process;
|
||||
int refresh_rate;
|
||||
int process_scroll_offset;
|
||||
int search_mode;
|
||||
char search_buffer[256];
|
||||
int search_cursor;
|
||||
} NCursesMonitor;
|
||||
|
||||
typedef struct {
|
||||
int pid;
|
||||
char name[256];
|
||||
@@ -32,6 +50,7 @@ typedef struct {
|
||||
char state;
|
||||
} ProcessInfo;
|
||||
|
||||
int init_ncurses_monitor(NCursesMonitor *monitor);
|
||||
int builtin_monitor(char **args);
|
||||
void display_dashboard(SystemStats *stats, ProcessInfo *processes,
|
||||
int proc_count);
|
||||
@@ -45,5 +64,9 @@ int kbhit(void);
|
||||
void draw_progress_bar(int percentage, int width);
|
||||
void format_progress_bar(int percentage, int width, char *buffer);
|
||||
void format_bytes(unsigned long bytes, char *buffer);
|
||||
void cleanup_ncurses_monitor(NCursesMonitor *monitor);
|
||||
void display_ncurses_dashboard(NCursesMonitor *monitor, SystemStats *stats,
|
||||
ProcessInfo *processes, int proc_count);
|
||||
void handle_monitor_input(NCursesMonitor *monitor, int ch);
|
||||
|
||||
#endif
|
||||
|
||||
BIN
system_monitor.o
BIN
system_monitor.o
Binary file not shown.
Reference in New Issue
Block a user