Skip to content

Commit

Permalink
Fix running synth benchmarks directly via synth.cpp
Browse files Browse the repository at this point in the history
Summary:
There was a mistake in a previous change that was silencing some of
the options getting passed to the benchmark runner. Specifically,
the option to print the GC stats was missing, which is critical since that
is what prints out performance numbers.

Reviewed By: avp

Differential Revision: D22464903

fbshipit-source-id: bc4f7aed8cb4f3cc6284bdcbe2c2c9fd4bb468b0
  • Loading branch information
Riley Dulin authored and facebook-github-bot committed Jul 11, 2020
1 parent 0fc96cd commit 9bed5da
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions tools/synth/synth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,31 +221,6 @@ int main(int argc, char **argv) {
llvh::EnableStatistics();
#endif

std::vector<std::string> bytecodeFiles{cl::BytecodeFiles.begin(),
cl::BytecodeFiles.end()};
if (!cl::Trace.empty()) {
// If this is tracing mode, get the trace instead of the stats.
shouldPrintGCStats = false;
options.shouldTrackIO = false;
std::error_code ec;
auto os = ::hermes::make_unique<llvh::raw_fd_ostream>(
cl::Trace.c_str(),
ec,
llvh::sys::fs::CD_CreateAlways,
llvh::sys::fs::FA_Write,
llvh::sys::fs::OF_Text);
if (ec) {
throw std::system_error(ec);
}
TraceInterpreter::execAndTrace(
cl::TraceFile, bytecodeFiles, options, std::move(os));
llvh::outs() << "\nWrote output trace to: " << cl::Trace << "\n";
} else {
llvh::outs() << TraceInterpreter::execAndGetStats(
cl::TraceFile, bytecodeFiles, options)
<< "\n";
}

options.gcConfigBuilder.withShouldRecordStats(shouldPrintGCStats);
if (minHeapSize) {
options.gcConfigBuilder.withMinHeapSize(*minHeapSize);
Expand Down Expand Up @@ -279,6 +254,31 @@ int main(int argc, char **argv) {
options.gcConfigBuilder.withSanitizeConfig(sanitizeConfigBuilder.build());
}

std::vector<std::string> bytecodeFiles{cl::BytecodeFiles.begin(),
cl::BytecodeFiles.end()};
if (!cl::Trace.empty()) {
// If this is tracing mode, get the trace instead of the stats.
options.gcConfigBuilder.withShouldRecordStats(false);
options.shouldTrackIO = false;
std::error_code ec;
auto os = ::hermes::make_unique<llvh::raw_fd_ostream>(
cl::Trace.c_str(),
ec,
llvh::sys::fs::CD_CreateAlways,
llvh::sys::fs::FA_Write,
llvh::sys::fs::OF_Text);
if (ec) {
throw std::system_error(ec);
}
TraceInterpreter::execAndTrace(
cl::TraceFile, bytecodeFiles, options, std::move(os));
llvh::outs() << "\nWrote output trace to: " << cl::Trace << "\n";
} else {
llvh::outs() << TraceInterpreter::execAndGetStats(
cl::TraceFile, bytecodeFiles, options)
<< "\n";
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
if (cl::PrintStats)
llvh::PrintStatistics(llvh::outs());
Expand Down

0 comments on commit 9bed5da

Please sign in to comment.