show heap usage in statusbar
This commit is contained in:
parent
a0af80f447
commit
9d1b4bfd05
12
src/ui.c
12
src/ui.c
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "term.h"
|
||||
#include <gint/display.h>
|
||||
#include <gint/kmalloc.h>
|
||||
#include <gint/mmu.h>
|
||||
#include <gint/rtc.h>
|
||||
|
||||
#include <printf.h>
|
||||
|
@ -40,15 +42,19 @@ void set_statusbar(int tick_ctr, int shift_state, int alpha_state, int battery)
|
|||
for (int i = 0; i < UNS_TERM_COLS; i++)
|
||||
term_writeat(0, i, C_NONE, C_GREEN, " ");
|
||||
|
||||
kmalloc_arena_t *uram_arena = kmalloc_get_arena("_uram");
|
||||
kmalloc_gint_stats_t *ram_stats = kmalloc_get_gint_stats(uram_arena);
|
||||
const int uram_percent = 100 * ram_stats->used_memory / mmu_uram_size();
|
||||
|
||||
char *shift_symbol = shift_state ? "⇫" : " ";
|
||||
char *alpha_symbol = alpha_state ? (shift_state ? "A" : "a") : "1";
|
||||
|
||||
char prefix[UNS_TERM_COLS + 1];
|
||||
sprintf(prefix, "%s%s t=%d bat=%.2fV uram=%d%%", shift_symbol, alpha_symbol, tick_ctr, (float)battery / 100, uram_percent);
|
||||
|
||||
char now[32];
|
||||
date_str(now);
|
||||
|
||||
char prefix[UNS_TERM_COLS + 1];
|
||||
sprintf(prefix, "%s%s t=%d bat=%.2fV", shift_symbol, alpha_symbol, tick_ctr, (float)battery / 100);
|
||||
|
||||
char suffix[UNS_TERM_COLS + 1];
|
||||
sprintf(suffix, "%s", now);
|
||||
|
||||
|
|
Loading…
Reference in New Issue