/[bison]/bison/lib/bitset_stats.c
ViewVC logotype

Diff of /bison/lib/bitset_stats.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by eggert, Thu Oct 10 07:23:15 2002 UTC revision 1.6 by eggert, Wed Oct 16 06:20:44 2002 UTC
# Line 14  Line 14 
14    
15     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */  */
19    
20  /* This file is a wrapper bitset implementation for the other bitset  /* This file is a wrapper bitset implementation for the other bitset
# Line 22  Line 22 
22     statistics gathering without having to instrument the bitset     statistics gathering without having to instrument the bitset
23     implementations.  When statistics gathering is enabled, the bitset     implementations.  When statistics gathering is enabled, the bitset
24     operations get vectored through here and we then call the appropriate     operations get vectored through here and we then call the appropriate
25     routines.       routines.
26  */  */
27    
28  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
# Line 103  struct bitset_stats_info_struct *bitset_ Line 103  struct bitset_stats_info_struct *bitset_
103  int bitset_stats_enabled = 0;  int bitset_stats_enabled = 0;
104    
105    
 static void bitset_stats_set PARAMS ((bitset, bitset_bindex));  
 static void bitset_stats_reset PARAMS ((bitset, bitset_bindex));  
 static int bitset_stats_toggle PARAMS ((bitset, bitset_bindex));  
 static int bitset_stats_test PARAMS ((bitset, bitset_bindex));  
 static bitset_bindex bitset_stats_size PARAMS ((bitset));  
 static bitset_bindex bitset_stats_count PARAMS ((bitset));  
 static int bitset_stats_empty_p PARAMS ((bitset));  
 static void bitset_stats_ones PARAMS ((bitset));  
 static void bitset_stats_zero PARAMS ((bitset));  
 static void bitset_stats_copy PARAMS ((bitset, bitset));  
 static int bitset_stats_disjoint_p PARAMS ((bitset, bitset));  
 static int bitset_stats_equal_p PARAMS ((bitset, bitset));  
 static void bitset_stats_not PARAMS ((bitset, bitset));  
 static int bitset_stats_subset_p PARAMS ((bitset, bitset));  
 static void bitset_stats_and PARAMS ((bitset, bitset, bitset));  
 static int bitset_stats_and_cmp PARAMS ((bitset, bitset, bitset));  
 static void bitset_stats_andn PARAMS ((bitset, bitset, bitset));  
 static int bitset_stats_andn_cmp PARAMS ((bitset, bitset, bitset));  
 static void bitset_stats_or PARAMS ((bitset, bitset, bitset));  
 static int bitset_stats_or_cmp PARAMS ((bitset, bitset, bitset));  
 static void bitset_stats_xor PARAMS ((bitset, bitset, bitset));  
 static int bitset_stats_xor_cmp PARAMS ((bitset, bitset, bitset));  
 static void bitset_stats_and_or PARAMS ((bitset, bitset, bitset, bitset));  
 static int bitset_stats_and_or_cmp PARAMS ((bitset, bitset, bitset, bitset));  
 static void bitset_stats_andn_or PARAMS ((bitset, bitset, bitset, bitset));  
 static int bitset_stats_andn_or_cmp PARAMS ((bitset, bitset, bitset, bitset));  
 static void bitset_stats_or_and PARAMS ((bitset, bitset, bitset, bitset));  
 static int bitset_stats_or_and_cmp PARAMS ((bitset, bitset, bitset, bitset));  
 static bitset_bindex bitset_stats_list PARAMS ((bitset, bitset_bindex *,  
                                                 bitset_bindex,  
                                                 bitset_bindex *));  
 static bitset_bindex bitset_stats_list_reverse  
 PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *));  
 static void bitset_stats_free PARAMS ((bitset));  
 static void bitset_percent_histogram_print PARAMS ((FILE *, const char *,  
                                                     const char *,  
                                                     unsigned int,  
                                                     unsigned int *));  
 static void bitset_log_histogram_print PARAMS ((FILE *, const char *,  
                                                 const char *,  
                                                 unsigned int,  
                                                 unsigned int *));  
 static void bitset_stats_print_1  
 PARAMS ((FILE *, const char *, struct bitset_type_info_struct *));  
 static void bitset_stats_print PARAMS ((FILE *, int));  
   
   
