12#define BENCHMARK_INFO_PREFIX "##BENCHMARK_INFO_PREFIX##"
13#define BENCHMARK_INFO_SEPARATOR "#"
14#define BENCHMARK_INFO_SUFFIX "##BENCHMARK_INFO_SUFFIX##"
16#define BENCH_GATE_COUNT_START(builder, op_name) \
17 uint64_t __bench_before = builder.get_num_finalized_gates_inefficient();
19#define BENCH_GATE_COUNT_END(builder, op_name) \
20 uint64_t __bench_after = builder.get_num_finalized_gates_inefficient(); \
21 std::cerr << "num gates with " << op_name << " = " << __bench_after - __bench_before << std::endl; \
22 benchmark_info(Builder::NAME_STRING, "Bigfield", op_name, "Gate Count", __bench_after - __bench_before);
24template <
typename... Args> std::string
format(Args... args)
26 std::ostringstream os;
34 std::stringstream current_argument;
35 current_argument << first;
36 std::string current_argument_string = current_argument.str();
37 std::ranges::replace(current_argument_string,
',',
';');
41template <
typename T,
typename... Args>
45 std::stringstream current_argument;
46 current_argument << first;
47 std::string current_argument_string = current_argument.str();
48 std::ranges::replace(current_argument_string,
',',
';');
55 std::ostringstream os;
76#define debug(...) debug_([&]() { return format(__VA_ARGS__); })
78#define debug(...) (void)0
82inline void debug_(std::function<std::string()> func)
89template <
typename... Args>
inline void info(Args... args)
94#define vinfo(...) vinfo_([&]() { return format(__VA_ARGS__); })
97inline void vinfo_(std::function<std::string()> func)
104template <
typename... Args>
inline void important(Args... args)
118template <
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4,
typename Arg5>
119inline void benchmark_info(Arg1 composer, Arg2 class_name, Arg3 operation, Arg4 metric, Arg5
value)
152 template <
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4,
typename Arg5>
A class for saving benchmarks and printing them all at once in the end of the function.
void benchmark_info_deferred(Args...)
BenchmarkInfoCollator(BenchmarkInfoCollator &&other)=default
BenchmarkInfoCollator(const BenchmarkInfoCollator &other)=default
BenchmarkInfoCollator & operator=(const BenchmarkInfoCollator &other)=default
std::vector< std::string > saved_benchmarks
BenchmarkInfoCollator()=default
BenchmarkInfoCollator & operator=(BenchmarkInfoCollator &&other)=default
BenchmarkInfoCollator(std::vector< std::string > saved_benchmarks)
Info used to store circuit statistics during CI/CD with concrete structure. Stores string in vector f...
#define BENCHMARK_INFO_SEPARATOR
std::string format(Args... args)
#define BENCHMARK_INFO_PREFIX
std::function< void(LogLevel level, const char *msg)> LogFunction
void debug_(std::function< std::string()> func)
void benchmark_info(Args...)
Info used to store circuit statistics during CI/CD with concrete structure. Writes straight to log.
void set_log_function(LogFunction new_log_function)
#define BENCHMARK_INFO_SUFFIX
void important(Args... args)
std::string benchmark_format(Args... args)
void benchmark_format_chain(std::ostream &os, T const &first)
void vinfo_(std::function< std::string()> func)
void logstr(char const *msg)