File tree 2 files changed +22
-20
lines changed
2 files changed +22
-20
lines changed Original file line number Diff line number Diff line change 16
16
#include " slang-check-impl.h"
17
17
#include " slang-check.h"
18
18
19
+ #include < chrono>
20
+
19
21
// Artifact
20
22
#include " ../compiler-core/slang-artifact-associated.h"
21
23
#include " ../compiler-core/slang-artifact-container-util.h"
@@ -1835,6 +1837,26 @@ SlangResult CodeGenContext::_emitEntryPoints(ComPtr<IArtifact>& outArtifact)
1835
1837
return SLANG_FAIL;
1836
1838
}
1837
1839
1840
+ // Helper class for recording compile time.
1841
+ struct CompileTimerRAII
1842
+ {
1843
+ std::chrono::high_resolution_clock::time_point startTime;
1844
+ Session* session;
1845
+ CompileTimerRAII (Session* inSession)
1846
+ {
1847
+ startTime = std::chrono::high_resolution_clock::now ();
1848
+ session = inSession;
1849
+ }
1850
+ ~CompileTimerRAII ()
1851
+ {
1852
+ double elapsedTime = std::chrono::duration_cast<std::chrono::microseconds>(
1853
+ std::chrono::high_resolution_clock::now () - startTime)
1854
+ .count () /
1855
+ 1e6 ;
1856
+ session->addTotalCompileTime (elapsedTime);
1857
+ }
1858
+ };
1859
+
1838
1860
// Do emit logic for a zero or more entry points
1839
1861
SlangResult CodeGenContext::emitEntryPoints (ComPtr<IArtifact>& outArtifact)
1840
1862
{
Original file line number Diff line number Diff line change @@ -3755,26 +3755,6 @@ SLANG_FORCE_INLINE SlangSourceLanguage asExternal(SourceLanguage sourceLanguage)
3755
3755
return (SlangSourceLanguage)sourceLanguage;
3756
3756
}
3757
3757
3758
- // Helper class for recording compile time.
3759
- struct CompileTimerRAII
3760
- {
3761
- std::chrono::high_resolution_clock::time_point startTime;
3762
- Session* session;
3763
- CompileTimerRAII (Session* inSession)
3764
- {
3765
- startTime = std::chrono::high_resolution_clock::now ();
3766
- session = inSession;
3767
- }
3768
- ~CompileTimerRAII ()
3769
- {
3770
- double elapsedTime = std::chrono::duration_cast<std::chrono::microseconds>(
3771
- std::chrono::high_resolution_clock::now () - startTime)
3772
- .count () /
3773
- 1e6 ;
3774
- session->addTotalCompileTime (elapsedTime);
3775
- }
3776
- };
3777
-
3778
3758
// helpers for error/warning reporting
3779
3759
enum class DiagnosticCategory
3780
3760
{
You can’t perform that action at this time.
0 commit comments