Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/multi output #112

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: using interleaved benchmarks with different ostreams do not for…
…ce a new header
  • Loading branch information
SGSSGene committed Jun 25, 2024
commit b96e70e2485cb852cd0e8261092d723d955feea3
12 changes: 6 additions & 6 deletions src/include/nanobench.h
Original file line number Diff line number Diff line change
@@ -1791,7 +1791,7 @@ void gatherStabilityInformation(std::vector<std::string>& warnings, std::vector<
void printStabilityInformationOnce(std::ostream* outStream);

// remembers the last table settings used. When it changes, a new table header is automatically written for the new entry.
uint64_t& singletonHeaderHash() noexcept;
uint64_t& singletonHeaderHash(std::ostream const& _out) noexcept;

// determines resolution of the given clock. This is done by measuring multiple times and returning the minimum time difference.
Clock::duration calcClockResolution(size_t numEvaluations) noexcept;
@@ -2104,9 +2104,9 @@ void printStabilityInformationOnce(std::ostream* outStream) {
}

// remembers the last table settings used. When it changes, a new table header is automatically written for the new entry.
uint64_t& singletonHeaderHash() noexcept {
static uint64_t sHeaderHash{};
return sHeaderHash;
uint64_t& singletonHeaderHash(std::ostream const& _out) noexcept {
static std::unordered_map<std::ostream const*, uint64_t> sHeaderHashes;
return sHeaderHashes[&_out];
}

ANKERL_NANOBENCH_NO_SANITIZE("integer", "undefined")
@@ -2332,8 +2332,8 @@ struct IterationLogic::Impl {
hash = hash_combine(std::hash<bool>{}(mBench.relative()), hash);
hash = hash_combine(std::hash<bool>{}(mBench.performanceCounters()), hash);

if (hash != singletonHeaderHash()) {
singletonHeaderHash() = hash;
if (hash != singletonHeaderHash(os)) {
singletonHeaderHash(os) = hash;

// no result yet, print header
os << std::endl;