From b85ca6f86d46ee3c4d5784d0bd4ebc8509e2a9bd Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 2 Mar 2020 12:30:25 -0500 Subject: Feature/profile tool (#1251) * WIP slang-profile * Turn on symbols needed for profile. * Remove calls to slang API from core as doing so broke profiling information. Fix premake so slang-profile works on VS. --- tools/slang-profile/slang-profile-main.cpp | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tools/slang-profile/slang-profile-main.cpp (limited to 'tools/slang-profile') diff --git a/tools/slang-profile/slang-profile-main.cpp b/tools/slang-profile/slang-profile-main.cpp new file mode 100644 index 000000000..19fb36604 --- /dev/null +++ b/tools/slang-profile/slang-profile-main.cpp @@ -0,0 +1,41 @@ +// slang-profile-main.cpp + +#include "../../source/core/slang-io.h" +#include "../../source/core/slang-std-writers.h" + +#include "../../source/core/slang-process-util.h" + +#include "../../slang-com-helper.h" + +#include "../../source/core/slang-string-util.h" + +using namespace Slang; + +SlangResult innerMain(int argc, char** argv) +{ + auto stdWriters = StdWriters::initDefaultSingleton(); + + // Time the creation of the session + { + const auto startTick = ProcessUtil::getClockTick(); + + ComPtr slangSession; + slangSession.attach(spCreateSession(nullptr)); + + const auto endTick = ProcessUtil::getClockTick(); + + printf("Ticks %f\n", double(endTick - startTick) / ProcessUtil::getClockFrequency()); + return SLANG_OK; + } + + return SLANG_OK; +} + +int main(int argc, char** argv) +{ + const SlangResult res = innerMain(argc, argv); +#ifdef _MSC_VER + _CrtDumpMemoryLeaks(); +#endif + return SLANG_SUCCEEDED(res) ? 0 : 1; +} -- cgit v1.2.3