diff options
| author | Yong He <yonghe@outlook.com> | 2023-05-23 15:19:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-23 15:19:27 -0700 |
| commit | f88e1299b7715190ce82f3f4473f0d0eeaa2000e (patch) | |
| tree | 7aba3971505ab50b8ee2d387695cef4da81344de /source/slang/slang.cpp | |
| parent | a291dbf0ce774fdc11c820471e26bda656bf1666 (diff) | |
Add API for querying total compile time. (#2898)
* Add API for querying total compile time.
* Optimize.
* Remove redundant simplifyIR calls.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index ead1e338f..d651f0737 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -2997,6 +2997,8 @@ RefPtr<Module> Linkage::loadModule( DiagnosticSink* sink, const LoadedModuleDictionary* additionalLoadedModules) { + CompileTimerRAII recordCompileTime(static_cast<Session*>(getGlobalSession())); + RefPtr<FrontEndCompileRequest> frontEndReq = new FrontEndCompileRequest(this, nullptr, sink); frontEndReq->additionalLoadedModules = additionalLoadedModules; @@ -5118,9 +5120,11 @@ SlangResult EndToEndCompileRequest::EndToEndCompileRequest::compile() { SlangResult res = SLANG_FAIL; double downstreamStartTime = 0.0; + double totalStartTime = 0.0; + if (m_reportDownstreamCompileTime) { - downstreamStartTime = getSession()->getDownstreamCompilerElapsedTime(); + getSession()->getCompilerElapsedTime(&totalStartTime, &downstreamStartTime); } #if !defined(SLANG_DEBUG_INTERNAL_ERROR) // By default we'd like to catch as many internal errors as possible, @@ -5171,7 +5175,10 @@ SlangResult EndToEndCompileRequest::EndToEndCompileRequest::compile() if (m_reportDownstreamCompileTime) { - double downstreamTime = getSession()->getDownstreamCompilerElapsedTime() - downstreamStartTime; + double downstreamEndTime = 0; + double totalEndTime = 0; + getSession()->getCompilerElapsedTime(&totalEndTime, &downstreamEndTime); + double downstreamTime = downstreamEndTime - downstreamStartTime; String downstreamTimeStr = String(downstreamTime, "%.2f"); getSink()->diagnose(SourceLoc(), Diagnostics::downstreamCompileTime, downstreamTimeStr); |
