MCPcopy Create free account
hub / github.com/corosync/corosync / mem_update_stats_fn

Function mem_update_stats_fn

exec/mon.c:346–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346static void mem_update_stats_fn (void *data)
347{
348 struct resource_instance * inst = (struct resource_instance *)data;
349 int32_t new_value;
350 uint64_t timestamp;
351 char key_name[ICMAP_KEYNAME_MAXLEN];
352
353 new_value = percent_mem_used_get();
354 if (new_value > 0) {
355 snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", inst->icmap_path, "current");
356 icmap_set_uint32(key_name, new_value);
357
358 timestamp = cs_timestamp_get();
359
360 snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", inst->icmap_path, "last_updated");
361 icmap_set_uint64(key_name, timestamp);
362
363 if (new_value > inst->max.int32 && inst->fsm.curr_state != MON_S_FAILED) {
364 cs_fsm_process (&inst->fsm, MON_E_FAILURE, inst, mon_fsm_cb);
365 }
366 }
367 api->timer_add_duration(inst->period * MILLI_2_NANO_SECONDS,
368 inst, inst->update_stats_fn, &inst->timer_handle);
369}
370
371static double min15_loadavg_get(void)
372{

Callers

nothing calls this directly

Calls 5

percent_mem_used_getFunction · 0.85
icmap_set_uint32Function · 0.85
cs_timestamp_getFunction · 0.85
icmap_set_uint64Function · 0.85
cs_fsm_processFunction · 0.85

Tested by

no test coverage detected