bool GraphicsServerCommunication::CaptureFrameStub(gtASCIIString& frameInfoAsXML, unsigned char*& pImageBuffer, unsigned long& imageSize) { bool retVal = true; #pragma message ("TODO: FA: remove this function") static gtASCIIString serverResponseFormat = "<Root><Location></Location>"\ "<FrameNumber>%d</FrameNumber><Contents>"\ "<LinkedTrace>linkedtrace_20150915_091403.ltr</LinkedTrace>"\ "<FrameBufferImage></FrameBufferImage>"\ "<ElapsedTime>%d</ElapsedTime>"\ "<FPS>%d</FPS>"\ "<CPUFrameDuration>%f</CPUFrameDuration>"\ "<APICallCount>%d</APICallCount>"\ "<DrawCallCount>%d</DrawCallCount>"\ "</Contents></Root>"; static int frameIndex = 1345; frameIndex += rand() % 50; int elapsedTimeMS = rand() % 1000000; int fps = rand() % 250; double frameDuration = (double)rand() / 2.345; int apiCalls = rand() % 500000; int drawCalls = rand() % apiCalls; frameInfoAsXML.appendFormattedString(serverResponseFormat.asCharArray(), frameIndex, elapsedTimeMS, fps, frameDuration, apiCalls, drawCalls); GetFrameThumbnail(pImageBuffer, imageSize, frameIndex % 12); return retVal; }
//-------------------------------------------------------------------------- /// Generate a trace info block that can be appended to the top of the trace. Included application and system information. /// \param outHeaderString A string containing the generated block of header text. /// \returns True if the header was generated successfully. False if it failed. //-------------------------------------------------------------------------- bool MultithreadedTraceAnalyzerLayer::GenerateLinkedTraceHeader(gtASCIIString& outHeaderString) { bool bHeaderGenerated = false; // The response should include a header when connected to CodeXL Graphics. outHeaderString.appendFormattedString("//CodeXL Frame Trace\n"); osModuleArchitecture moduleArchitecture; osRuntimePlatform currentPlatform; gtString executablePath; gtString commandLine; gtString workingDirectory; if (osGetProcessLaunchInfo(osGetCurrentProcessId(), moduleArchitecture, currentPlatform, executablePath, commandLine, workingDirectory) == true) { outHeaderString.appendFormattedString("//ProcessExe=%s\n", executablePath.asASCIICharArray()); // Build a timestamp. osTime currentTime; currentTime.setFromCurrentTime(); tm timeStruct; currentTime.timeAsTmStruct(timeStruct, osTime::LOCAL); // Need to add 1900, since tm contains "years since 1900". int year = timeStruct.tm_year + 1900; // Need to add 1, since tm contains "months since January". int month = timeStruct.tm_mon + 1; int day = timeStruct.tm_mday; int hour = timeStruct.tm_hour; int minute = timeStruct.tm_min; int second = timeStruct.tm_sec; gtASCIIString timestampBuilder; timestampBuilder.appendFormattedString("%d/%d/%d %d:%d:%d", month, day, year, hour, minute, second); outHeaderString.appendFormattedString("//TraceDateTime=%s\n", timestampBuilder.asCharArray()); outHeaderString.appendFormattedString("//TraceFileVersion=%d\n", 1); outHeaderString.appendFormattedString("//ApplicationArgs=%s\n", commandLine.asASCIICharArray()); outHeaderString.appendFormattedString("//WorkingDirectory=%s\n", workingDirectory.asASCIICharArray()); // Build a system information header string. std::string systemInfo; OSWrappers::WriteSystemInfoString(systemInfo); outHeaderString.appendFormattedString("\n%s\n", systemInfo.c_str()); bHeaderGenerated = true; } else { Log(logERROR, "Failed to retrieve process info when building response header.\n"); } return bHeaderGenerated; }