void brhist_disp(const lame_global_flags * gf) { int i, lines_used = 0; int br_hist[BRHIST_WIDTH]; /* how often a frame size was used */ int br_sm_hist[BRHIST_WIDTH][4]; /* how often a special frame size/stereo mode commbination was used */ int st_mode[4]; int bl_type[6]; int frames; /* total number of encoded frames */ int most_often; /* usage count of the most often used frame size, but not smaller than Console_IO.disp_width-BRHIST_RES (makes this sense?) and 1 */ double sum = 0.; double stat[9] = { 0 }; int st_frames = 0; brhist.hist_printed_lines = 0; /* printed number of lines for the brhist functionality, used to skip back the right number of lines */ lame_bitrate_stereo_mode_hist(gf, br_sm_hist); lame_bitrate_hist(gf, br_hist); lame_stereo_mode_hist(gf, st_mode); lame_block_type_hist(gf, bl_type); frames = most_often = 0; for (i = 0; i < BRHIST_WIDTH; i++) { frames += br_hist[i]; sum += br_hist[i] * brhist.kbps[i]; if (most_often < br_hist[i]) most_often = br_hist[i]; if (br_hist[i]) ++lines_used; } for (i = 0; i < BRHIST_WIDTH; i++) { int show = br_hist[i]; show = show && (lines_used > 1); if (show || (i >= brhist.vbr_bitrate_min_index && i <= brhist.vbr_bitrate_max_index)) brhist_disp_line(i, br_hist[i], br_sm_hist[i][LR], most_often, frames); } for (i = 0; i < 4; i++) { st_frames += st_mode[i]; } if (frames > 0) { stat[0] = sum / frames; stat[1] = 100. * (frames - st_frames) / frames; } if (st_frames > 0) { stat[2] = 0.0; stat[3] = 100. * st_mode[LR] / st_frames; stat[4] = 100. * st_mode[MS] / st_frames; } if (bl_type[5] > 0) { stat[5] = 100. * bl_type[0] / bl_type[5]; stat[6] = 100. * (bl_type[1] + bl_type[3]) / bl_type[5]; stat[7] = 100. * bl_type[2] / bl_type[5]; stat[8] = 100. * bl_type[4] / bl_type[5]; } progress_line(gf, lame_get_totalframes(gf), frames); stats_line(stat); }
void dump_stats(Collection& coll, std::string const& type, uint64_t postings) { uint64_t docs_size = 0, freqs_size = 0; get_size_stats(coll, docs_size, freqs_size); double bits_per_doc = docs_size * 8.0 / postings; double bits_per_freq = freqs_size * 8.0 / postings; logger() << "Documents: " << docs_size << " bytes, " << bits_per_doc << " bits per element" << std::endl; logger() << "Frequencies: " << freqs_size << " bytes, " << bits_per_freq << " bits per element" << std::endl; stats_line() ("type", type) ("size", docs_size + freqs_size) ("docs_size", docs_size) ("freqs_size", freqs_size) ("bits_per_doc", bits_per_doc) ("bits_per_freq", bits_per_freq) ; }