mirror of
https://github.com/sched-ext/scx.git
synced 2024-12-16 05:07:16 +00:00
3a688cfde7
- Allow no-value user attributes which are automatically assigned "true" when specified. - Make "top" attribute string "true" instead of bool true for consistency. Testing for existence is always enough for value-less attributes. - Don't drop leading "_" from user attribute names when storing in dicts. Dropping makes things more confusing. - Add "_om_skip" to scx_layered fields which don't jive well with OM. scxstats_to_openmetrics.py is updated accordignly and no longer generates warnings on those fields. - Examples and README updated accordingly.
26 lines
897 B
C
26 lines
897 B
C
// To be included from server.rs and client.rs examples. This would usually
|
|
// be done through the usual pub struct definitions but it's cumbersome to
|
|
// do in the examples directory, so work around with c-like includes.
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Stats)]
|
|
#[stat(desc = "domain statistics", _om_prefix="d_", _om_label="domain_name")]
|
|
struct DomainStats {
|
|
pub name: String,
|
|
#[stat(desc = "an event counter")]
|
|
pub events: u64,
|
|
#[stat(desc = "a gauge number")]
|
|
pub pressure: f64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Stats)]
|
|
#[stat(desc = "cluster statistics", top)]
|
|
struct ClusterStats {
|
|
pub name: String,
|
|
#[stat(desc = "update timestamp")]
|
|
pub at: u64,
|
|
#[stat(desc = "some bitmap we want to report", _om_skip)]
|
|
pub bitmap: Vec<u32>,
|
|
#[stat(desc = "domain statistics")]
|
|
pub doms_dict: BTreeMap<usize, DomainStats>,
|
|
}
|