skip to content
==> include/mesh/top_ui_load.h <==
1/* @ajax/mesh-top-ui-load: mesh-top's load panes (crates/mesh-top src/ui.rs, "8 load"): the Load
2 * tab (every machine's GPU share and host pressure, the focused machine's cores, programs and
3 * share history), the Load box in a machine panel, and the overview's load cells. */
4#ifndef MESH_TOP_UI_LOAD_H
5#define MESH_TOP_UI_LOAD_H
6
7#include "mesh/top_ui_kit.h"
8
9/* The overview's load figures, from a machine's own sample or a member's F_LOADREP. */
10typedef struct {
11    mt_opt_f32 share;
12    float cpu, big;
13    mt_opt_f32 little;
14    bool has_psi;
15    float psi[2];
16    mt_opt_f32 mem_free;
17    float meshd;
18} mt_load_row;
19mt_load_row mt_load_row_from_load(const mt_load *l);
20mt_load_row mt_load_row_from_member(const mt_member_load *l);
21
22/* Which load columns the overview has room for. */
23typedef enum { MT_LOAD_COLS_NONE, MT_LOAD_COLS_ONE, MT_LOAD_COLS_PAIR, MT_LOAD_COLS_FULL } mt_load_cols;
24size_t mt_load_cols_header(mt_load_cols lt, const char **out);     /* at most 4 */
25size_t mt_load_cols_widths(mt_load_cols lt, tui_constraint *out);  /* at most 4 */
26/* The overview's load cells (r NULL: dashes); returns the count written (at most 4). */
27size_t mt_load_cells(mt_frame *f, const mt_load_row *r, mt_load_cols lt, tui_table_cell *out);
28
29/* `88/124G`. */
30const char *mt_gb_pair(mt_frame *f, uint32_t a_mb, uint32_t b_mb);
31/* The Load box's lines in a machine panel: full (3 lines) or compact (1). */
32void mt_load_lines(mt_frame *f, const mt_load *l, bool compact, mt_lines *out);
33void mt_draw_load_box(mt_frame *f, tui_rect area, const mt_snapshot *s, const mt_lines *lines);
34/* The Load tab. */
35void mt_draw_load(mt_frame *f, tui_rect area, const mt_app *app);
36
37#endif