diff --git a/ypsu.cpp b/ypsu.cpp index 19143a8..2a1ae86 100644 --- a/ypsu.cpp +++ b/ypsu.cpp @@ -392,10 +392,36 @@ free(pd); } + // to measure / profile a single variant + void measure_single(int n) { + for (auto inputtype : inputtypes) { + printf("%10s", inputtype.c_str()); + fflush(stdout); + std::vector v(n); + v = geninput(inputtype, n); + measure(inputtype, "sp", [&] { spsort(&v[0], v.size()); }); + + for (auto r : results) printf("%9.3fs", r.second); + puts(""); + } + puts(""); + printf("%10s", "worst"); + for (auto w : worst) printf("%9.3fs", w.second); + puts(""); + printf("%10s", ""); + for (auto w : worst) printf("%10s", w.first.c_str()); + puts(""); + } + int main(void) { int n = 100000000; //int n = 10000000; //int n = 64; + + // Uncomment this for profiling and alg! + measure_single(n); + return 0; + for (auto inputtype : inputtypes) { printf("%10s", inputtype.c_str()); fflush(stdout);