From 05af41d21d74d24871507e6f8f50574ea08c48a2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 23 Sep 2019 15:38:25 -0400 Subject: Simple test profiling (#1062) * First pass support for performance profiling * Test across all elements * Fix bug - sourceContents is not used, should use rawSource. * * Add ability to get prelude from API. * Allow specifying source language for render-test * Made it possible to compile a test input file as C++ * Special handling for reflection * Added C++ impl to performance-profile.slang * Remove some clang warnings. * Output profile timings on appveyor and other TC. * Remove passing around of StdWriters (can use global). Small comment improvements. --- source/core/windows/slang-win-process-util.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/core/windows') diff --git a/source/core/windows/slang-win-process-util.cpp b/source/core/windows/slang-win-process-util.cpp index ac6468109..3a5a01cb3 100644 --- a/source/core/windows/slang-win-process-util.cpp +++ b/source/core/windows/slang-win-process-util.cpp @@ -344,4 +344,25 @@ static DWORD WINAPI _readerThreadProc(LPVOID threadParam) return SLANG_OK; } +static uint64_t _getClockFrequency() +{ + LARGE_INTEGER timerFrequency; + QueryPerformanceFrequency(&timerFrequency); + return timerFrequency.QuadPart; +} + +static const uint64_t g_frequency = _getClockFrequency(); + +/* static */uint64_t ProcessUtil::getClockFrequency() +{ + return g_frequency; +} + +/* static */uint64_t ProcessUtil::getClockTick() +{ + LARGE_INTEGER counter; + QueryPerformanceCounter(&counter); + return counter.QuadPart; +} + } -- cgit v1.2.3