Skip to content

Commit e913cb9

Browse files
authored
Printing a timing of stdlib build time (shader-slang#4190)
1 parent 07c29d8 commit e913cb9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/slang/slang.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ SlangResult Session::compileStdLib(slang::CompileStdLibFlags compileFlags)
319319
#ifdef _DEBUG
320320
// Print a message in debug builds to notice the user that compiling the stdlib
321321
// can take a while.
322+
time_t beginTime;
323+
time(&beginTime);
322324
fprintf(stderr, "Compiling stdlib on debug build, this can take a while.\n");
323325
#endif
324326

@@ -372,6 +374,11 @@ SlangResult Session::compileStdLib(slang::CompileStdLibFlags compileFlags)
372374

373375
finalizeSharedASTBuilder();
374376

377+
#ifdef _DEBUG
378+
time_t endTime;
379+
time(&endTime);
380+
fprintf(stderr, "Compiling stdlib took %.2f seconds.\n", difftime(endTime, beginTime));
381+
#endif
375382
return SLANG_OK;
376383
}
377384

0 commit comments

Comments
 (0)