MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pv_get_stat

Function pv_get_stat

modules/statistics/statistics.c:886–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884
885
886int pv_get_stat(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
887{
888 stat_var *stat;
889
890 if(msg==NULL || res==NULL)
891 return -1;
892
893 if (get_stat_name( msg, &(param->pvn), 0, &stat)!=0) {
894 LM_ERR("failed to generate/get statistic name\n");
895 return -1;
896 }
897
898 if (stat==NULL)
899 return pv_get_null(msg, param, res);
900
901 res->ri = (int)get_stat_val( stat );
902 res->rs.s = sint2str(res->ri, &res->rs.len);
903 res->flags = PV_VAL_INT|PV_VAL_STR|PV_TYPE_INT;
904
905 return 0;
906}
907
908#define get_stat_series_slot(_ss, _ts) \
909 (((_ts) % ((_ss)->profile->window * 1000)) / (_ss)->profile->slot_size)

Callers

nothing calls this directly

Calls 3

get_stat_nameFunction · 0.85
pv_get_nullFunction · 0.85
sint2strFunction · 0.85

Tested by

no test coverage detected