示例#1
0
void semWaitCheck(uint64_t arg) {
	uint64_t dt;
	uint64_t t0 = sys_time_get_system_time();
	if (sys_semaphore_wait(g_sem, arg)) {
		printf("[!] sys_semaphore_wait: Something went wrong!\n");
		exit(-1);
	}
	dt = sys_time_get_system_time() - t0;
	if (dt / 1000000 < 1) {
		printf("[!] sys_semaphore_wait: Woke up too early!\n");
		exit(-1);
	}
	printf("sys_semaphore_wait: Thread woke up successfully\n");
	sys_ppu_thread_exit(0);
}
示例#2
0
void gettimeofday (struct timeval *tv, void *blah)
{
   int64_t time = sys_time_get_system_time();

   tv->tv_sec  = time / 1000000;
   tv->tv_usec = time - (tv->tv_sec * 1000000);  // implicit rounding will take care of this for us
}
示例#3
0
void PS3Graphics::Refresh()
{
	// Is this sufficient for a callback redraw?

	glClear(GL_COLOR_BUFFER_BIT);
	glDrawArrays(GL_QUADS, 0, 4); 
	DrawHUD();
	psglSwap();
	last_redraw = sys_time_get_system_time();
}
示例#4
0
void PS3Graphics::Draw(int width, int height, uint16_t* screen)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glBufferSubData(GL_TEXTURE_REFERENCE_BUFFER_SCE, 0, width * height * 2, screen);
	glTextureReferenceSCE(GL_TEXTURE_2D, 1, width, height, 0, GL_RGB5_A1, width*2, 0);
	UpdateCgParams(width, height, width, height);
	glDrawArrays(GL_QUADS, 0, 4); 
	DrawHUD();
	last_redraw = sys_time_get_system_time();
}
示例#5
0
int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr)
{
	sys_time.Log("sys_time_get_current_time(sec_addr=0x%x, nsec_addr=0x%x)", sec_addr, nsec_addr);

	u64 time = sys_time_get_system_time();

	Memory.Write64(sec_addr, time / 1000000);
	Memory.Write64(nsec_addr, time % 1000000);

	return CELL_OK;
}
示例#6
0
      virtual uint32 getMillis(bool skipRecord = false)
      {
#if defined(GEKKO)
         return (ticks_to_microsecs(gettime()) / 1000.0) - _startTime;
#elif defined(__CELLOS_LV2__)
         return (sys_time_get_system_time() / 1000.0) - _startTime;
#else
         struct timeval t;
         gettimeofday(&t, 0);

         return ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - _startTime;
#endif
      }
