OLD | NEW |
1 /* crypto/lhash/lh_stats.c */ | 1 /* crypto/lhash/lh_stats.c */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 fprintf(out,"load %d.%02d actual load %d.%02d\n", | 132 fprintf(out,"load %d.%02d actual load %d.%02d\n", |
133 (int)(total/lh->num_nodes), | 133 (int)(total/lh->num_nodes), |
134 (int)((total%lh->num_nodes)*100/lh->num_nodes), | 134 (int)((total%lh->num_nodes)*100/lh->num_nodes), |
135 (int)(total/n_used), | 135 (int)(total/n_used), |
136 (int)((total%n_used)*100/n_used)); | 136 (int)((total%n_used)*100/n_used)); |
137 } | 137 } |
138 | 138 |
139 #else | 139 #else |
140 | 140 |
141 #ifndef OPENSSL_NO_FP_API | 141 #ifndef OPENSSL_NO_FP_API |
142 void lh_stats(const LHASH *lh, FILE *fp) | 142 void lh_stats(const _LHASH *lh, FILE *fp) |
143 { | 143 { |
144 BIO *bp; | 144 BIO *bp; |
145 | 145 |
146 bp=BIO_new(BIO_s_file()); | 146 bp=BIO_new(BIO_s_file()); |
147 if (bp == NULL) goto end; | 147 if (bp == NULL) goto end; |
148 BIO_set_fp(bp,fp,BIO_NOCLOSE); | 148 BIO_set_fp(bp,fp,BIO_NOCLOSE); |
149 lh_stats_bio(lh,bp); | 149 lh_stats_bio(lh,bp); |
150 BIO_free(bp); | 150 BIO_free(bp); |
151 end:; | 151 end:; |
152 } | 152 } |
153 | 153 |
154 void lh_node_stats(const LHASH *lh, FILE *fp) | 154 void lh_node_stats(const _LHASH *lh, FILE *fp) |
155 { | 155 { |
156 BIO *bp; | 156 BIO *bp; |
157 | 157 |
158 bp=BIO_new(BIO_s_file()); | 158 bp=BIO_new(BIO_s_file()); |
159 if (bp == NULL) goto end; | 159 if (bp == NULL) goto end; |
160 BIO_set_fp(bp,fp,BIO_NOCLOSE); | 160 BIO_set_fp(bp,fp,BIO_NOCLOSE); |
161 lh_node_stats_bio(lh,bp); | 161 lh_node_stats_bio(lh,bp); |
162 BIO_free(bp); | 162 BIO_free(bp); |
163 end:; | 163 end:; |
164 } | 164 } |
165 | 165 |
166 void lh_node_usage_stats(const LHASH *lh, FILE *fp) | 166 void lh_node_usage_stats(const _LHASH *lh, FILE *fp) |
167 { | 167 { |
168 BIO *bp; | 168 BIO *bp; |
169 | 169 |
170 bp=BIO_new(BIO_s_file()); | 170 bp=BIO_new(BIO_s_file()); |
171 if (bp == NULL) goto end; | 171 if (bp == NULL) goto end; |
172 BIO_set_fp(bp,fp,BIO_NOCLOSE); | 172 BIO_set_fp(bp,fp,BIO_NOCLOSE); |
173 lh_node_usage_stats_bio(lh,bp); | 173 lh_node_usage_stats_bio(lh,bp); |
174 BIO_free(bp); | 174 BIO_free(bp); |
175 end:; | 175 end:; |
176 } | 176 } |
177 | 177 |
178 #endif | 178 #endif |
179 | 179 |
180 void lh_stats_bio(const LHASH *lh, BIO *out) | 180 void lh_stats_bio(const _LHASH *lh, BIO *out) |
181 { | 181 { |
182 BIO_printf(out,"num_items = %lu\n",lh->num_items); | 182 BIO_printf(out,"num_items = %lu\n",lh->num_items); |
183 BIO_printf(out,"num_nodes = %u\n",lh->num_nodes); | 183 BIO_printf(out,"num_nodes = %u\n",lh->num_nodes); |
184 BIO_printf(out,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); | 184 BIO_printf(out,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); |
185 BIO_printf(out,"num_expands = %lu\n",lh->num_expands); | 185 BIO_printf(out,"num_expands = %lu\n",lh->num_expands); |
186 BIO_printf(out,"num_expand_reallocs = %lu\n", | 186 BIO_printf(out,"num_expand_reallocs = %lu\n", |
187 lh->num_expand_reallocs); | 187 lh->num_expand_reallocs); |
188 BIO_printf(out,"num_contracts = %lu\n",lh->num_contracts); | 188 BIO_printf(out,"num_contracts = %lu\n",lh->num_contracts); |
189 BIO_printf(out,"num_contract_reallocs = %lu\n", | 189 BIO_printf(out,"num_contract_reallocs = %lu\n", |
190 lh->num_contract_reallocs); | 190 lh->num_contract_reallocs); |
191 BIO_printf(out,"num_hash_calls = %lu\n",lh->num_hash_calls); | 191 BIO_printf(out,"num_hash_calls = %lu\n",lh->num_hash_calls); |
192 BIO_printf(out,"num_comp_calls = %lu\n",lh->num_comp_calls); | 192 BIO_printf(out,"num_comp_calls = %lu\n",lh->num_comp_calls); |
193 BIO_printf(out,"num_insert = %lu\n",lh->num_insert); | 193 BIO_printf(out,"num_insert = %lu\n",lh->num_insert); |
194 BIO_printf(out,"num_replace = %lu\n",lh->num_replace); | 194 BIO_printf(out,"num_replace = %lu\n",lh->num_replace); |
195 BIO_printf(out,"num_delete = %lu\n",lh->num_delete); | 195 BIO_printf(out,"num_delete = %lu\n",lh->num_delete); |
196 BIO_printf(out,"num_no_delete = %lu\n",lh->num_no_delete); | 196 BIO_printf(out,"num_no_delete = %lu\n",lh->num_no_delete); |
197 BIO_printf(out,"num_retrieve = %lu\n",lh->num_retrieve); | 197 BIO_printf(out,"num_retrieve = %lu\n",lh->num_retrieve); |
198 BIO_printf(out,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); | 198 BIO_printf(out,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); |
199 BIO_printf(out,"num_hash_comps = %lu\n",lh->num_hash_comps); | 199 BIO_printf(out,"num_hash_comps = %lu\n",lh->num_hash_comps); |
200 #if 0 | 200 #if 0 |
201 BIO_printf(out,"p = %u\n",lh->p); | 201 BIO_printf(out,"p = %u\n",lh->p); |
202 BIO_printf(out,"pmax = %u\n",lh->pmax); | 202 BIO_printf(out,"pmax = %u\n",lh->pmax); |
203 BIO_printf(out,"up_load = %lu\n",lh->up_load); | 203 BIO_printf(out,"up_load = %lu\n",lh->up_load); |
204 BIO_printf(out,"down_load = %lu\n",lh->down_load); | 204 BIO_printf(out,"down_load = %lu\n",lh->down_load); |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
208 void lh_node_stats_bio(const LHASH *lh, BIO *out) | 208 void lh_node_stats_bio(const _LHASH *lh, BIO *out) |
209 { | 209 { |
210 LHASH_NODE *n; | 210 LHASH_NODE *n; |
211 unsigned int i,num; | 211 unsigned int i,num; |
212 | 212 |
213 for (i=0; i<lh->num_nodes; i++) | 213 for (i=0; i<lh->num_nodes; i++) |
214 { | 214 { |
215 for (n=lh->b[i],num=0; n != NULL; n=n->next) | 215 for (n=lh->b[i],num=0; n != NULL; n=n->next) |
216 num++; | 216 num++; |
217 BIO_printf(out,"node %6u -> %3u\n",i,num); | 217 BIO_printf(out,"node %6u -> %3u\n",i,num); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 void lh_node_usage_stats_bio(const LHASH *lh, BIO *out) | 221 void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out) |
222 { | 222 { |
223 LHASH_NODE *n; | 223 LHASH_NODE *n; |
224 unsigned long num; | 224 unsigned long num; |
225 unsigned int i; | 225 unsigned int i; |
226 unsigned long total=0,n_used=0; | 226 unsigned long total=0,n_used=0; |
227 | 227 |
228 for (i=0; i<lh->num_nodes; i++) | 228 for (i=0; i<lh->num_nodes; i++) |
229 { | 229 { |
230 for (n=lh->b[i],num=0; n != NULL; n=n->next) | 230 for (n=lh->b[i],num=0; n != NULL; n=n->next) |
231 num++; | 231 num++; |
232 if (num != 0) | 232 if (num != 0) |
233 { | 233 { |
234 n_used++; | 234 n_used++; |
235 total+=num; | 235 total+=num; |
236 } | 236 } |
237 } | 237 } |
238 BIO_printf(out,"%lu nodes used out of %u\n",n_used,lh->num_nodes); | 238 BIO_printf(out,"%lu nodes used out of %u\n",n_used,lh->num_nodes); |
239 BIO_printf(out,"%lu items\n",total); | 239 BIO_printf(out,"%lu items\n",total); |
240 if (n_used == 0) return; | 240 if (n_used == 0) return; |
241 BIO_printf(out,"load %d.%02d actual load %d.%02d\n", | 241 BIO_printf(out,"load %d.%02d actual load %d.%02d\n", |
242 (int)(total/lh->num_nodes), | 242 (int)(total/lh->num_nodes), |
243 (int)((total%lh->num_nodes)*100/lh->num_nodes), | 243 (int)((total%lh->num_nodes)*100/lh->num_nodes), |
244 (int)(total/n_used), | 244 (int)(total/n_used), |
245 (int)((total%n_used)*100/n_used)); | 245 (int)((total%n_used)*100/n_used)); |
246 } | 246 } |
247 | 247 |
248 #endif | 248 #endif |
OLD | NEW |