I am using MMV libraries provided by Performance Co-Pilot (PCP) framework. I need to reset the value in the MMV instance on a regular interval basis. I came across the mmv_stats_interval_start() api of PCP. Please explain how this api is working and how to get notification when the interval is elapsed.
mmv_stats_interval_start(void *addr, pmAtomValue *value,
const char *metric, const char *instance)
{
if (addr) {
if (value == NULL)
value = mmv_lookup_value_desc(addr, metric, instance);
if (value) {
struct timeval tv;
__pmtimevalNow(&tv);
mmv_inc_value(addr, value, -(tv.tv_sec*1e6 + tv.tv_usec));
}
}
return value;
}
An example in the github page of PCP is mmv_genstats.c