diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-11 09:29:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-11 09:29:27 -0700 |
| commit | d0901aa7933ac31b0bf7648a31ec5c13de864457 (patch) | |
| tree | 298db796f1200013e841ed03db7ca24e2890c00a /source/slang/slang.cpp | |
| parent | d9c57e613f2dacd221d9c46c10395cf373a8fcaf (diff) | |
Add perf benchmark utility. (#2977)
* Add perf benchmark utility.
* Update documentation.
* Fix.
* Fix doc.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index daa9cda3b..ffeabb0bd 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -7,7 +7,7 @@ #include "../core/slang-type-text-util.h" #include "../core/slang-type-convert-util.h" #include "../core/slang-castable.h" - +#include "../core/slang-performance-profiler.h" // Artifact #include "../compiler-core/slang-artifact-impl.h" #include "../compiler-core/slang-artifact-desc-util.h" @@ -4813,6 +4813,11 @@ void EndToEndCompileRequest::setReportDownstreamTime(bool value) m_reportDownstreamCompileTime = value; } +void EndToEndCompileRequest::setReportPerfBenchmark(bool value) +{ + m_reportPerfBenchmark = value; +} + void EndToEndCompileRequest::setDiagnosticCallback(SlangDiagnosticCallback callback, void const* userData) { ComPtr<ISlangWriter> writer(new CallbackWriter(callback, userData, WriterFlag::IsConsole)); @@ -5181,7 +5186,12 @@ SlangResult EndToEndCompileRequest::EndToEndCompileRequest::compile() double downstreamTime = downstreamEndTime - downstreamStartTime; String downstreamTimeStr = String(downstreamTime, "%.2f"); getSink()->diagnose(SourceLoc(), Diagnostics::downstreamCompileTime, downstreamTimeStr); - + } + if (m_reportPerfBenchmark) + { + StringBuilder perfResult; + PerformanceProfiler::getProfiler()->getResult(perfResult); + getSink()->diagnose(SourceLoc(), Diagnostics::performanceBenchmarkResult, perfResult.produceString()); } // Repro dump handling |
