summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index f2598786f..ead1e338f 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -4806,6 +4806,11 @@ void EndToEndCompileRequest::setPassThrough(SlangPassThrough inPassThrough)
m_passThrough = PassThroughMode(inPassThrough);
}
+void EndToEndCompileRequest::setReportDownstreamTime(bool value)
+{
+ m_reportDownstreamCompileTime = value;
+}
+
void EndToEndCompileRequest::setDiagnosticCallback(SlangDiagnosticCallback callback, void const* userData)
{
ComPtr<ISlangWriter> writer(new CallbackWriter(callback, userData, WriterFlag::IsConsole));
@@ -5112,7 +5117,11 @@ SlangResult EndToEndCompileRequest::setTypeNameForEntryPointExistentialTypeParam
SlangResult EndToEndCompileRequest::EndToEndCompileRequest::compile()
{
SlangResult res = SLANG_FAIL;
-
+ double downstreamStartTime = 0.0;
+ if (m_reportDownstreamCompileTime)
+ {
+ downstreamStartTime = getSession()->getDownstreamCompilerElapsedTime();
+ }
#if !defined(SLANG_DEBUG_INTERNAL_ERROR)
// By default we'd like to catch as many internal errors as possible,
// and report them to the user nicely (rather than just crash their
@@ -5160,6 +5169,14 @@ SlangResult EndToEndCompileRequest::EndToEndCompileRequest::compile()
}
#endif
+ if (m_reportDownstreamCompileTime)
+ {
+ double downstreamTime = getSession()->getDownstreamCompilerElapsedTime() - downstreamStartTime;
+ String downstreamTimeStr = String(downstreamTime, "%.2f");
+ getSink()->diagnose(SourceLoc(), Diagnostics::downstreamCompileTime, downstreamTimeStr);
+
+ }
+
// Repro dump handling
{
if (m_dumpRepro.getLength())