Exemplo n.º 1
0
int main(int argc, char* argv[])
{
	MicroProfileOnThreadCreate("Main");
	printf("press ctrl-c to quit\n");

	//turn on profiling
	MicroProfileSetForceEnable(true);
	MicroProfileSetEnableAllGroups(true);
	MicroProfileSetForceMetaCounters(true);

	MicroProfileStartContextSwitchTrace();

	StartFakeWork();
	while(!g_nQuit)
	{
		MICROPROFILE_SCOPE(MAIN);
		{
			usleep(16000);
		}
		MicroProfileFlip();
		static bool once = false;
		if(!once)
		{
			once = 1;
			printf("open localhost:%d in chrome to capture profile data\n", MicroProfileWebServerPort());
		}

	}

	StopFakeWork();
	
	MicroProfileShutdown();

	return 0;
}
Exemplo n.º 2
0
void Age_microprofileInit()
{
	MicroProfileOnThreadCreate("Main");
	printf("Micro profile is enabled\n");

	//turn on profiling
	MicroProfileSetForceEnable(true);
	MicroProfileSetEnableAllGroups(true);
	MicroProfileSetForceMetaCounters(true);

	MicroProfileStartContextSwitchTrace();
}
Exemplo n.º 3
0
void HandleEvent(SDL_Event* pEvt)
{
	switch(pEvt->type)
	{
	case SDL_QUIT:
		g_nQuit = true;
		break;
	case SDL_KEYUP:
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_ESCAPE)
		{
			g_nQuit = 1;
		}
		if(pEvt->key.keysym.sym == 'z')
		{
			MicroProfileToggleDisplayMode();
		}
		if(pEvt->key.keysym.sym == 'x')
		{
			bool bForceEnable = MicroProfileGetForceEnable();
			MicroProfileSetForceEnable(!bForceEnable);
			printf("force enable is %d\n", !bForceEnable);
		}
		if(pEvt->key.keysym.sym == 'c')
		{
			bool bEnable = MicroProfileGetEnableAllGroups();
			MicroProfileSetEnableAllGroups(!bEnable);
			printf("enable all groups is %d\n", !bEnable);
		}
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_RSHIFT)
		{
			MicroProfileTogglePause();
		}
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_LCTRL)
		{
			MicroProfileModKey(0);
		}
		if(pEvt->key.keysym.sym == 'a')
		{
			MicroProfileDumpTimers();
		}
#if MICROPROFILE_WEBSERVER
		if(pEvt->key.keysym.sym == 'd')
		{
			MicroProfileDumpFile("../dump.html", "../dump.csv");
		}
#endif
		if(pEvt->key.keysym.sym == 'l')
		{
			MicroProfileCustomGroupToggle("Custom1");
		}

		if(pEvt->key.keysym.sym == 't')
		{
			static bool toggle = false;
			if(toggle)
			{
				MicroProfileEnableCategory("ThreaDS");
			}
			else
			{
				MicroProfileDisableCategory("ThreaDS");
			}
			toggle = !toggle;
		}
		break;


		break;
	case SDL_KEYDOWN:
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_LCTRL)
		{
			MicroProfileModKey(1);
		}
		break;
	case SDL_MOUSEMOTION:
		g_MouseX = pEvt->motion.x;
		g_MouseY = pEvt->motion.y;
		break;
	case SDL_MOUSEBUTTONDOWN:
		if(pEvt->button.button == 1)
			g_MouseDown0 = 1;
		else if(pEvt->button.button == 3)
			g_MouseDown1 = 1;
		break;
	case SDL_MOUSEBUTTONUP:
		if(pEvt->button.button == 1)
		{
			g_MouseDown0 = 0;
		}
		else if(pEvt->button.button == 3)
		{
			g_MouseDown1 = 0;
		}
		break;
	case SDL_MOUSEWHEEL:
			g_MouseDelta -= pEvt->wheel.y;
		break;
	}



}
Exemplo n.º 4
0
void HandleEvent(SDL_Event* pEvt)
{
	switch(pEvt->type)
	{
	case SDL_QUIT:
		g_nQuit = true;
		break;
	case SDL_KEYUP:
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_ESCAPE)
		{
			g_nQuit = 1;
		}
		if(pEvt->key.keysym.sym == 'z')
		{
			MicroProfileToggleDisplayMode();
		}
		if(pEvt->key.keysym.sym == 'x')
		{
			bool bForceEnable = MicroProfileGetForceEnable();
			MicroProfileSetForceEnable(!bForceEnable);
			printf("force enable is %d\n", !bForceEnable);
		}
		if(pEvt->key.keysym.sym == 'c')
		{
			bool bEnable = MicroProfileGetEnableAllGroups();
			MicroProfileSetEnableAllGroups(!bEnable);
			printf("enable all groups is %d\n", !bEnable);
		}
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_RSHIFT)
		{
			MicroProfileTogglePause();
		}
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_LCTRL)
		{
			MicroProfileModKey(0);
		}
		if(pEvt->key.keysym.sym == 'a')
		{
			MicroProfileDumpTimers();
		}
		if(pEvt->key.keysym.sym == 'd')
		{
			MicroProfileDumpHtml("../dump.html");
		}
		break;


		break;
	case SDL_KEYDOWN:
		if(pEvt->key.keysym.scancode == SDL_SCANCODE_LCTRL)
		{
			MicroProfileModKey(1);
		}
		break;
	case SDL_MOUSEMOTION:
		g_MouseX = pEvt->motion.x;
		g_MouseY = pEvt->motion.y;
		break;
	case SDL_MOUSEBUTTONDOWN:
		if(pEvt->button.button == 1)
			g_MouseDown0 = 1;
		else if(pEvt->button.button == 3)
			g_MouseDown1 = 1;
		break;
	case SDL_MOUSEBUTTONUP:
		if(pEvt->button.button == 1)
		{
			g_MouseDown0 = 0;
		}
		else if(pEvt->button.button == 3)
		{
			g_MouseDown1 = 0;
		}
		break;
	case SDL_MOUSEWHEEL:
			g_MouseDelta -= pEvt->wheel.y;
		break;
	}



}