/** * Prints out a table showing what the following attributes were like * at regular intervals (as determined by num_stats) while the * hashtable was being built. * * @li Percent At Home - how many keys were placed without a collision * occurring. * @li Average Collisions - how many collisions have occurred on * average while placing all of the keys so far. * @li Maximum Collisions - the most collisions that have occurred * while placing a key. * * @param h the hashtable to print statistics summary from. * @param stream the stream to send output to. * @param num_stats the maximum number of statistical snapshots to print. */ void htable_print_stats(htable h, FILE *stream, int num_stats) { int i; fprintf(stream, "\n%s\n\n", h->method == LINEAR_P ? "Linear Probing" : "Double Hashing"); fprintf(stream, "Percent Current Percent Average Maximum\n"); fprintf(stream, " Full Entries At Home Collisions Collisions\n"); fprintf(stream, "-----------------------------------------------------\n"); for (i = 1; i <= num_stats; i++) { print_stats_line(h, stream, 100 * i / num_stats); } fprintf(stream, "-----------------------------------------------------\n\n"); }
void Conic::print_fstats(const ConicMemory* m) const { size_t maxNameLen=0; // Retrieve all qp keys std::vector<std::string> keys; for (auto &&s : m->fstats) { maxNameLen = max(s.first.size(), maxNameLen); keys.push_back(s.first); } // Print header std::stringstream s; std::string blankName(maxNameLen, ' '); s << blankName << " proc wall num mean mean" << endl << blankName << " time time evals proc time wall time"; userOut() << s.str() << endl; std::sort(keys.begin(), keys.end()); for (auto k : keys) { const FStats& fs = m->fstats.at(k); print_stats_line(maxNameLen, k, fs.n_call, fs.t_proc, fs.t_wall); } // Sum the previously printed stats double t_wall_all_previous = 0; double t_proc_all_previous = 0; for (auto k : keys) { const FStats& fs = m->fstats.at(k); t_proc_all_previous += fs.t_proc; t_wall_all_previous += fs.t_wall; } print_stats_line(maxNameLen, "all previous", -1, t_proc_all_previous, t_wall_all_previous); }