diff options
Diffstat (limited to 'src/lib/libcrypto/lhash/lh_stats.c')
-rw-r--r-- | src/lib/libcrypto/lhash/lh_stats.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/src/lib/libcrypto/lhash/lh_stats.c b/src/lib/libcrypto/lhash/lh_stats.c index 39ea2885f4..8e6f57c741 100644 --- a/src/lib/libcrypto/lhash/lh_stats.c +++ b/src/lib/libcrypto/lhash/lh_stats.c | |||
@@ -181,46 +181,60 @@ void lh_stats_bio(const LHASH *lh, BIO *out) | |||
181 | { | 181 | { |
182 | char buf[128]; | 182 | char buf[128]; |
183 | 183 | ||
184 | sprintf(buf,"num_items = %lu\n",lh->num_items); | 184 | snprintf(buf,sizeof buf,"num_items = %lu\n",lh->num_items); |
185 | BIO_puts(out,buf); | 185 | BIO_puts(out,buf); |
186 | sprintf(buf,"num_nodes = %u\n",lh->num_nodes); | 186 | snprintf(buf,sizeof buf,"num_nodes = %u\n",lh->num_nodes); |
187 | BIO_puts(out,buf); | 187 | BIO_puts(out,buf); |
188 | sprintf(buf,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); | 188 | snprintf(buf,sizeof buf,"num_alloc_nodes = %u\n", |
189 | lh->num_alloc_nodes); | ||
189 | BIO_puts(out,buf); | 190 | BIO_puts(out,buf); |
190 | sprintf(buf,"num_expands = %lu\n",lh->num_expands); | 191 | snprintf(buf,sizeof buf,"num_expands = %lu\n", |
192 | lh->num_expands); | ||
191 | BIO_puts(out,buf); | 193 | BIO_puts(out,buf); |
192 | sprintf(buf,"num_expand_reallocs = %lu\n",lh->num_expand_reallocs); | 194 | snprintf(buf,sizeof buf,"num_expand_reallocs = %lu\n", |
195 | lh->num_expand_reallocs); | ||
193 | BIO_puts(out,buf); | 196 | BIO_puts(out,buf); |
194 | sprintf(buf,"num_contracts = %lu\n",lh->num_contracts); | 197 | snprintf(buf,sizeof buf,"num_contracts = %lu\n", |
198 | lh->num_contracts); | ||
195 | BIO_puts(out,buf); | 199 | BIO_puts(out,buf); |
196 | sprintf(buf,"num_contract_reallocs = %lu\n",lh->num_contract_reallocs); | 200 | snprintf(buf,sizeof buf,"num_contract_reallocs = %lu\n", |
201 | lh->num_contract_reallocs); | ||
197 | BIO_puts(out,buf); | 202 | BIO_puts(out,buf); |
198 | sprintf(buf,"num_hash_calls = %lu\n",lh->num_hash_calls); | 203 | snprintf(buf,sizeof buf,"num_hash_calls = %lu\n", |
204 | lh->num_hash_calls); | ||
199 | BIO_puts(out,buf); | 205 | BIO_puts(out,buf); |
200 | sprintf(buf,"num_comp_calls = %lu\n",lh->num_comp_calls); | 206 | snprintf(buf,sizeof buf,"num_comp_calls = %lu\n", |
207 | lh->num_comp_calls); | ||
201 | BIO_puts(out,buf); | 208 | BIO_puts(out,buf); |
202 | sprintf(buf,"num_insert = %lu\n",lh->num_insert); | 209 | snprintf(buf,sizeof buf,"num_insert = %lu\n", |
210 | lh->num_insert); | ||
203 | BIO_puts(out,buf); | 211 | BIO_puts(out,buf); |
204 | sprintf(buf,"num_replace = %lu\n",lh->num_replace); | 212 | snprintf(buf,sizeof buf,"num_replace = %lu\n", |
213 | lh->num_replace); | ||
205 | BIO_puts(out,buf); | 214 | BIO_puts(out,buf); |
206 | sprintf(buf,"num_delete = %lu\n",lh->num_delete); | 215 | snprintf(buf,sizeof buf,"num_delete = %lu\n", |
216 | lh->num_delete); | ||
207 | BIO_puts(out,buf); | 217 | BIO_puts(out,buf); |
208 | sprintf(buf,"num_no_delete = %lu\n",lh->num_no_delete); | 218 | snprintf(buf,sizeof buf,"num_no_delete = %lu\n", |
219 | lh->num_no_delete); | ||
209 | BIO_puts(out,buf); | 220 | BIO_puts(out,buf); |
210 | sprintf(buf,"num_retrieve = %lu\n",lh->num_retrieve); | 221 | snprintf(buf,sizeof buf,"num_retrieve = %lu\n", |
222 | lh->num_retrieve); | ||
211 | BIO_puts(out,buf); | 223 | BIO_puts(out,buf); |
212 | sprintf(buf,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); | 224 | snprintf(buf,sizeof buf,"num_retrieve_miss = %lu\n", |
225 | lh->num_retrieve_miss); | ||
213 | BIO_puts(out,buf); | 226 | BIO_puts(out,buf); |
214 | sprintf(buf,"num_hash_comps = %lu\n",lh->num_hash_comps); | 227 | snprintf(buf,sizeof buf,"num_hash_comps = %lu\n", |
228 | lh->num_hash_comps); | ||
215 | BIO_puts(out,buf); | 229 | BIO_puts(out,buf); |
216 | #if 0 | 230 | #if 0 |
217 | sprintf(buf,"p = %u\n",lh->p); | 231 | snprintf(buf,sizeof buf,"p = %u\n",lh->p); |
218 | BIO_puts(out,buf); | 232 | BIO_puts(out,buf); |
219 | sprintf(buf,"pmax = %u\n",lh->pmax); | 233 | snprintf(buf,sizeof buf,"pmax = %u\n",lh->pmax); |
220 | BIO_puts(out,buf); | 234 | BIO_puts(out,buf); |
221 | sprintf(buf,"up_load = %lu\n",lh->up_load); | 235 | snprintf(buf,sizeof buf,"up_load = %lu\n",lh->up_load); |
222 | BIO_puts(out,buf); | 236 | BIO_puts(out,buf); |
223 | sprintf(buf,"down_load = %lu\n",lh->down_load); | 237 | snprintf(buf,sizeof buf,"down_load = %lu\n",lh->down_load); |
224 | BIO_puts(out,buf); | 238 | BIO_puts(out,buf); |
225 | #endif | 239 | #endif |
226 | } | 240 | } |
@@ -235,7 +249,7 @@ void lh_node_stats_bio(const LHASH *lh, BIO *out) | |||
235 | { | 249 | { |
236 | for (n=lh->b[i],num=0; n != NULL; n=n->next) | 250 | for (n=lh->b[i],num=0; n != NULL; n=n->next) |
237 | num++; | 251 | num++; |
238 | sprintf(buf,"node %6u -> %3u\n",i,num); | 252 | snprintf(buf,sizeof buf,"node %6u -> %3u\n",i,num); |
239 | BIO_puts(out,buf); | 253 | BIO_puts(out,buf); |
240 | } | 254 | } |
241 | } | 255 | } |
@@ -258,12 +272,13 @@ void lh_node_usage_stats_bio(const LHASH *lh, BIO *out) | |||
258 | total+=num; | 272 | total+=num; |
259 | } | 273 | } |
260 | } | 274 | } |
261 | sprintf(buf,"%lu nodes used out of %u\n",n_used,lh->num_nodes); | 275 | snprintf(buf,sizeof buf,"%lu nodes used out of %u\n",n_used, |
276 | lh->num_nodes); | ||
262 | BIO_puts(out,buf); | 277 | BIO_puts(out,buf); |
263 | sprintf(buf,"%lu items\n",total); | 278 | snprintf(buf,sizeof buf,"%lu items\n",total); |
264 | BIO_puts(out,buf); | 279 | BIO_puts(out,buf); |
265 | if (n_used == 0) return; | 280 | if (n_used == 0) return; |
266 | sprintf(buf,"load %d.%02d actual load %d.%02d\n", | 281 | snprintf(buf,sizeof buf,"load %d.%02d actual load %d.%02d\n", |
267 | (int)(total/lh->num_nodes), | 282 | (int)(total/lh->num_nodes), |
268 | (int)((total%lh->num_nodes)*100/lh->num_nodes), | 283 | (int)((total%lh->num_nodes)*100/lh->num_nodes), |
269 | (int)(total/n_used), | 284 | (int)(total/n_used), |