106  /* Print a percentage histogram with message MSG to FILE.  */  /* Print a percentage histogram with message MSG to FILE.  */
107  static void  static void
108  bitset_percent_histogram_print (file, name, msg, n_bins, bins)  bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
109       FILE *file;                                  unsigned int n_bins, unsigned int *bins)
      const char *name;  
      const char *msg;  
      unsigned int n_bins;  
      unsigned int *bins;  
110  {  {
111    unsigned int i;    unsigned int i;
112    unsigned int total;    unsigned int total;
# Line 180  bitset_percent_histogram_print (file, na Line 129  bitset_percent_histogram_print (file, na
129    
130  /* Print a log histogram with message MSG to FILE.  */  /* Print a log histogram with message MSG to FILE.  */
131  static void  static void
132  bitset_log_histogram_print (file, name, msg, n_bins, bins)  bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
133       FILE *file;                              unsigned int n_bins, unsigned int *bins)
      const char *name;  
      const char *msg;  
      unsigned int n_bins;  
      unsigned int *bins;  
134  {  {
135    unsigned int i;    unsigned int i;
136    unsigned int total;    unsigned int total;
# Line 223  bitset_log_histogram_print (file, name, Line 168  bitset_log_histogram_print (file, name,
168    
169  /* Print bitset statistics to FILE.  */  /* Print bitset statistics to FILE.  */
170  static void  static void
171  bitset_stats_print_1 (file, name, stats)  bitset_stats_print_1 (FILE *file, const char *name,
172       FILE *file;                        struct bitset_type_info_struct *stats)
      const char *name;  
      struct bitset_type_info_struct *stats;  
173  {  {
174    if (!stats)    if (!stats)
175      return;      return;
176      
177    fprintf (file, "%s:\n", name);    fprintf (file, "%s:\n", name);
178    fprintf (file, _("%u bitset_allocs, %u freed (%.2f%%).\n"),    fprintf (file, _("%u bitset_allocs, %u freed (%.2f%%).\n"),
179             stats->allocs, stats->frees,             stats->allocs, stats->frees,
# Line 260  bitset_stats_print_1 (file, name, stats) Line 203  bitset_stats_print_1 (file, name, stats)
203    
204  /* Print all bitset statistics to FILE.  */  /* Print all bitset statistics to FILE.  */
205  static void  static void
206  bitset_stats_print (file, verbose)  bitset_stats_print (FILE *file, int verbose ATTRIBUTE_UNUSED)
      FILE *file;  
      int verbose ATTRIBUTE_UNUSED;  
207  {  {
208    int i;    int i;
209    
# Line 275  bitset_stats_print (file, verbose) Line 216  bitset_stats_print (file, verbose)
216      fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs);      fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs);
217    
218    for (i = 0; i < BITSET_TYPE_NUM; i++)    for (i = 0; i < BITSET_TYPE_NUM; i++)
219      bitset_stats_print_1 (file, bitset_type_names[i],      bitset_stats_print_1 (file, bitset_type_names[i],
220                            &bitset_stats_info->types[i]);                            &bitset_stats_info->types[i]);
221  }  }
222    
223    
224  /* Initialise bitset statistics logging.  */  /* Initialise bitset statistics logging.  */
225  void  void
226  bitset_stats_enable ()  bitset_stats_enable (void)
227  {  {
228    if (!bitset_stats_info)    if (!bitset_stats_info)
229      bitset_stats_info = &bitset_stats_info_data;      bitset_stats_info = &bitset_stats_info_data;
# Line 291  bitset_stats_enable () Line 232  bitset_stats_enable ()
232    
233    
234  void  void
235  bitset_stats_disable ()  bitset_stats_disable (void)
236  {  {
237    bitset_stats_enabled = 0;    bitset_stats_enabled = 0;
238  }  }
# Line 299  bitset_stats_disable () Line 240  bitset_stats_disable ()
240    
241  /* Read bitset statistics file.  */  /* Read bitset statistics file.  */
242  void  void
243  bitset_stats_read (filename)  bitset_stats_read (const char *filename)
      const char *filename;  
244  {  {
245    FILE *file;    FILE *file;
246    
247    if (!bitset_stats_info)    if (!bitset_stats_info)
248      return;      return;
249      
250    if (!filename)    if (!filename)
251      filename = BITSET_STATS_FILE;      filename = BITSET_STATS_FILE;
252    
# Line 329  bitset_stats_read (filename) Line 269  bitset_stats_read (filename)
269    
270  /* Write bitset statistics file.  */  /* Write bitset statistics file.  */
271  void  void
272  bitset_stats_write (filename)  bitset_stats_write (const char *filename)
      const char *filename;  
273  {  {
274    FILE *file;    FILE *file;
275    
# Line 355  bitset_stats_write (filename) Line 294  bitset_stats_write (filename)
294    
295  /* Dump bitset statistics to FILE.  */  /* Dump bitset statistics to FILE.  */
296  void  void
297  bitset_stats_dump (file)  bitset_stats_dump (FILE *file)
      FILE *file;  
298  {  {
299    bitset_stats_print (file, 0);    bitset_stats_print (file, 0);
300  }  }
# Line 371  debug_bitset_stats (void) Line 309  debug_bitset_stats (void)
309    
310    
311  static void  static void
312  bitset_stats_set (dst, bitno)  bitset_stats_set (bitset dst, bitset_bindex bitno)
      bitset dst;  
      bitset_bindex bitno;  
313  {  {
314    bitset bset = dst->s.bset;    bitset bset = dst->s.bset;
315    bitset_windex wordno = bitno / BITSET_WORD_BITS;    bitset_windex wordno = bitno / BITSET_WORD_BITS;
316    bitset_windex offset = wordno - bset->b.cindex;    bitset_windex offset = wordno - bset->b.cindex;
317      
318    BITSET_STATS_SETS_INC (bset);    BITSET_STATS_SETS_INC (bset);
319    
320    if (offset < bset->b.csize)    if (offset < bset->b.csize)
# Line 392  bitset_stats_set (dst, bitno) Line 328  bitset_stats_set (dst, bitno)
328    
329    
330  static void  static void
331  bitset_stats_reset (dst, bitno)  bitset_stats_reset (bitset dst, bitset_bindex bitno)
      bitset dst;  
      bitset_bindex bitno;  
332  {  {
333    bitset bset = dst->s.bset;    bitset bset = dst->s.bset;
334    bitset_windex wordno = bitno / BITSET_WORD_BITS;    bitset_windex wordno = bitno / BITSET_WORD_BITS;
335    bitset_windex offset = wordno - bset->b.cindex;    bitset_windex offset = wordno - bset->b.cindex;
336      
337    BITSET_STATS_RESETS_INC (bset);    BITSET_STATS_RESETS_INC (bset);
338    
339    if (offset < bset->b.csize)    if (offset < bset->b.csize)
# Line 414  bitset_stats_reset (dst, bitno) Line 348  bitset_stats_reset (dst, bitno)
348    
349    
350  static int  static int
351  bitset_stats_toggle (src, bitno)  bitset_stats_toggle (bitset src, bitset_bindex bitno)
      bitset src;  
      bitset_bindex bitno;  
352  {  {
353      return BITSET_TOGGLE_ (src->s.bset, bitno);      return BITSET_TOGGLE_ (src->s.bset, bitno);
354  }  }
355    
356    
357  static int  static int
358  bitset_stats_test (src, bitno)  bitset_stats_test (bitset src, bitset_bindex bitno)
      bitset src;  
      bitset_bindex bitno;  
359  {  {
360    bitset bset = src->s.bset;    bitset bset = src->s.bset;
361    bitset_windex wordno = bitno / BITSET_WORD_BITS;    bitset_windex wordno = bitno / BITSET_WORD_BITS;
362    bitset_windex offset = wordno - bset->b.cindex;    bitset_windex offset = wordno - bset->b.cindex;
363    
364    BITSET_STATS_TESTS_INC (bset);    BITSET_STATS_TESTS_INC (bset);
365      
366    if (offset < bset->b.csize)    if (offset < bset->b.csize)
367      {      {
368        BITSET_STATS_CACHE_TESTS_INC (bset);        BITSET_STATS_CACHE_TESTS_INC (bset);
# Line 444  bitset_stats_test (src, bitno) Line 374  bitset_stats_test (src, bitno)
374    
375    
376  static bitset_bindex  static bitset_bindex
377  bitset_stats_size (src)  bitset_stats_size (bitset src)
      bitset src;  
378  {  {
379    return BITSET_SIZE_ (src->s.bset);    return BITSET_SIZE_ (src->s.bset);
380  }  }
381    
382    
383  static bitset_bindex  static bitset_bindex
384  bitset_stats_count (src)  bitset_stats_count (bitset src)
      bitset src;  
385  {  {
386    return BITSET_COUNT_ (src->s.bset);    return BITSET_COUNT_ (src->s.bset);
387  }  }
388    
389    
390  static int  static int
391  bitset_stats_empty_p (dst)  bitset_stats_empty_p (bitset dst)
      bitset dst;  
392  {  {
393    return BITSET_EMPTY_P_ (dst->s.bset);    return BITSET_EMPTY_P_ (dst->s.bset);
394  }  }
395    
396    
397  static void  static void
398  bitset_stats_ones (dst)  bitset_stats_ones (bitset dst)
      bitset dst;  
399  {  {
400    BITSET_ONES_ (dst->s.bset);    BITSET_ONES_ (dst->s.bset);
401  }  }
402    
403    
404  static void  static void
405  bitset_stats_zero (dst)  bitset_stats_zero (bitset dst)
      bitset dst;  
406  {  {
407    BITSET_ZERO_ (dst->s.bset);    BITSET_ZERO_ (dst->s.bset);
408  }  }
409    
410    
411  static void  static void
412  bitset_stats_copy (dst, src)  bitset_stats_copy (bitset dst, bitset src)
      bitset dst;  
      bitset src;  
413  {  {
414    BITSET_CHECK2_ (dst, src);    BITSET_CHECK2_ (dst, src);
415    BITSET_COPY_ (dst->s.bset, src->s.bset);    BITSET_COPY_ (dst->s.bset, src->s.bset);
# Line 494  bitset_stats_copy (dst, src) Line 417  bitset_stats_copy (dst, src)
417    
418    
419  static int  static int
420  bitset_stats_disjoint_p (dst, src)  bitset_stats_disjoint_p (bitset dst, bitset src)
      bitset dst;  
      bitset src;  
421  {  {
422    BITSET_CHECK2_ (dst, src);    BITSET_CHECK2_ (dst, src);
423    return BITSET_DISJOINT_P_ (dst->s.bset, src->s.bset);    return BITSET_DISJOINT_P_ (dst->s.bset, src->s.bset);
# Line 504  bitset_stats_disjoint_p (dst, src) Line 425  bitset_stats_disjoint_p (dst, src)
425    
426    
427  static int  static int
428  bitset_stats_equal_p (dst, src)  bitset_stats_equal_p (bitset dst, bitset src)
      bitset dst;  
      bitset src;  
429  {  {
430    BITSET_CHECK2_ (dst, src);    BITSET_CHECK2_ (dst, src);
431    return BITSET_EQUAL_P_ (dst->s.bset, src->s.bset);    return BITSET_EQUAL_P_ (dst->s.bset, src->s.bset);
# Line 514  bitset_stats_equal_p (dst, src) Line 433  bitset_stats_equal_p (dst, src)
433    
434    
435  static void  static void
436  bitset_stats_not (dst, src)  bitset_stats_not (bitset dst, bitset src)
      bitset dst;  
      bitset src;  
437  {  {
438    BITSET_CHECK2_ (dst, src);    BITSET_CHECK2_ (dst, src);
439    BITSET_NOT_ (dst->s.bset, src->s.bset);    BITSET_NOT_ (dst->s.bset, src->s.bset);
# Line 524  bitset_stats_not (dst, src) Line 441  bitset_stats_not (dst, src)
441    
442    
443  static int  static int
444  bitset_stats_subset_p (dst, src)  bitset_stats_subset_p (bitset dst, bitset src)
      bitset dst;  
      bitset src;  
445  {  {
446    BITSET_CHECK2_ (dst, src);    BITSET_CHECK2_ (dst, src);
447    return BITSET_SUBSET_P_ (dst->s.bset, src->s.bset);    return BITSET_SUBSET_P_ (dst->s.bset, src->s.bset);
# Line 534  bitset_stats_subset_p (dst, src) Line 449  bitset_stats_subset_p (dst, src)
449    
450    
451  static void  static void
452  bitset_stats_and (dst, src1, src2)  bitset_stats_and (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
453  {  {
454    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
455    BITSET_AND_ (dst->s.bset, src1->s.bset, src2->s.bset);    BITSET_AND_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 545  bitset_stats_and (dst, src1, src2) Line 457  bitset_stats_and (dst, src1, src2)
457    
458    
459  static int  static int
460  bitset_stats_and_cmp (dst, src1, src2)  bitset_stats_and_cmp (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
461  {  {
462    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
463    return BITSET_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);    return BITSET_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 556  bitset_stats_and_cmp (dst, src1, src2) Line 465  bitset_stats_and_cmp (dst, src1, src2)
465    
466    
467  static void  static void
468  bitset_stats_andn (dst, src1, src2)  bitset_stats_andn (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
469  {  {
470    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
471    BITSET_ANDN_ (dst->s.bset, src1->s.bset, src2->s.bset);    BITSET_ANDN_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 567  bitset_stats_andn (dst, src1, src2) Line 473  bitset_stats_andn (dst, src1, src2)
473    
474    
475  static int  static int
476  bitset_stats_andn_cmp (dst, src1, src2)  bitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
477  {  {
478    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
479    return BITSET_ANDN_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);    return BITSET_ANDN_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 578  bitset_stats_andn_cmp (dst, src1, src2) Line 481  bitset_stats_andn_cmp (dst, src1, src2)
481    
482    
483  static void  static void
484  bitset_stats_or (dst, src1, src2)  bitset_stats_or (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
485  {  {
486    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
487    BITSET_OR_ (dst->s.bset, src1->s.bset, src2->s.bset);    BITSET_OR_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 589  bitset_stats_or (dst, src1, src2) Line 489  bitset_stats_or (dst, src1, src2)
489    
490    
491  static int  static int
492  bitset_stats_or_cmp (dst, src1, src2)  bitset_stats_or_cmp (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
493  {  {
494    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
495    return BITSET_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);    return BITSET_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 600  bitset_stats_or_cmp (dst, src1, src2) Line 497  bitset_stats_or_cmp (dst, src1, src2)
497    
498    
499  static void  static void
500  bitset_stats_xor (dst, src1, src2)  bitset_stats_xor (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
501  {  {
502    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
503    BITSET_XOR_ (dst->s.bset, src1->s.bset, src2->s.bset);    BITSET_XOR_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 611  bitset_stats_xor (dst, src1, src2) Line 505  bitset_stats_xor (dst, src1, src2)
505    
506    
507  static int  static int
508  bitset_stats_xor_cmp (dst, src1, src2)  bitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2)
      bitset dst;  
      bitset src1;  
      bitset src2;  
509  {  {
510    BITSET_CHECK3_ (dst, src1, src2);    BITSET_CHECK3_ (dst, src1, src2);
511    return BITSET_XOR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);    return BITSET_XOR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset);
# Line 622  bitset_stats_xor_cmp (dst, src1, src2) Line 513  bitset_stats_xor_cmp (dst, src1, src2)
513    
514    
515  static void  static void
516  bitset_stats_and_or (dst, src1, src2, src3)  bitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
      bitset dst;  
      bitset src1;  
      bitset src2;  
      bitset src3;  
517  {  {
518    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
519    
# Line 635  bitset_stats_and_or (dst, src1, src2, sr Line 522  bitset_stats_and_or (dst, src1, src2, sr
522    
523    
524  static int  static int
525  bitset_stats_and_or_cmp (dst, src1, src2, src3)  bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
      bitset dst;  
      bitset src1;  
      bitset src2;  
      bitset src3;  
526  {  {
527    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
528    
# Line 648  bitset_stats_and_or_cmp (dst, src1, src2 Line 531  bitset_stats_and_or_cmp (dst, src1, src2
531    
532    
533  static void  static void
534  bitset_stats_andn_or (dst, src1, src2, src3)  bitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
      bitset dst;  
      bitset src1;  
      bitset src2;  
      bitset src3;  
535  {  {
536    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
537    
# Line 661  bitset_stats_andn_or (dst, src1, src2, s Line 540  bitset_stats_andn_or (dst, src1, src2, s
540    
541    
542  static int  static int
543  bitset_stats_andn_or_cmp (dst, src1, src2, src3)  bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
      bitset dst;  
      bitset src1;  
      bitset src2;  
      bitset src3;  
544  {  {
545    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
546    
# Line 674  bitset_stats_andn_or_cmp (dst, src1, src Line 549  bitset_stats_andn_or_cmp (dst, src1, src
549    
550    
551  static void  static void
552  bitset_stats_or_and (dst, src1, src2, src3)  bitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
      bitset dst;  
      bitset src1;  
      bitset src2;  
      bitset src3;  
553  {  {
554    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
555    
# Line 687  bitset_stats_or_and (dst, src1, src2, sr Line 558  bitset_stats_or_and (dst, src1, src2, sr
558    
559    
560  static int  static int
561  bitset_stats_or_and_cmp (dst, src1, src2, src3)  bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
      bitset dst;  
      bitset src1;  
      bitset src2;  
      bitset src3;  
562  {  {
563    BITSET_CHECK4_ (dst, src1, src2, src3);    BITSET_CHECK4_ (dst, src1, src2, src3);
564    
# Line 700  bitset_stats_or_and_cmp (dst, src1, src2 Line 567  bitset_stats_or_and_cmp (dst, src1, src2
567    
568    
569  static bitset_bindex  static bitset_bindex
570  bitset_stats_list (bset, list, num, next)  bitset_stats_list (bitset bset, bitset_bindex *list,
571       bitset bset;                     bitset_bindex num, bitset_bindex *next)
      bitset_bindex *list;  
      bitset_bindex num;  
      bitset_bindex *next;  
572  {  {
573    bitset_bindex count;    bitset_bindex count;
574    bitset_bindex tmp;    bitset_bindex tmp;
# Line 713  bitset_stats_list (bset, list, num, next Line 577  bitset_stats_list (bset, list, num, next
577    enum bitset_type type;    enum bitset_type type;
578    
579    count = BITSET_LIST_ (bset->s.bset, list, num, next);    count = BITSET_LIST_ (bset->s.bset, list, num, next);
580      
581    type = BITSET_TYPE_ (bset->s.bset);    type = BITSET_TYPE_ (bset->s.bset);
582    BITSET_STATS_LISTS_INC (bset->s.bset);    BITSET_STATS_LISTS_INC (bset->s.bset);
583      
584    /* Log histogram of number of set bits.  */    /* Log histogram of number of set bits.  */
585    for (i = 0, tmp = count; tmp; tmp >>= 1, i++)    for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
586       continue;       continue;
587    if (i >= BITSET_LOG_COUNT_BINS)    if (i >= BITSET_LOG_COUNT_BINS)
588       i = BITSET_LOG_COUNT_BINS - 1;       i = BITSET_LOG_COUNT_BINS - 1;
589    BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i);    BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i);
590      
591    /* Log histogram of number of bits in set.  */    /* Log histogram of number of bits in set.  */
592    size = BITSET_SIZE_ (bset->s.bset);    size = BITSET_SIZE_ (bset->s.bset);
593    for (i = 0, tmp = size; tmp; tmp >>= 1, i++)    for (i = 0, tmp = size; tmp; tmp >>= 1, i++)
# Line 731  bitset_stats_list (bset, list, num, next Line 595  bitset_stats_list (bset, list, num, next
595    if (i >= BITSET_LOG_SIZE_BINS)    if (i >= BITSET_LOG_SIZE_BINS)
596       i = BITSET_LOG_SIZE_BINS - 1;       i = BITSET_LOG_SIZE_BINS - 1;
597    BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i);    BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i);
598      
599    /* Histogram of fraction of bits set.  */    /* Histogram of fraction of bits set.  */
600    i = size ? (count * BITSET_DENSITY_BINS) / size : 0;    i = size ? (count * BITSET_DENSITY_BINS) / size : 0;
601    if (i >= BITSET_DENSITY_BINS)    if (i >= BITSET_DENSITY_BINS)
# Line 742  bitset_stats_list (bset, list, num, next Line 606  bitset_stats_list (bset, list, num, next
606    
607    
608  static bitset_bindex  static bitset_bindex
609  bitset_stats_list_reverse (bset, list, num, next)  bitset_stats_list_reverse (bitset bset, bitset_bindex *list,
610       bitset bset;                             bitset_bindex num, bitset_bindex *next)
      bitset_bindex *list;  
      bitset_bindex num;  
      bitset_bindex *next;  
611  {  {
612    return BITSET_LIST_REVERSE_ (bset->s.bset, list, num, next);    return BITSET_LIST_REVERSE_ (bset->s.bset, list, num, next);
613  }  }
614    
615    
616  static void  static void
617  bitset_stats_free (bset)  bitset_stats_free (bitset bset)
      bitset bset;  
618  {  {
619    BITSET_STATS_FREES_INC (bset->s.bset);    BITSET_STATS_FREES_INC (bset->s.bset);
620    BITSET_FREE_ (bset->s.bset);    BITSET_FREE_ (bset->s.bset);
# Line 799  struct bitset_vtable bitset_stats_vtable Line 659  struct bitset_vtable bitset_stats_vtable
659    
660  /* Return enclosed bitset type.  */  /* Return enclosed bitset type.  */
661  enum bitset_type  enum bitset_type
662  bitset_stats_type_get (bset)  bitset_stats_type_get (bitset bset)
    bitset bset;  
663  {  {
664     return BITSET_TYPE_ (bset->s.bset);     return BITSET_TYPE_ (bset->s.bset);
665  }  }
# Line 814  bitset_stats_bytes (void) Line 673  bitset_stats_bytes (void)
673    
674    
675  bitset  bitset
676  bitset_stats_init (bset, n_bits, type)  bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
      bitset bset;  
      bitset_bindex n_bits;  
      enum_bitset_type type;  
677  {  {
678    size_t bytes;    size_t bytes;
679    bitset sbset;    bitset sbset;
# Line 858  bitset_stats_init (bset, n_bits, type) Line 714  bitset_stats_init (bset, n_bits, type)
714    bset->s.bset = sbset;    bset->s.bset = sbset;
715    
716    BITSET_STATS_ALLOCS_INC (type);    BITSET_STATS_ALLOCS_INC (type);
717      
718    return bset;    return bset;
719  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26