skip to content
==> include/mesh/sched_report.h <==
1/* @ajax/mesh-sched-report: a member's F_PERF (text): its capacity, its programs' measured
2 * performance, its reconcile failures, the link RTTs it measured and the echoes that let the others
3 * measure theirs. */
4#ifndef MESH_SCHED_REPORT_H
5#define MESH_SCHED_REPORT_H
6
7#include "mesh/sched_member.h"
8
9#include <stdbool.h>
10#include <stdint.h>
11
12typedef struct {
13    char *name;
14    msm_perf perf;
15} msr_prog;
16
17/* A program this member's reconciler failed. */
18typedef struct {
19    char *name;
20    uint64_t hash;
21    bool unsupported;
22    char *why;
23} msr_fail;
24
25typedef struct {
26    uint32_t k;
27    float us;
28} msr_rtt;
29
30/* (member, its t_us we received last, µs we held it before this send) */
31typedef struct {
32    uint32_t k;
33    uint64_t t, held;
34} msr_echo;
35
36typedef struct {
37    uint64_t t_us; /* the sender's clock at the send (µs; echoed back) */
38    uint32_t cpus, big, little, ram_mb, disk_free_mb;
39    uint32_t heap_kb, slots_free; /* the view heap's largest free run (KiB) and the free slots */
40    msr_prog *progs;
41    size_t nprogs;
42    msr_fail *fails;
43    size_t nfails;
44    msr_rtt *rtt;
45    size_t nrtt;
46    msr_echo *echo;
47    size_t necho;
48} msr_report;
49
50void msr_add_prog(msr_report *r, const char *name, const msm_perf *p);
51void msr_add_fail(msr_report *r, const char *name, uint64_t hash, bool unsupported, const char *why);
52void msr_add_rtt(msr_report *r, uint32_t k, float us);
53void msr_add_echo(msr_report *r, uint32_t k, uint64_t t, uint64_t held);
54char *msr_encode(const msr_report *r);
55bool msr_decode(const char *text, msr_report *out, char **err);
56bool msr_eq(const msr_report *a, const msr_report *b);
57void msr_free(msr_report *r);
58
59#endif