Exemple #1
0
void cbInfo (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
{
	string line;
	msgin.serial (line);
	InfoLog->displayRawNL ("%s", line.c_str());

#ifdef USE_3D
	string token = "MeanPongTime ";
	uint pos=line.find (token);
	uint pos2=line.find (" ", pos+token.size());
	uint32 val = atoi(line.substr (pos+token.size(), pos2-pos-token.size()).c_str());	
	LagGraph.addOneValue ((float)val);
#endif
}
Exemple #2
0
void displayStreamingDebug ()
{
	// Yoyo: display with getPerformanceTime() for better precision.
	static TTicks oldTick = CTime::getPerformanceTime();
	TTicks newTick = CTime::getPerformanceTime();
	double deltaTime = CTime::ticksToSecond (newTick-oldTick);
	oldTick = newTick;
	static NLMISC::CValueSmoother smooth;
	smooth.addValue((float)deltaTime);
	deltaTime = deltaTime * 5.0f / 6.0f;
	float deltaTimeSmooth = smooth.getSmoothValue () * 5.0f / 6.0f;

	if (!FreezeGraph)
	{
		// Vram delta
		static uint32 lastVRAMUsed = Driver->profileAllocatedTextureMemory();
		uint32 VRAMUsed = Driver->profileAllocatedTextureMemory();
		sint value = (sint)VRAMUsed-(sint)lastVRAMUsed;
		if (value>=0)
		{
			VRAMUpGraph.addOneValue ((float)value/(1024.f*1024.f));
			VRAMDownGraph.addOneValue (0);
		}
		else
		{
			VRAMDownGraph.addOneValue ((float)(-value)/(1024.f*1024.f));
			VRAMUpGraph.addOneValue (0);
		}
		lastVRAMUsed = VRAMUsed;

		// File opened delta
		static uint32 lastFileOpened = CIFile::getNumFileOpen();
		uint32 fileOpened = CIFile::getNumFileOpen();
		OpenedFileGraph.addOneValue((float)(fileOpened-lastFileOpened));
		lastFileOpened=fileOpened;

		// Byte read delta
		static uint32 lastByteRead = CIFile::getReadFromFile();
		uint32 byteRead = CIFile::getReadFromFile();
		ByteReadGraph.addOneValue((float)CIFile::getReadingFromFile()/1024.f);
		ByteReadGraphInstant.addOneValue((float)(byteRead-lastByteRead)/1024.f);
		lastByteRead=byteRead;

		// Byte read delta
		static uint32 lastFileRead = CIFile::getNumFileRead();
		uint32 fileRead = CIFile::getNumFileRead();
		FileReadGraph.addOneValue((float)(fileRead-lastFileRead));
		lastFileRead=fileRead;

		// MS per frame
		SpfGraph.addOneValue (1000.f*(float)deltaTime);

		// lua memory
		LuaMemGraph.addOneValue(CInterfaceManager::getInstance()->getLuaState()->getGCCount() / 1024.f);

		// Count of waitinf instance
		CurrentTaskGraph.addOneValue (CAsyncFileManager::getInstance().isTaskRunning()?1.f:0.f);
	}

	// Add graph value

	if(ShowInfos == 3)
	{
		float lineStep = ClientCfg.DebugLineStep;
		float line;

		// Initialize Pen //
		//----------------//
		// Create a shadow when displaying a text.
		TextContext->setShaded(true);
		// Set the font size.
		TextContext->setFontSize(ClientCfg.DebugFontSize);
		// Set the text color
		TextContext->setColor(ClientCfg.DebugFontColor);

		// TOP LEFT //
		//----------//
		TextContext->setHotSpot(UTextContext::TopLeft);

		// FPS and Ms per frame
		line = 0.99f;
		TextContext->printfAt(0.01f, line, "STREAMING INFORMATION");
		if(deltaTimeSmooth != 0.f)
			TextContext->printfAt(0.8f, line,"%.1f fps", 1.f/deltaTimeSmooth);
		else
			TextContext->printfAt(0.8f, line,"%.1f fps", 0.f);
		TextContext->printfAt(0.9f, line, "%d ms", (uint)(deltaTimeSmooth*1000));


		// Dump the task array
		line = 0.90f;
		TextContext->printfAt(0.3f, line,"Task manager:");
		line -= lineStep;
		static vector<string> names;
		CAsyncFileManager::getInstance().dump(names);
		uint i;
		for (i=0; i<names.size (); i++)
		{
			TextContext->printfAt(0.3f, line, "  %s", names[i].c_str());
			line -= lineStep;
		}

		// Dump the opened file array
		line = 0.90f;
		TextContext->printfAt(0.65f, line,"Files opened:");
		line -= lineStep;
		CIFile::dump(names);
		for (i=0; i<names.size (); i++)
		{
			TextContext->printfAt(0.65f, line, "  %s", names[i].c_str());
			line -= lineStep;
		}

		// No more shadow when displaying a text.
		TextContext->setShaded(false);
	}
}