diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-06-04 18:24:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-04 18:24:12 -0700 |
| commit | bacf73cc68af8b7654cc920b07635f926b785b84 (patch) | |
| tree | 23b466be471d1c188ce893f4ce2b934e7f6a2b77 /slang.h | |
| parent | 1141b8243c4ff00c59e927b0c33dbffaea29db4c (diff) | |
Add APIs to get profile of compile time (#4242)
* Add APIs to get profile of compile time
Add serial time measurement
Add profiler to measure lots of stages in slang compilation, and it
can accumulate the time spent in each thread in multi-threads case and
finally report a serial timing info.
* Add invocation times to the profiler
* Simplify the profiler and provide a 'clear' option
Change the profiler design to only return the thread_local
profiler to user.
We create a ISlangProfiler interface to carry the thread_local
variable PerformanceProfilerImpl profiler to user.
In addition, we provide a new option in the input parameter to
control whether or not user want to clear the previous profile
data. So spGetCompileProfile() can always returns a fresh new
profiling data.
* Change to use slang container List
Stop using std::vector, instead use slang's container List.
Generate a UUID for ISlangProfiler
Diffstat (limited to 'slang.h')
| -rw-r--r-- | slang.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1574,6 +1574,16 @@ extern "C" #define SLANG_UUID_ISlangWriter ISlangWriter::getTypeGuid() + struct ISlangProfiler : public ISlangUnknown + { + SLANG_COM_INTERFACE(0x197772c7, 0x0155, 0x4b91, { 0x84, 0xe8, 0x66, 0x68, 0xba, 0xff, 0x06, 0x19 }) + virtual SLANG_NO_THROW size_t SLANG_MCALL getEntryCount() = 0; + virtual SLANG_NO_THROW const char* SLANG_MCALL getEntryName(uint32_t index) = 0; + virtual SLANG_NO_THROW long SLANG_MCALL getEntryTimeMS(uint32_t index) = 0; + virtual SLANG_NO_THROW uint32_t SLANG_MCALL getEntryInvocationTimes(uint32_t index) = 0; + }; + #define SLANG_UUID_ISlangProfiler ISlangProfiler::getTypeGuid() + namespace slang { struct IGlobalSession; struct ICompileRequest; @@ -2027,6 +2037,12 @@ extern "C" SLANG_API SlangResult spEnableReproCapture( SlangCompileRequest* request); + /*! @see slang::ICompileRequest::getCompileTimeProfile */ + SLANG_API SlangResult spGetCompileTimeProfile( + SlangCompileRequest* request, + ISlangProfiler** compileTimeProfile, + bool shouldClear); + /** Extract contents of a repro. @@ -4425,6 +4441,9 @@ namespace slang virtual SLANG_NO_THROW void SLANG_MCALL setIgnoreCapabilityCheck(bool value) = 0; + // return a copy of internal profiling results, and if `shouldClear` is true, clear the internal profiling results before returning. + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getCompileTimeProfile(ISlangProfiler** compileTimeProfile, bool shouldClear) = 0; + }; #define SLANG_UUID_ICompileRequest ICompileRequest::getTypeGuid() |
