Lines Matching refs:pfs

68     PREFIX_STATS *pfs;  in stats_prefix_find()  local
88 for (pfs = prefix_stats[hashval]; NULL != pfs; pfs = pfs->next) { in stats_prefix_find()
89 if (strncmp(pfs->prefix, key, length) == 0) in stats_prefix_find()
90 return pfs; in stats_prefix_find()
93 pfs = calloc(sizeof(PREFIX_STATS), 1); in stats_prefix_find()
94 if (NULL == pfs) { in stats_prefix_find()
99 pfs->prefix = malloc(length + 1); in stats_prefix_find()
100 if (NULL == pfs->prefix) { in stats_prefix_find()
102 free(pfs); in stats_prefix_find()
106 strncpy(pfs->prefix, key, length); in stats_prefix_find()
107 pfs->prefix[length] = '\0'; /* because strncpy() sucks */ in stats_prefix_find()
108 pfs->prefix_len = length; in stats_prefix_find()
110 pfs->next = prefix_stats[hashval]; in stats_prefix_find()
111 prefix_stats[hashval] = pfs; in stats_prefix_find()
116 return pfs; in stats_prefix_find()
123 PREFIX_STATS *pfs; in stats_prefix_record_get() local
126 pfs = stats_prefix_find(key, nkey); in stats_prefix_record_get()
127 if (NULL != pfs) { in stats_prefix_record_get()
128 pfs->num_gets++; in stats_prefix_record_get()
130 pfs->num_hits++; in stats_prefix_record_get()
140 PREFIX_STATS *pfs; in stats_prefix_record_delete() local
143 pfs = stats_prefix_find(key, nkey); in stats_prefix_record_delete()
144 if (NULL != pfs) { in stats_prefix_record_delete()
145 pfs->num_deletes++; in stats_prefix_record_delete()
154 PREFIX_STATS *pfs; in stats_prefix_record_set() local
157 pfs = stats_prefix_find(key, nkey); in stats_prefix_record_set()
158 if (NULL != pfs) { in stats_prefix_record_set()
159 pfs->num_sets++; in stats_prefix_record_set()
170 PREFIX_STATS *pfs; in stats_prefix_dump() local
195 for (pfs = prefix_stats[i]; NULL != pfs; pfs = pfs->next) { in stats_prefix_dump()
197 pfs->prefix, pfs->num_gets, pfs->num_hits, in stats_prefix_dump()
198 pfs->num_sets, pfs->num_deletes); in stats_prefix_dump()
254 PREFIX_STATS *pfs; in test_prefix_record_get() local
257 pfs = stats_prefix_find("abc:123"); in test_prefix_record_get()
258 test_equals_ull("get count after get #1", 1, pfs->num_gets); in test_prefix_record_get()
259 test_equals_ull("hit count after get #1", 0, pfs->num_hits); in test_prefix_record_get()
261 test_equals_ull("get count after get #2", 2, pfs->num_gets); in test_prefix_record_get()
262 test_equals_ull("hit count after get #2", 0, pfs->num_hits); in test_prefix_record_get()
264 test_equals_ull("get count after get #3", 3, pfs->num_gets); in test_prefix_record_get()
265 test_equals_ull("hit count after get #3", 1, pfs->num_hits); in test_prefix_record_get()
267 test_equals_ull("get count after get #4", 3, pfs->num_gets); in test_prefix_record_get()
268 test_equals_ull("hit count after get #4", 1, pfs->num_hits); in test_prefix_record_get()
272 PREFIX_STATS *pfs; in test_prefix_record_delete() local
275 pfs = stats_prefix_find("abc:123"); in test_prefix_record_delete()
276 test_equals_ull("get count after delete #1", 0, pfs->num_gets); in test_prefix_record_delete()
277 test_equals_ull("hit count after delete #1", 0, pfs->num_hits); in test_prefix_record_delete()
278 test_equals_ull("delete count after delete #1", 1, pfs->num_deletes); in test_prefix_record_delete()
279 test_equals_ull("set count after delete #1", 0, pfs->num_sets); in test_prefix_record_delete()
281 test_equals_ull("delete count after delete #2", 1, pfs->num_deletes); in test_prefix_record_delete()
285 PREFIX_STATS *pfs; in test_prefix_record_set() local
288 pfs = stats_prefix_find("abc:123"); in test_prefix_record_set()
289 test_equals_ull("get count after set #1", 0, pfs->num_gets); in test_prefix_record_set()
290 test_equals_ull("hit count after set #1", 0, pfs->num_hits); in test_prefix_record_set()
291 test_equals_ull("delete count after set #1", 0, pfs->num_deletes); in test_prefix_record_set()
292 test_equals_ull("set count after set #1", 1, pfs->num_sets); in test_prefix_record_set()
294 test_equals_ull("set count after set #2", 1, pfs->num_sets); in test_prefix_record_set()