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

Function stats_trigger_trackers

exec/stats.c:561–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559
560
561void stats_trigger_trackers(void)
562{
563 struct cs_stats_tracker *tracker;
564 struct qb_list_head *iter;
565 cs_error_t res;
566 size_t value_len;
567 icmap_value_types_t type;
568 uint64_t value;
569 struct icmap_notify_value new_val;
570 struct icmap_notify_value old_val;
571
572 qb_list_for_each(iter, &stats_tracker_list_head) {
573
574 tracker = qb_list_entry(iter, struct cs_stats_tracker, list);
575 if (tracker->events & ICMAP_TRACK_PREFIX || !tracker->key_name ) {
576 continue;
577 }
578
579 res = stats_map_get(tracker->key_name,
580 &value, &value_len, &type);
581
582 /* Check if it has changed */
583 if ((res == CS_OK) && (memcmp(&value, &tracker->old_value, value_len) != 0)) {
584
585 old_val.type = new_val.type = type;
586 old_val.len = new_val.len = value_len;
587 old_val.data = new_val.data = &value;
588
589 tracker->notify_fn(ICMAP_TRACK_MODIFY, tracker->key_name,
590 old_val, new_val, tracker->user_data);
591
592 memcpy(&tracker->old_value, &value, value_len);
593 }
594 }
595}
596
597
598/* Callback from libqb when a key is added/removed */

Callers 1

Calls 1

stats_map_getFunction · 0.85

Tested by

no test coverage detected