示例#1
0
文件: main.cpp 项目: GOPRO1955/kodo
    void store_run(tables::table& results)
    {
        if (!results.has_column("throughput"))
            results.add_column("throughput");

        results.set_value("throughput", measurement());
    }
    void store_run(tables::table& results)
    {
        for(auto& c : m_counter)
        {
            if(!results.has_column(c.first))
            {
                results.add_column(c.first);
                results.set_default_value(c.first, uint32_t(0));
            }

            results.set_value(c.first,c.second);
        }
    }
示例#3
0
        bool print_column(const std::string& column,
            const std::string& unit,
            const tables::table& results)
        {
            if(!results.is_column<T>(column))
                return false;

            if(results.empty_rows(column) > 0)
                return false;

            auto values = results.values_as<T>(column);

            statistics res = calculate_statistics(
                values.cbegin(),
                values.cend());

            std::cout << console::textgreen << "[   RESULT ] "
                      << console::textdefault;

            std::cout   << column << " "
                        << std::endl
                        << console::textgreen << "[          ] "
                        << console::textdefault
                        << "   Average: " << res.m_mean
                        << " " << unit << std::endl;

            print("Max:", unit, res.m_max, res.m_mean);
            print("Min:", unit, res.m_min, res.m_mean);

            return true;

        }
示例#4
0
    void store_run(tables::table& results)
    {
        if (!results.has_column("goodput"))
            results.add_column("goodput");

        results.set_value("goodput", measurement());

        if (std::is_same<Feature, relaxed>::value)
        {
            gauge::config_set cs = get_current_configuration();
            std::string type = cs.get_value<std::string>("type");

            if (type == "decoder")
            {
                if (!results.has_column("extra_symbols"))
                    results.add_column("extra_symbols");

                uint32_t erased_symbols =
                    cs.get_value<uint32_t>("erased_symbols");
                uint32_t extra_symbols = m_processed_symbols - erased_symbols;
                results.set_value("extra_symbols", extra_symbols);
            }
        }
    }
示例#5
0
文件: main.cpp 项目: GOPRO1955/kodo
    void store_run(tables::table& results)
    {
        if(!results.has_column("dest[i] = dest[i] + src[i]"))
            results.add_column("dest[i] = dest[i] + src[i]");

        results.set_value("dest[i] = dest[i] + src[i]", m_counter.m_add);

        if(!results.has_column("dest[i] = dest[i] - src[i]"))
            results.add_column("dest[i] = dest[i] - src[i]");

        results.set_value("dest[i] = dest[i] - src[i]", m_counter.m_subtract);

        if(!results.has_column("dest[i] = dest[i] * constant"))
            results.add_column("dest[i] = dest[i] * constant");

        results.set_value("dest[i] = dest[i] * constant", m_counter.m_multiply);

        if(!results.has_column("dest[i] = dest[i] + (constant * src[i])"))
            results.add_column("dest[i] = dest[i] + (constant * src[i])");

        results.set_value("dest[i] = dest[i] + (constant * src[i])",
            m_counter.m_multiply_add);

        if(!results.has_column("dest[i] = dest[i] - (constant * src[i])"))
            results.add_column("dest[i] = dest[i] - (constant * src[i])");

        results.set_value("dest[i] = dest[i] - (constant * src[i])",
            m_counter.m_multiply_subtract);

        if(!results.has_column("invert(value)"))
            results.add_column("invert(value)");

        results.set_value("invert(value)", m_counter.m_invert);
    }
示例#6
0
        void benchmark_result(const benchmark &info,
            const tables::table &results)
        {
            std::vector<uint64_t> iterations =
                results.values_as<uint64_t>("iterations");

            statistics iter = calculate_statistics(
                iterations.cbegin(),
                iterations.cend());


            // Describe the beginning of the run.
            std::cout << std::fixed << console::textgreen << "[ RUN      ]"
                      << console::textdefault << " "
                      << info.testcase_name() << "."
                      << info.benchmark_name()
                      << " (" << results.rows()
                      << (results.rows() == 1 ? " run " : " runs ")
                      << "/ " << iter.m_mean << " "
                      << (iter.m_mean == 1 ? "iteration" : "iterations")
                      << ")" << std::endl;

            if(info.has_configurations())
            {
                std::cout << console::textyellow << "[  CONFIG  ]"
                          << console::textdefault << " ";
                const auto& c = info.get_current_configuration();
                bool first = true;
                tables::format f;
                for(const auto& v : c)
                {
                    if(!first)
                        std::cout << ",";
                    first = false;
                    std::cout << v.first << "=";

                    f.print(std::cout, v.second);
                }

                std::cout << std::endl;
            }

            double time = static_cast<double>(
                boost::chrono::duration_cast<boost::chrono::microseconds>(
                    m_benchmark_stop-m_benchmark_start).count());

            std::cout << std::fixed << console::textyellow << "[   TIME   ]"
                      << console::textdefault << " " << (time / 1000)
                      << " milliseconds" << std::endl;


            for(const auto& c_name : results.columns())
            {
                if(c_name == "iterations")
                    continue;
                if(c_name == "run_number")
                    continue;
                if(print_column<double>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<float>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<uint64_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<int64_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<int32_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<uint32_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<int16_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<uint16_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<int8_t>(c_name,info.unit_text(),results))
                    continue;
                if(print_column<uint8_t>(c_name,info.unit_text(),results))
                    continue;

            }

            std::cout << console::textgreen << "[----------] "
                      << console::textdefault << std::endl;
        }