diff --git a/tests/benchmarks/benchmark.cpp b/tests/benchmarks/benchmark.cpp index 427267c2..61feacc3 100644 --- a/tests/benchmarks/benchmark.cpp +++ b/tests/benchmarks/benchmark.cpp @@ -241,6 +241,18 @@ static std::string which(const std::string &cmd) return {}; } +std::string hostname() +{ + std::array buf {}; + if (gethostname(buf.data(), buf.size()) != 0) { + return {}; + } + + buf.back() = '\0'; + + return std::string(buf.data()); +} + int setup(std::span args) { const struct argp argp = {.options = options.data(), @@ -284,6 +296,7 @@ int setup(std::span args) if (pos != ::std::string::npos) config.outfile.replace(pos, pattern.size(), config.gitrev); + ::benchmark::AddCustomContext("hostname", hostname()); ::benchmark::AddCustomContext("gitrev", config.gitrev); ::benchmark::AddCustomContext("gitdate", ::std::to_string(config.gitdate)); ::benchmark::AddCustomContext("bfcli", config.bfcli);