void CPlay::time (int64_t t) { // // t = time elapsed to run CPlay::eval (..) // // // average recent eval times to prevent a one off long // eval (eg., disk access by another program ) spoil the // smooth motion. // int64_t t0 = clock64 (); if (numRecentEvals == MAX_RECENT_EVALS) { recentEvalTimes.pop_front (); --numRecentEvals; } recentEvalTimes.push_back (t); ++numRecentEvals; int64_t sumRecentEvalTime = 0; for (ListOfInt64Iterator iter = recentEvalTimes.begin (), jter = recentEvalTimes.end (); iter != jter; ++iter) sumRecentEvalTime += *iter; adjustedEvalTime += (sumRecentEvalTime / numRecentEvals); // cout << "adjusted = " << adjustedEvalTime << endl; CLoop::time (t + clock64() - t0); }
__device__ void stop() { if(intervall >= 0 && intervall < numberOfIntervalls) { unsigned long long diff = clock64() - currentTime; __syncthreads(); atomicAdd(&counter[intervall].avg, diff); atomicMin(&counter[intervall].min, diff); atomicMax(&counter[intervall].max, diff); atomicAdd(&counter[intervall].iter, 1); intervall++; __syncthreads(); currentTime = clock64(); } }
void CTextField::draw () { static const int64_t ct = CGameDevice::CLOCKS_PER_SECOND >> 1; int64_t dt = clock64() - t; if (dt > ct) { showCursor = !showCursor; t = clock64 (); } const CBox& loc = getLocation (); glColor3f (0.75, 0.75, 0.75); CGameDevice::drawString (text, loc.left, loc.bottom); if (isSelected() && showCursor) { int left = loc.left + (int) (CGameDevice::stringWidth (text) + 0.5) + 1; glBegin (GL_LINES); glVertex3f (left, loc.bottom, 0); glVertex3f (left, loc.top, 0); glEnd (); } }
void CTextField::init () { CButton::init (); showCursor = false; t = clock64 (); }
__device__ void start() { intervall = 0; currentTime = clock64(); }
__device__ long long java_lang_System_nanoTime(int * exception){ return (long long) clock64(); }