mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
s/output_format/printer_base/g
This commit is contained in:
@@ -13,8 +13,8 @@ set(srcs
|
||||
markdown_format.cu
|
||||
named_values.cu
|
||||
option_parser.cu
|
||||
output_format.cu
|
||||
output_multiplex.cu
|
||||
printer_base.cu
|
||||
runner.cu
|
||||
state.cu
|
||||
string_axis.cu
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace nvbench
|
||||
{
|
||||
|
||||
struct output_format;
|
||||
struct printer_base;
|
||||
struct runner_base;
|
||||
|
||||
template <typename BenchmarkType>
|
||||
@@ -135,12 +135,12 @@ struct benchmark_base
|
||||
|
||||
void run() { this->do_run(); }
|
||||
|
||||
void set_printer(optional_ref<nvbench::output_format> printer)
|
||||
void set_printer(optional_ref<nvbench::printer_base> printer)
|
||||
{
|
||||
m_printer = printer;
|
||||
}
|
||||
|
||||
[[nodiscard]] optional_ref<nvbench::output_format> get_printer() const
|
||||
[[nodiscard]] optional_ref<nvbench::printer_base> get_printer() const
|
||||
{
|
||||
return m_printer;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ protected:
|
||||
std::vector<nvbench::device_info> m_devices;
|
||||
std::vector<nvbench::state> m_states;
|
||||
|
||||
optional_ref<nvbench::output_format> m_printer;
|
||||
optional_ref<nvbench::printer_base> m_printer;
|
||||
|
||||
nvbench::int64_t m_min_samples{10};
|
||||
nvbench::float64_t m_min_time{0.5};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
|
||||
namespace nvbench
|
||||
{
|
||||
@@ -8,12 +8,12 @@ namespace nvbench
|
||||
/*!
|
||||
* CSV output format.
|
||||
*/
|
||||
struct csv_format : nvbench::output_format
|
||||
struct csv_format : nvbench::printer_base
|
||||
{
|
||||
using output_format::output_format;
|
||||
using printer_base::printer_base;
|
||||
|
||||
private:
|
||||
// Virtual API from output_format:
|
||||
// Virtual API from printer_base:
|
||||
void do_print_benchmark_results(const benchmark_vector &benches) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <nvbench/benchmark_base.cuh>
|
||||
#include <nvbench/device_info.cuh>
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
#include <nvbench/state.cuh>
|
||||
#include <nvbench/summary.cuh>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <nvbench/benchmark_base.cuh>
|
||||
#include <nvbench/device_info.cuh>
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
#include <nvbench/state.cuh>
|
||||
#include <nvbench/summary.cuh>
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
#include <nvbench/benchmark_manager.cuh>
|
||||
#include <nvbench/cuda_call.cuh>
|
||||
#include <nvbench/option_parser.cuh>
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
|
||||
#include <functional> // std::ref
|
||||
#include <optional> // std::nullopt
|
||||
#include <iostream>
|
||||
#include <optional> // std::nullopt
|
||||
|
||||
#define NVBENCH_MAIN \
|
||||
int main(int argc, char const *const *argv) \
|
||||
|
||||
@@ -127,7 +127,7 @@ void markdown_format::do_log_run_state(const nvbench::state &exec_state)
|
||||
}
|
||||
|
||||
void markdown_format::do_print_benchmark_list(
|
||||
const output_format::benchmark_vector &benches)
|
||||
const printer_base::benchmark_vector &benches)
|
||||
{
|
||||
fmt::memory_buffer buffer;
|
||||
fmt::format_to(buffer, "# Benchmarks\n\n");
|
||||
@@ -183,7 +183,7 @@ void markdown_format::do_print_benchmark_list(
|
||||
}
|
||||
|
||||
void markdown_format::do_print_benchmark_results(
|
||||
const output_format::benchmark_vector &benches)
|
||||
const printer_base::benchmark_vector &benches)
|
||||
{
|
||||
auto format_visitor = [](const auto &v) {
|
||||
using T = std::decay_t<decltype(v)>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -15,9 +15,9 @@ struct summary;
|
||||
*
|
||||
* Includes customization points to modify numeric formatting.
|
||||
*/
|
||||
struct markdown_format : nvbench::output_format
|
||||
struct markdown_format : nvbench::printer_base
|
||||
{
|
||||
using output_format::output_format;
|
||||
using printer_base::printer_base;
|
||||
|
||||
/*!
|
||||
* Enable / disable color in the output.
|
||||
@@ -33,7 +33,7 @@ struct markdown_format : nvbench::output_format
|
||||
/*!@}*/
|
||||
|
||||
private:
|
||||
// Virtual API from output_format:
|
||||
// Virtual API from printer_base:
|
||||
void do_print_device_info() override;
|
||||
void do_print_log_preamble() override;
|
||||
void do_print_log_epilogue() override;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <nvbench/benchmark_manager.cuh>
|
||||
#include <nvbench/csv_format.cuh>
|
||||
#include <nvbench/markdown_format.cuh>
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
#include <nvbench/range.cuh>
|
||||
|
||||
#include <nvbench/detail/throw.cuh>
|
||||
@@ -774,9 +774,6 @@ catch (std::exception &e)
|
||||
e.what());
|
||||
}
|
||||
|
||||
nvbench::output_format &option_parser::get_printer()
|
||||
{
|
||||
return m_printer;
|
||||
}
|
||||
nvbench::printer_base &option_parser::get_printer() { return m_printer; }
|
||||
|
||||
} // namespace nvbench
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace nvbench
|
||||
struct benchmark_base;
|
||||
struct float64_axis;
|
||||
struct int64_axis;
|
||||
struct output_format;
|
||||
struct printer_base;
|
||||
struct string_axis;
|
||||
struct type_axis;
|
||||
|
||||
@@ -51,8 +51,8 @@ struct option_parser
|
||||
*
|
||||
* The returned object is only valid for the lifetime of this option_parser.
|
||||
*/
|
||||
// output_format has no useful const API, so no const overload.
|
||||
[[nodiscard]] nvbench::output_format &get_printer();
|
||||
// printer_base has no useful const API, so no const overload.
|
||||
[[nodiscard]] nvbench::printer_base &get_printer();
|
||||
|
||||
private:
|
||||
void parse_impl();
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace nvbench
|
||||
{
|
||||
|
||||
output_multiplex::output_multiplex()
|
||||
: output_format(std::cerr) // Nothing should write to this.
|
||||
: printer_base(std::cerr) // Nothing should write to this.
|
||||
{}
|
||||
|
||||
void output_multiplex::do_print_device_info()
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->print_device_info();
|
||||
}
|
||||
@@ -19,7 +19,7 @@ void output_multiplex::do_print_device_info()
|
||||
|
||||
void output_multiplex::do_print_log_preamble()
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->print_log_preamble();
|
||||
}
|
||||
@@ -27,7 +27,7 @@ void output_multiplex::do_print_log_preamble()
|
||||
|
||||
void output_multiplex::do_print_log_epilogue()
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->print_log_epilogue();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ void output_multiplex::do_print_log_epilogue()
|
||||
|
||||
void output_multiplex::do_log(nvbench::log_level level, const std::string &str)
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->log(level, str);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void output_multiplex::do_log(nvbench::log_level level, const std::string &str)
|
||||
|
||||
void output_multiplex::do_log_run_state(const nvbench::state &exec_state)
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->log_run_state(exec_state);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ void output_multiplex::do_log_run_state(const nvbench::state &exec_state)
|
||||
|
||||
void output_multiplex::do_print_benchmark_list(const benchmark_vector &benches)
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->print_benchmark_list(benches);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void output_multiplex::do_print_benchmark_list(const benchmark_vector &benches)
|
||||
void output_multiplex::do_print_benchmark_results(
|
||||
const benchmark_vector &benches)
|
||||
{
|
||||
for (auto &format_ptr : m_formats)
|
||||
for (auto &format_ptr : m_printers)
|
||||
{
|
||||
format_ptr->print_benchmark_results(benches);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -9,9 +9,9 @@ namespace nvbench
|
||||
{
|
||||
|
||||
/*!
|
||||
* An nvbench::output_format that just forwards calls to other `output_format`s.
|
||||
* An nvbench::printer_base that just forwards calls to other `printer_base`s.
|
||||
*/
|
||||
struct output_multiplex : nvbench::output_format
|
||||
struct output_multiplex : nvbench::printer_base
|
||||
{
|
||||
|
||||
output_multiplex();
|
||||
@@ -19,13 +19,13 @@ struct output_multiplex : nvbench::output_format
|
||||
template <typename Format, typename... Ts>
|
||||
Format &emplace(Ts &&...ts)
|
||||
{
|
||||
m_formats.push_back(std::make_unique<Format>(std::forward<Ts>(ts)...));
|
||||
return static_cast<Format &>(*m_formats.back());
|
||||
m_printers.push_back(std::make_unique<Format>(std::forward<Ts>(ts)...));
|
||||
return static_cast<Format &>(*m_printers.back());
|
||||
}
|
||||
|
||||
[[nodiscard]] std::size_t get_output_count() const
|
||||
{
|
||||
return m_formats.size();
|
||||
return m_printers.size();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
void do_print_benchmark_list(const benchmark_vector &benches) override;
|
||||
void do_print_benchmark_results(const benchmark_vector &benches) override;
|
||||
|
||||
std::vector<std::unique_ptr<nvbench::output_format>> m_formats;
|
||||
std::vector<std::unique_ptr<nvbench::printer_base>> m_printers;
|
||||
};
|
||||
|
||||
} // namespace nvbench
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace nvbench
|
||||
{
|
||||
|
||||
output_format::output_format(std::ostream &ostream)
|
||||
printer_base::printer_base(std::ostream &ostream)
|
||||
: m_ostream{ostream}
|
||||
{}
|
||||
|
||||
// Defined here to keep <ostream> out of the header
|
||||
output_format::~output_format() = default;
|
||||
printer_base::~printer_base() = default;
|
||||
|
||||
} // namespace nvbench
|
||||
@@ -30,21 +30,21 @@ enum class log_level
|
||||
* Interactive terminal output formats should implement the logging functions so
|
||||
* users have some feedback.
|
||||
*/
|
||||
struct output_format
|
||||
struct printer_base
|
||||
{
|
||||
using benchmark_vector = std::vector<std::unique_ptr<benchmark_base>>;
|
||||
|
||||
/*!
|
||||
* Construct a new output_format that will write to ostream.
|
||||
* Construct a new printer_base that will write to ostream.
|
||||
*/
|
||||
explicit output_format(std::ostream &ostream);
|
||||
~output_format();
|
||||
explicit printer_base(std::ostream &ostream);
|
||||
~printer_base();
|
||||
|
||||
// move-only
|
||||
output_format(const output_format &) = delete;
|
||||
output_format(output_format &&) = default;
|
||||
output_format &operator=(const output_format &) = delete;
|
||||
output_format &operator=(output_format &&) = default;
|
||||
printer_base(const printer_base &) = delete;
|
||||
printer_base(printer_base &&) = default;
|
||||
printer_base &operator=(const printer_base &) = delete;
|
||||
printer_base &operator=(printer_base &&) = default;
|
||||
|
||||
/*!
|
||||
* Print a summary of all detected devices, if supported.
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <nvbench/runner.cuh>
|
||||
|
||||
#include <nvbench/benchmark_base.cuh>
|
||||
#include <nvbench/output_format.cuh>
|
||||
#include <nvbench/printer_base.cuh>
|
||||
#include <nvbench/state.cuh>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
Reference in New Issue
Block a user