11#define BENCHMARK_INFO_PREFIX "##BENCHMARK_INFO_PREFIX##"
12#define BENCHMARK_INFO_SEPARATOR "#"
13#define BENCHMARK_INFO_SUFFIX "##BENCHMARK_INFO_SUFFIX##"
15#define BENCH_GATE_COUNT_START(builder, op_name) \
16 uint64_t __bench_before = builder.get_num_finalized_gates_inefficient();
18#define BENCH_GATE_COUNT_END(builder, op_name) \
19 uint64_t __bench_after = builder.get_num_finalized_gates_inefficient(); \
20 std::cerr << "num gates with " << op_name << " = " << __bench_after - __bench_before << std::endl; \
21 benchmark_info(Builder::NAME_STRING, "Bigfield", op_name, "Gate Count", __bench_after - __bench_before);
23template <
typename... Args> std::string
format(Args... args)
25 std::ostringstream os;
33 std::stringstream current_argument;
34 current_argument << first;
35 std::string current_argument_string = current_argument.str();
36 std::ranges::replace(current_argument_string,
',',
';');
40template <
typename T,
typename... Args>
44 std::stringstream current_argument;
45 current_argument << first;
46 std::string current_argument_string = current_argument.str();
47 std::ranges::replace(current_argument_string,
',',
';');
54 std::ostringstream os;
82#define log_(level, ...) \
84 if (level <= bb_log_level) { \
85 log_function(level, format(__VA_ARGS__)); \
89#define log_fatal(...) log_(LogLevel::FATAL, __VA_ARGS__)
90#define log_error(...) log_(LogLevel::ERROR, __VA_ARGS__)
91#define log_warn(...) log_(LogLevel::WARN, __VA_ARGS__)
92#define important(...) log_(LogLevel::WARN, "important: ", __VA_ARGS__)
93#define info(...) log_(LogLevel::INFO, __VA_ARGS__)
94#define vinfo(...) log_(LogLevel::VERBOSE, __VA_ARGS__)
95#define log_verbose(...) log_(LogLevel::VERBOSE, __VA_ARGS__)
99#define debug(...) log_(LogLevel::DEBUG, __VA_ARGS__)
100#define log_trace(...) log_(LogLevel::TRACE, __VA_ARGS__)
102#define debug(...) (void)0
103#define log_trace(...) (void)0
115template <
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4,
typename Arg5>
116inline void benchmark_info(Arg1 composer, Arg2 class_name, Arg3 operation, Arg4 metric, Arg5
value)
149 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)
std::function< void(LogLevel level, const std::string &msg)> LogFunction
#define BENCHMARK_INFO_PREFIX
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
std::string benchmark_format(Args... args)
void benchmark_format_chain(std::ostream &os, T const &first)
void logstr(char const *msg)