示例#7
0
static int gettimeofday2(struct timeval *val, void *dummy)
{
   (void)dummy;
#if defined(_MSC_VER) && !defined(_XBOX360)
   DWORD msec = timeGetTime();
#elif defined(_XBOX360)
   DWORD msec = GetTickCount();
#endif

#if defined(__CELLOS_LV2__)
   uint64_t usec = sys_time_get_system_time();
#elif defined(GEKKO)
   uint64_t usec = ticks_to_microsecs(gettime());
#else
   uint64_t usec = msec * 1000;
#endif

   val->tv_sec  = usec / 1000000;
   val->tv_usec = usec % 1000000;
   return 0;
}
示例#8
0
double Sys_DoubleTime(void)
{
#if defined(GEKKO)
   return ticks_to_microsecs(gettime()) / 1000000.0;
#elif defined(__CELLOS_LV2__)
   return sys_time_get_system_time() / 1000000.0;
#elif defined(_WIN32)
   static double pfreq;
   static __int64 startcount;
   __int64 pcount;

   if (!pfreq)
   {
      __int64 freq;
     if (QueryPerformanceFrequency((LARGE_INTEGER*)&freq) && freq > 0)
     {
        //hardware timer available
        pfreq = (double)freq;
        QueryPerformanceCounter((LARGE_INTEGER*)&startcount);
     }
   }

   QueryPerformanceCounter((LARGE_INTEGER*)&pcount);
   /* TODO -check for wrapping - is it necessary? */
   return (pcount - startcount) / pfreq;
#else
   struct timeval tp;
   struct timezone tzp;
   static int secbase;

   gettimeofday(&tp, &tzp);

   if (!secbase) {
      secbase = tp.tv_sec;
      return tp.tv_usec / 1000000.0;
   }

   return (tp.tv_sec - secbase) + tp.tv_usec / 1000000.0;
#endif
}
示例#9
0
Uint32 SDL_GetTicks (void)
{
	system_time_t now = sys_time_get_system_time();
	return (now - start) / 1000;
}
示例#10
0
void SDL_StartTicks(void)
{
	start = sys_time_get_system_time();
}
示例#11
0
s32 main(s32 argc, const char* argv[])
{
	printf("init_screen()\n");
	init_screen();

	PadInfo padinfo;
	PadData paddata;
	int i;
	
	printf("Initializing 6 SPUs... ");
	printf("%08x\n", lv2SpuInitialize(6, 5));

	printf("ioPadInit()\n");
	ioPadInit(7);
	printf("init_efb()\n");
	init_efb(1);

	long frame = 0; // To keep track of how many frames we have rendered.
	
	// Ok, everything is setup. Now for the main loop.
	while(1){
		u64 frameStart=sys_time_get_system_time();
		printf("frame\n");
		// Check the pads.
		ioPadGetInfo(&padinfo);
		for(i=0; i<MAX_PADS; i++){
			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);
				
				if(paddata.BTN_CROSS){
					return 0;
				}
			}
			
		}

		u64 afterPad=sys_time_get_system_time();
		u64 afterWaitForBlit=sys_time_get_system_time();
		printf("waitFlip\n");
		waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer

		u64 afterWaitFlip=sys_time_get_system_time();
		printf("drawFrame\n");
		if(1)
		{
			//drawFrame(buffers[currentBuffer], frame); // Draw into the unused buffer6
			drawFrame((buffer*)offscreenBuffers[0], frame); // Draw into the unused buffer
		}
		else
		{
			for(int xy=0;xy<offWidth*offHeight;xy++)
			{
				if(currentBuffer)
					offscreenBuffers[0][xy]=xy*2;//%offWidth;
				else
					offscreenBuffers[0][xy]=xy*2;//%offWidth;
			}
		}
		u64 afterDraw=sys_time_get_system_time();
		printf("efbBlitToScreen\n");
		efbBlitToScreen(efbD, buffers[currentBuffer]->ptr,efbBuffers[0]);
		efbWaitForBlit(efbD);
		printf("flip\n");
		u64 afterBlit=sys_time_get_system_time();
		flip(currentBuffer); // Flip buffer onto screen
		printf("currentBuffer\n");
		u64 afterFlip=sys_time_get_system_time();
		currentBuffer = !currentBuffer; 
		frame++;
		//if(frame>4)
		//	break;

		u64 padTime=afterPad-frameStart;
		u64 blitFlipWaitTime=afterWaitForBlit-afterPad;
		u64 flipWaitTime=afterWaitFlip-afterWaitForBlit;
		u64 drawTime=afterDraw-afterWaitFlip;
		u64 blitTime=afterBlit-afterDraw;
		u64 flipTime=afterFlip-afterBlit;
		u64 totalTime=afterFlip-frameStart;

		printf("%9ld, %9ld, %9ld, %9ld, %9ld, %9ld, %9ld\n",padTime,blitFlipWaitTime,flipWaitTime,drawTime,blitTime,flipTime,totalTime);
		//break;
	}
	efbShutdown(efbD);
	return 0;
}
示例#12
0
unsigned int PS3Graphics::TimeSinceLastDraw()
{
	return abs(sys_time_get_system_time() - last_redraw);
}