X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Flhash%2Flh_stats.c;h=815615e338d95b8aaa1582fa9b7e80ca57ec5bf0;hb=94782e0e9c28bd872107b8f814f4db68c9fbf5ab;hp=23fe82f7778e76d71cbd2887890558840a186ca5;hpb=7dfb0b774e6592dcbfe47015168a0ac8b44e2a17;p=oweals%2Fopenssl.git diff --git a/crypto/lhash/lh_stats.c b/crypto/lhash/lh_stats.c index 23fe82f777..815615e338 100644 --- a/crypto/lhash/lh_stats.c +++ b/crypto/lhash/lh_stats.c @@ -63,13 +63,14 @@ * and things should work as expected */ #include "cryptlib.h" -#include "lhash.h" +#ifndef OPENSSL_NO_BIO +#include +#endif +#include -#ifndef HEADER_BIO_H +#ifdef OPENSSL_NO_BIO -void lh_stats(lh, out) -LHASH *lh; -FILE *out; +void lh_stats(LHASH *lh, FILE *out) { fprintf(out,"num_items = %lu\n",lh->num_items); fprintf(out,"num_nodes = %u\n",lh->num_nodes); @@ -87,7 +88,7 @@ FILE *out; fprintf(out,"num_retrieve = %lu\n",lh->num_retrieve); fprintf(out,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); fprintf(out,"num_hash_comps = %lu\n",lh->num_hash_comps); -#ifdef DEBUG +#if 0 fprintf(out,"p = %u\n",lh->p); fprintf(out,"pmax = %u\n",lh->pmax); fprintf(out,"up_load = %lu\n",lh->up_load); @@ -95,9 +96,7 @@ FILE *out; #endif } -void lh_node_stats(lh, out) -LHASH *lh; -FILE *out; +void lh_node_stats(LHASH *lh, FILE *out) { LHASH_NODE *n; unsigned int i,num; @@ -110,9 +109,7 @@ FILE *out; } } -void lh_node_usage_stats(lh, out) -LHASH *lh; -FILE *out; +void lh_node_usage_stats(LHASH *lh, FILE *out) { LHASH_NODE *n; unsigned long num; @@ -141,10 +138,8 @@ FILE *out; #else -#ifndef NO_FP_API -void lh_stats(lh,fp) -LHASH *lh; -FILE *fp; +#ifndef OPENSSL_NO_FP_API +void lh_stats(const _LHASH *lh, FILE *fp) { BIO *bp; @@ -156,9 +151,7 @@ FILE *fp; end:; } -void lh_node_stats(lh,fp) -LHASH *lh; -FILE *fp; +void lh_node_stats(const _LHASH *lh, FILE *fp) { BIO *bp; @@ -170,9 +163,7 @@ FILE *fp; end:; } -void lh_node_usage_stats(lh,fp) -LHASH *lh; -FILE *fp; +void lh_node_usage_stats(const _LHASH *lh, FILE *fp) { BIO *bp; @@ -186,82 +177,53 @@ end:; #endif -void lh_stats_bio(lh, out) -LHASH *lh; -BIO *out; +void lh_stats_bio(const _LHASH *lh, BIO *out) { - char buf[128]; - - sprintf(buf,"num_items = %lu\n",lh->num_items); - BIO_puts(out,buf); - sprintf(buf,"num_nodes = %u\n",lh->num_nodes); - BIO_puts(out,buf); - sprintf(buf,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); - BIO_puts(out,buf); - sprintf(buf,"num_expands = %lu\n",lh->num_expands); - BIO_puts(out,buf); - sprintf(buf,"num_expand_reallocs = %lu\n",lh->num_expand_reallocs); - BIO_puts(out,buf); - sprintf(buf,"num_contracts = %lu\n",lh->num_contracts); - BIO_puts(out,buf); - sprintf(buf,"num_contract_reallocs = %lu\n",lh->num_contract_reallocs); - BIO_puts(out,buf); - sprintf(buf,"num_hash_calls = %lu\n",lh->num_hash_calls); - BIO_puts(out,buf); - sprintf(buf,"num_comp_calls = %lu\n",lh->num_comp_calls); - BIO_puts(out,buf); - sprintf(buf,"num_insert = %lu\n",lh->num_insert); - BIO_puts(out,buf); - sprintf(buf,"num_replace = %lu\n",lh->num_replace); - BIO_puts(out,buf); - sprintf(buf,"num_delete = %lu\n",lh->num_delete); - BIO_puts(out,buf); - sprintf(buf,"num_no_delete = %lu\n",lh->num_no_delete); - BIO_puts(out,buf); - sprintf(buf,"num_retrieve = %lu\n",lh->num_retrieve); - BIO_puts(out,buf); - sprintf(buf,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); - BIO_puts(out,buf); - sprintf(buf,"num_hash_comps = %lu\n",lh->num_hash_comps); - BIO_puts(out,buf); -#ifdef DEBUG - sprintf(buf,"p = %u\n",lh->p); - BIO_puts(out,buf); - sprintf(buf,"pmax = %u\n",lh->pmax); - BIO_puts(out,buf); - sprintf(buf,"up_load = %lu\n",lh->up_load); - BIO_puts(out,buf); - sprintf(buf,"down_load = %lu\n",lh->down_load); - BIO_puts(out,buf); + BIO_printf(out,"num_items = %lu\n",lh->num_items); + BIO_printf(out,"num_nodes = %u\n",lh->num_nodes); + BIO_printf(out,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); + BIO_printf(out,"num_expands = %lu\n",lh->num_expands); + BIO_printf(out,"num_expand_reallocs = %lu\n", + lh->num_expand_reallocs); + BIO_printf(out,"num_contracts = %lu\n",lh->num_contracts); + BIO_printf(out,"num_contract_reallocs = %lu\n", + lh->num_contract_reallocs); + BIO_printf(out,"num_hash_calls = %lu\n",lh->num_hash_calls); + BIO_printf(out,"num_comp_calls = %lu\n",lh->num_comp_calls); + BIO_printf(out,"num_insert = %lu\n",lh->num_insert); + BIO_printf(out,"num_replace = %lu\n",lh->num_replace); + BIO_printf(out,"num_delete = %lu\n",lh->num_delete); + BIO_printf(out,"num_no_delete = %lu\n",lh->num_no_delete); + BIO_printf(out,"num_retrieve = %lu\n",lh->num_retrieve); + BIO_printf(out,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); + BIO_printf(out,"num_hash_comps = %lu\n",lh->num_hash_comps); +#if 0 + BIO_printf(out,"p = %u\n",lh->p); + BIO_printf(out,"pmax = %u\n",lh->pmax); + BIO_printf(out,"up_load = %lu\n",lh->up_load); + BIO_printf(out,"down_load = %lu\n",lh->down_load); #endif } -void lh_node_stats_bio(lh, out) -LHASH *lh; -BIO *out; +void lh_node_stats_bio(const _LHASH *lh, BIO *out) { LHASH_NODE *n; unsigned int i,num; - char buf[128]; for (i=0; inum_nodes; i++) { for (n=lh->b[i],num=0; n != NULL; n=n->next) num++; - sprintf(buf,"node %6u -> %3u\n",i,num); - BIO_puts(out,buf); + BIO_printf(out,"node %6u -> %3u\n",i,num); } } -void lh_node_usage_stats_bio(lh, out) -LHASH *lh; -BIO *out; +void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out) { LHASH_NODE *n; unsigned long num; unsigned int i; unsigned long total=0,n_used=0; - char buf[128]; for (i=0; inum_nodes; i++) { @@ -273,17 +235,14 @@ BIO *out; total+=num; } } - sprintf(buf,"%lu nodes used out of %u\n",n_used,lh->num_nodes); - BIO_puts(out,buf); - sprintf(buf,"%lu items\n",total); - BIO_puts(out,buf); + BIO_printf(out,"%lu nodes used out of %u\n",n_used,lh->num_nodes); + BIO_printf(out,"%lu items\n",total); if (n_used == 0) return; - sprintf(buf,"load %d.%02d actual load %d.%02d\n", - (int)(total/lh->num_nodes), - (int)((total%lh->num_nodes)*100/lh->num_nodes), - (int)(total/n_used), - (int)((total%n_used)*100/n_used)); - BIO_puts(out,buf); + BIO_printf(out,"load %d.%02d actual load %d.%02d\n", + (int)(total/lh->num_nodes), + (int)((total%lh->num_nodes)*100/lh->num_nodes), + (int)(total/n_used), + (int)((total%n_used)*100/n_used)); } #endif