diff options
author | jsing <> | 2024-06-30 14:13:08 +0000 |
---|---|---|
committer | jsing <> | 2024-06-30 14:13:08 +0000 |
commit | 44999a077ead48476ede7c66f756255656af8edc (patch) | |
tree | 9338130d10bcc001c129ddd699c448b4a05fe252 | |
parent | b2cf112923c918cb07c51600464d2157ee928fb6 (diff) | |
download | openbsd-44999a077ead48476ede7c66f756255656af8edc.tar.gz openbsd-44999a077ead48476ede7c66f756255656af8edc.tar.bz2 openbsd-44999a077ead48476ede7c66f756255656af8edc.zip |
Remove lhash statistics.
These are not exactly useful and we previously stopped exposing them.
ok tb@
-rw-r--r-- | src/lib/libcrypto/lhash/lhash.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/lhash/lhash_local.h | 16 |
2 files changed, 2 insertions, 30 deletions
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index 025ded0e8a..150831c116 100644 --- a/src/lib/libcrypto/lhash/lhash.c +++ b/src/lib/libcrypto/lhash/lhash.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: lhash.c,v 1.26 2024/06/22 16:38:31 jsing Exp $ */ | 1 | /* $OpenBSD: lhash.c,v 1.27 2024/06/30 14:13:08 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -80,7 +80,6 @@ expand(_LHASH *lh) | |||
80 | unsigned long hash, nni; | 80 | unsigned long hash, nni; |
81 | 81 | ||
82 | lh->num_nodes++; | 82 | lh->num_nodes++; |
83 | lh->num_expands++; | ||
84 | p = (int)lh->p++; | 83 | p = (int)lh->p++; |
85 | n1 = &(lh->b[p]); | 84 | n1 = &(lh->b[p]); |
86 | n2 = &(lh->b[p + (int)lh->pmax]); | 85 | n2 = &(lh->b[p + (int)lh->pmax]); |
@@ -92,7 +91,6 @@ expand(_LHASH *lh) | |||
92 | hash = np->hash; | 91 | hash = np->hash; |
93 | #else | 92 | #else |
94 | hash = lh->hash(np->data); | 93 | hash = lh->hash(np->data); |
95 | lh->num_hash_calls++; | ||
96 | #endif | 94 | #endif |
97 | if ((hash % nni) != p) { /* move it */ | 95 | if ((hash % nni) != p) { /* move it */ |
98 | *n1 = (*n1)->next; | 96 | *n1 = (*n1)->next; |
@@ -117,7 +115,6 @@ expand(_LHASH *lh) | |||
117 | n[i] = NULL; /* 02/03/92 eay */ | 115 | n[i] = NULL; /* 02/03/92 eay */ |
118 | lh->pmax = lh->num_alloc_nodes; | 116 | lh->pmax = lh->num_alloc_nodes; |
119 | lh->num_alloc_nodes = j; | 117 | lh->num_alloc_nodes = j; |
120 | lh->num_expand_reallocs++; | ||
121 | lh->p = 0; | 118 | lh->p = 0; |
122 | lh->b = n; | 119 | lh->b = n; |
123 | } | 120 | } |
@@ -137,7 +134,6 @@ contract(_LHASH *lh) | |||
137 | lh->error++; | 134 | lh->error++; |
138 | return; | 135 | return; |
139 | } | 136 | } |
140 | lh->num_contract_reallocs++; | ||
141 | lh->num_alloc_nodes /= 2; | 137 | lh->num_alloc_nodes /= 2; |
142 | lh->pmax /= 2; | 138 | lh->pmax /= 2; |
143 | lh->p = lh->pmax - 1; | 139 | lh->p = lh->pmax - 1; |
@@ -146,7 +142,6 @@ contract(_LHASH *lh) | |||
146 | lh->p--; | 142 | lh->p--; |
147 | 143 | ||
148 | lh->num_nodes--; | 144 | lh->num_nodes--; |
149 | lh->num_contracts++; | ||
150 | 145 | ||
151 | n1 = lh->b[(int)lh->p]; | 146 | n1 = lh->b[(int)lh->p]; |
152 | if (n1 == NULL) | 147 | if (n1 == NULL) |
@@ -166,7 +161,6 @@ getrn(_LHASH *lh, const void *data, unsigned long *rhash) | |||
166 | LHASH_COMP_FN_TYPE cf; | 161 | LHASH_COMP_FN_TYPE cf; |
167 | 162 | ||
168 | hash = (*(lh->hash))(data); | 163 | hash = (*(lh->hash))(data); |
169 | lh->num_hash_calls++; | ||
170 | *rhash = hash; | 164 | *rhash = hash; |
171 | 165 | ||
172 | nn = hash % lh->pmax; | 166 | nn = hash % lh->pmax; |
@@ -177,13 +171,11 @@ getrn(_LHASH *lh, const void *data, unsigned long *rhash) | |||
177 | ret = &(lh->b[(int)nn]); | 171 | ret = &(lh->b[(int)nn]); |
178 | for (n1 = *ret; n1 != NULL; n1 = n1->next) { | 172 | for (n1 = *ret; n1 != NULL; n1 = n1->next) { |
179 | #ifndef OPENSSL_NO_HASH_COMP | 173 | #ifndef OPENSSL_NO_HASH_COMP |
180 | lh->num_hash_comps++; | ||
181 | if (n1->hash != hash) { | 174 | if (n1->hash != hash) { |
182 | ret = &(n1->next); | 175 | ret = &(n1->next); |
183 | continue; | 176 | continue; |
184 | } | 177 | } |
185 | #endif | 178 | #endif |
186 | lh->num_comp_calls++; | ||
187 | if (cf(n1->data, data) == 0) | 179 | if (cf(n1->data, data) == 0) |
188 | break; | 180 | break; |
189 | ret = &(n1->next); | 181 | ret = &(n1->next); |
@@ -268,14 +260,12 @@ lh_insert(_LHASH *lh, void *data) | |||
268 | #endif | 260 | #endif |
269 | *rn = nn; | 261 | *rn = nn; |
270 | ret = NULL; | 262 | ret = NULL; |
271 | lh->num_insert++; | ||
272 | lh->num_items++; | 263 | lh->num_items++; |
273 | } | 264 | } |
274 | else /* replace same key */ | 265 | else /* replace same key */ |
275 | { | 266 | { |
276 | ret = (*rn)->data; | 267 | ret = (*rn)->data; |
277 | (*rn)->data = data; | 268 | (*rn)->data = data; |
278 | lh->num_replace++; | ||
279 | } | 269 | } |
280 | return (ret); | 270 | return (ret); |
281 | } | 271 | } |
@@ -292,14 +282,12 @@ lh_delete(_LHASH *lh, const void *data) | |||
292 | rn = getrn(lh, data, &hash); | 282 | rn = getrn(lh, data, &hash); |
293 | 283 | ||
294 | if (*rn == NULL) { | 284 | if (*rn == NULL) { |
295 | lh->num_no_delete++; | ||
296 | return (NULL); | 285 | return (NULL); |
297 | } else { | 286 | } else { |
298 | nn= *rn; | 287 | nn= *rn; |
299 | *rn = nn->next; | 288 | *rn = nn->next; |
300 | ret = nn->data; | 289 | ret = nn->data; |
301 | free(nn); | 290 | free(nn); |
302 | lh->num_delete++; | ||
303 | } | 291 | } |
304 | 292 | ||
305 | lh->num_items--; | 293 | lh->num_items--; |
@@ -322,11 +310,9 @@ lh_retrieve(_LHASH *lh, const void *data) | |||
322 | rn = getrn(lh, data, &hash); | 310 | rn = getrn(lh, data, &hash); |
323 | 311 | ||
324 | if (*rn == NULL) { | 312 | if (*rn == NULL) { |
325 | lh->num_retrieve_miss++; | ||
326 | return (NULL); | 313 | return (NULL); |
327 | } else { | 314 | } else { |
328 | ret = (*rn)->data; | 315 | ret = (*rn)->data; |
329 | lh->num_retrieve++; | ||
330 | } | 316 | } |
331 | return (ret); | 317 | return (ret); |
332 | } | 318 | } |
diff --git a/src/lib/libcrypto/lhash/lhash_local.h b/src/lib/libcrypto/lhash/lhash_local.h index 5466e554e7..1748845c41 100644 --- a/src/lib/libcrypto/lhash/lhash_local.h +++ b/src/lib/libcrypto/lhash/lhash_local.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: lhash_local.h,v 1.1 2024/03/02 11:11:11 tb Exp $ */ | 1 | /* $OpenBSD: lhash_local.h,v 1.2 2024/06/30 14:13:08 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -85,20 +85,6 @@ struct lhash_st { | |||
85 | unsigned long down_load; /* load times 256 */ | 85 | unsigned long down_load; /* load times 256 */ |
86 | unsigned long num_items; | 86 | unsigned long num_items; |
87 | 87 | ||
88 | unsigned long num_expands; | ||
89 | unsigned long num_expand_reallocs; | ||
90 | unsigned long num_contracts; | ||
91 | unsigned long num_contract_reallocs; | ||
92 | unsigned long num_hash_calls; | ||
93 | unsigned long num_comp_calls; | ||
94 | unsigned long num_insert; | ||
95 | unsigned long num_replace; | ||
96 | unsigned long num_delete; | ||
97 | unsigned long num_no_delete; | ||
98 | unsigned long num_retrieve; | ||
99 | unsigned long num_retrieve_miss; | ||
100 | unsigned long num_hash_comps; | ||
101 | |||
102 | int error; | 88 | int error; |
103 | } /* _LHASH */; | 89 | } /* _LHASH */; |
104 | 90 | ||