184 printf(
"\033[1;33m CPU Usage:\033[0m\033[K\n");
192 clock_t totalDelta = currTotal - prevTotal;
213 printf(
" \033[90mCPU%-2llu\033[0m %s%3llu.%03llu%%\033[0m [", i, color, whole, thousandths);
215 uint64_t barLength = (whole * cpuBarWidth) / 100;
216 for (
uint64_t j = 0; j < cpuBarWidth; j++)
220 printf(
"%s#\033[0m", color);
224 printf(
"\033[90m \033[0m");
232 printf(
"\033[1;33m Memory:\033[0m\033[K\n");
251 printf(
" \033[90mUsed:\033[0m %s%5llu MiB\033[0m / %5llu MiB "
252 "\033[90m(%s%3llu.%03llu%%\033[0m\033[90m)\033[0m\033[K\n",
253 color, usedKiB / 1024, stats->
memStats.
totalKiB / 1024, color, whole, thousandths);
257 uint64_t barLength = (whole * memBarWidth) / 100;
258 for (
uint64_t j = 0; j < memBarWidth; j++)
262 printf(
"%s#\033[0m", color);
266 printf(
"\033[90m \033[0m");
uint64_t read(fd_t fd, void *buffer, uint64_t count)
System call for reading from files.
static uint64_t terminal_columns_get(void)
static uint64_t cpu_stat_count_cpus(void)
static void stats_update(stats_t *stats)
static uint64_t mem_stat_read(mem_stats_t *memStats)
static void stats_print(stats_t *stats)
static uint64_t terminalColumns
static void stat_percentage(clock_t part, clock_t total, uint64_t *whole, uint64_t *thousandths)
static uint64_t cpu_stat_read(cpu_stats_t *cpuStats, uint64_t cpuAmount)