#include <stdio.h>
Go to the source code of this file.
#define inc_tally_bucket | ( | t, | |||
i | ) |
Value:
(t->count++, \ ((i < t->num_buckets) ? \ (t->buckets[i]++) : \ (t->buckets[t->num_buckets-1]++)))
Definition at line 53 of file tally.h.
Referenced by record_certainty(), and record_search_status().
#define iterate_tally | ( | t, | |||
i | ) | for (i=0; i<t->num_buckets; i++) |
Iterate through all the buckets in a tally record.
Definition at line 63 of file tally.h.
Referenced by new_tally(), print_tally(), and save_summary().
#define tally_entry | ( | t, | |||
i | ) | (t->buckets[i]) |
Access one of the buckets of a tally record without bounds checking.
Definition at line 70 of file tally.h.
Referenced by new_tally(), print_tally(), and save_summary().
TALLY new_tally | ( | int | num_buckets | ) |
Create a new tally record and initialize it.
Definition at line 34 of file tally.cpp.
References _TALLY_::count, iterate_tally, memalloc(), _TALLY_::num_buckets, and tally_entry.
Referenced by init_metrics(), and reset_width_tally().
00034 { 00035 TALLY t; 00036 int x; 00037 00038 t = (TALLY) memalloc ((num_buckets + 2) * sizeof (int)); 00039 t->count = 0; 00040 t->num_buckets = num_buckets; 00041 00042 iterate_tally (t, x) tally_entry (t, x) = 0; 00043 00044 return (t); 00045 }
void print_tally | ( | FILE * | file, | |
const char * | string, | |||
TALLY | t | |||
) |
Print the results of a given tally.
Definition at line 52 of file tally.cpp.
References _TALLY_::count, cprintf(), iterate_tally, _TALLY_::num_buckets, and tally_entry.
Referenced by save_summary().
00052 { 00053 int x; 00054 00055 cprintf ("%d %s buckets\n", t->num_buckets, string); 00056 cprintf ("%d samples in %s\n", t->count, string); 00057 00058 iterate_tally (t, x) 00059 cprintf (" %s [%d] = %d\n", string, x, tally_entry (t, x)); 00060 cprintf ("\n"); 00061 }