#include "tally.h"
#include "freelist.h"
#include "callcpp.h"
Go to the source code of this file.
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 }