//--------------------------------------------------------------------------
/// This is called before the target function call, and will setup a new ThreadTraceData
/// structure if necessary, but will also track the start time for a function call.
/// \return Nothing.
//--------------------------------------------------------------------------
void MultithreadedTraceAnalyzerLayer::BeforeAPICall()
{
    // Find the correct ThreadTraceData instance and inject the precall time.
    // A single thread will only ever deal with tracing one function at a time, so we can
    // leave "this" traced function's start time in the per-thread data.
    DWORD threadId = osGetCurrentThreadId();
    ThreadTraceData* currentThreadData = FindOrCreateThreadData(threadId);
    currentThreadData->m_startTime = currentThreadData->mAPICallTimer.GetRaw();
}
Пример #2
0
//-----------------------------------------------------------------------------
/// Log a Vulkan API call within the Trace Analyzer.
/// \param pApiEntry The APIEntry created for this API call
//-----------------------------------------------------------------------------
void VktTraceAnalyzerLayer::LogAPICall(VktAPIEntry* pApiEntry)
{
    ScopeLock logAPICallLock(&mTraceMutex);

    ThreadTraceData* pCurrentThreadData = FindOrCreateThreadData(pApiEntry->mThreadId);

    UINT64 startTime = pCurrentThreadData->m_startTime.QuadPart;

    if (startTime == s_DummyTimestampValue)
    {
        const char* pFuncNameString = GetFunctionNameFromId(pApiEntry->mFunctionId);
        Log(logERROR, "There was a problem setting the start time for API call '%s' on Thread with Id '%d'.\n", pFuncNameString, pApiEntry->mThreadId);
    }

    pCurrentThreadData->AddAPIEntry(pCurrentThreadData->m_startTime, pApiEntry);
}