这篇教程C++ time_update函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中time_update函数的典型用法代码示例。如果您正苦于以下问题:C++ time_update函数的具体用法?C++ time_update怎么用?C++ time_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了time_update函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: time_updatebool LoggingDeadline::End() { endCalled_ = true; time_update(); if (time_now_d() > endTime_) { double late = (time_now_d() - endTime_); double totalTime = late + totalTime_; ELOG("===== %0.2fms DEADLINE PASSED FOR %s at %0.2fms - %0.2fms late =====", totalTime_ * 1000.0, name_, 1000.0 * totalTime, 1000.0 * late); return false; } return true;}
开发者ID:arunrvk,项目名称:native,代码行数:11,
示例2: Drawbool Game::run(void){ newdraw = new Draw(screenx, screeny); newlogic = new Logic(newdraw, screenx, screeny); newdraw->create_background(tile_route, ' '); newdraw->create_background(tile_wall, '#'); newdraw->create_sprite(sprite_player, 1); newdraw->create_sprite(sprite_enemy, 2); newdraw->create_sprite(sprite_fireball, '*'); newdraw->create_sprite(sprite_sword, '%'); if(player_class == 0) player = new Mage(newdraw, newlogic, 0); else if(player_class == 1) player = new Warrior(newdraw, newlogic, 0); newlogic->draw(); //draw the map newlogic->add_player(player); newlogic->add_num_enemy(enemy_num); player->move(0,0); posx = 0; char key = ' '; start_time = timeGetTime(); end_time = 0; frame = 0; while(key != 'q' && !over) { while(!get_input(&key) && !over) { time_update(); if(newlogic->enemy.size() == 1) //win over = 1; else if(player->getlive() == 0) //lose over = 2; } player->key_press(key); } delete player; delete newlogic; delete newdraw; system("cls");// std::cout << 1000*frame/(timeGetTime() - start_time) << " fps" << std::endl; if(over == 1) std::cout << "You Win" << std::endl; else if(over == 2) std::cout << "Game End" << std::endl; return true;}
开发者ID:hanchen123,项目名称:first-c-game,代码行数:54,
示例3: asc_process_flushallstatic voidasc_process_flushall(struct conn *c, struct token *token, int ntoken){ struct bound *t = &ntoken_bound[REQ_FLUSHALL]; int32_t exptime_int; time_t exptime; time_update(); asc_set_noreply_maybe(c, token, ntoken); if (!asc_ntoken_valid(c, ntoken)) { log_hexdump(LOG_NOTICE, c->req, c->req_len, "client error on c %d for " "req of type %d with %d invalid tokens", c->sd, c->req_type, ntoken); asc_write_client_error(c); return; } if (ntoken == t->b[c->noreply].min) { settings.oldest_live = time_now() - 1; item_flush_expired(); asc_write_ok(c); return; } if (!mc_strtol(token[TOKEN_SUBCOMMAND].val, &exptime_int)) { log_debug(LOG_NOTICE, "client error on c %d for req of type %d with " "invalid numeric value '%.*s'", c->sd, c->req_type, token[TOKEN_SUBCOMMAND].len, token[TOKEN_SUBCOMMAND].val); asc_write_client_error(c); return; } exptime = (time_t)exptime_int; /* * If exptime is zero time_reltime() would return zero too, and * time_reltime(exptime) - 1 would overflow to the max unsigned value. * So we process exptime == 0 the same way we do when no delay is * given at all. */ if (exptime > 0) { settings.oldest_live = time_reltime(exptime) - 1; } else { /* exptime == 0 */ settings.oldest_live = time_now() - 1; } item_flush_expired(); asc_write_ok(c);}
开发者ID:GuoJing,项目名称:twemcache,代码行数:54,
示例4: Core_RunLoopvoid Core_RunLoop(){ while (!coreState) { time_update(); double startTime = time_now_d(); UpdateScreenScale(); { {#ifdef _WIN32 lock_guard guard(input_state.lock); input_state.pad_buttons = 0; input_state.pad_lstick_x = 0; input_state.pad_lstick_y = 0; input_state.pad_rstick_x = 0; input_state.pad_rstick_y = 0; // Temporary hack. if (GetAsyncKeyState(VK_ESCAPE)) { input_state.pad_buttons |= PAD_BUTTON_MENU; } host->PollControllers(input_state); UpdateInputState(&input_state);#endif } NativeUpdate(input_state); EndInputState(&input_state); } NativeRender(); time_update(); // Simple throttling to not burn the GPU in the menu.#ifdef _WIN32 if (globalUIState != UISTATE_INGAME) { double sleepTime = 16.666 - (time_now_d() - startTime) * 1000.0; if (sleepTime > 0.0) Sleep((int)sleepTime); GL_SwapBuffers(); } else if (!Core_IsStepping()) { GL_SwapBuffers(); }#endif }}
开发者ID:Bennieboj,项目名称:ppsspp,代码行数:41,
示例5: Java_org_ppsspp_ppsspp_NativeRenderer_displayRenderextern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayRender(JNIEnv *env, jobject obj) { static bool hasSetThreadName = false; if (!hasSetThreadName) { hasSetThreadName = true; setCurrentThreadName("AndroidRender"); } if (renderer_inited) { // TODO: Look into if these locks are a perf loss { lock_guard guard(input_state.lock); input_state.pad_lstick_x = left_joystick_x_async; input_state.pad_lstick_y = left_joystick_y_async; input_state.pad_rstick_x = right_joystick_x_async; input_state.pad_rstick_y = right_joystick_y_async; UpdateInputState(&input_state); } NativeUpdate(input_state); { lock_guard guard(input_state.lock); EndInputState(&input_state); } NativeRender(); time_update(); } else { ELOG("BAD: Ended up in nativeRender even though app has quit.%s", ""); // Shouldn't really get here. Let's draw magenta. glDepthMask(GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearColor(1.0, 0.0, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } lock_guard guard(frameCommandLock); while (!frameCommands.empty()) { FrameCommand frameCmd; frameCmd = frameCommands.front(); frameCommands.pop(); DLOG("frameCommand %s %s", frameCmd.command.c_str(), frameCmd.params.c_str()); jstring cmd = env->NewStringUTF(frameCmd.command.c_str()); jstring param = env->NewStringUTF(frameCmd.params.c_str()); env->CallVoidMethod(obj, postCommand, cmd, param); env->DeleteLocalRef(cmd); env->DeleteLocalRef(param); }}
开发者ID:jrancher,项目名称:ppsspp,代码行数:52,
示例6: Core_RunLoopvoid Core_RunLoop(){ while (!coreState) { time_update(); double startTime = time_now_d(); UpdateScreenScale(); { {#ifdef _WIN32 lock_guard guard(input_state.lock); input_state.pad_buttons = 0; input_state.pad_lstick_x = 0; input_state.pad_lstick_y = 0; input_state.pad_rstick_x = 0; input_state.pad_rstick_y = 0; host->PollControllers(input_state); UpdateInputState(&input_state);#endif } NativeUpdate(input_state); EndInputState(&input_state); } NativeRender(); time_update(); // Simple throttling to not burn the GPU in the menu.#ifdef _WIN32 if (globalUIState != UISTATE_INGAME) { double diffTime = time_now_d() - startTime; int sleepTime = (int) (1000000.0 / 60.0) - (int) (diffTime * 1000000.0); if (sleepTime > 0) Sleep(sleepTime / 1000); GL_SwapBuffers(); } else if (!Core_IsStepping()) { GL_SwapBuffers(); }#endif }}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:38,
示例7: QDialogWorldSyncMetronome::WorldSyncMetronome(QWidget *parent) : QDialog(parent){ ui.setupUi(this); bpm = ui.bpm_spinbox->value(); meter = ui.meter_spinbox->value(); anchor = ui.anchor_timeEdit->time(); sound = ui.sound_checkBox->isChecked(); QTimer *updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(time_update())); updateTimer->start(10);}
开发者ID:alpo,项目名称:world-sync-metronome,代码行数:14,
示例8: CheckRewindStatestatic inline void CheckRewindState(){ if (gpuStats.numFlips % g_Config.iRewindFlipFrequency != 0) return; // For fast-forwarding, otherwise they may be useless and too close. time_update(); float diff = time_now() - rewindLastTime; if (diff < rewindMaxWallFrequency) return; rewindLastTime = time_now(); rewindStates.Save();}
开发者ID:tpunix,项目名称:ppsspp,代码行数:14,
示例9: DoFrameIdleTimingstatic void DoFrameIdleTiming() { PROFILE_THIS_SCOPE("timing"); if (!FrameTimingThrottled() || !g_Config.bEnableSound || wasPaused) { return; } time_update(); double dist = time_now_d() - lastFrameTime; // Ignore if the distance is just crazy. May mean wrap or pause. if (dist < 0.0 || dist >= 15 * timePerVblank) { return; } float scaledVblank = timePerVblank; if (PSP_CoreParameter().fpsLimit == FPS_LIMIT_CUSTOM) { // 0 is handled in FrameTimingThrottled(). scaledVblank *= 60.0f / g_Config.iFpsLimit; } // If we have over at least a vblank of spare time, maintain at least 30fps in delay. // This prevents fast forward during loading screens. const double thresh = lastFrameTime + (numVBlanksSinceFlip - 1) * scaledVblank; if (numVBlanksSinceFlip >= 2 && time_now_d() < thresh) { // Give a little extra wiggle room in case the next vblank does more work. const double goal = lastFrameTime + numVBlanksSinceFlip * scaledVblank - 0.001; while (time_now_d() < goal) {#ifdef _WIN32 sleep_ms(1);#else const double left = goal - time_now_d(); usleep((long)(left * 1000000));#endif time_update(); } }}
开发者ID:RisingFog,项目名称:ppsspp,代码行数:37,
示例10: CalculateFPSvoid CalculateFPS(){ time_update(); double now = time_now_d(); if (now >= lastFpsTime + 1.0) { fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime); if (fps > highestFps) highestFps = fps; lastFpsFrame = gpuStats.numFrames; lastFpsTime = now; }}
开发者ID:B1ackDaemon,项目名称:ppsspp,代码行数:15,
示例11: UpdateRunLoopAndroidvoid UpdateRunLoopAndroid(JNIEnv *env) { NativeUpdate(); NativeRender(graphicsContext); time_update(); std::lock_guard<std::mutex> guard(frameCommandLock); if (!nativeActivity) { while (!frameCommands.empty()) frameCommands.pop(); return; } // Still under lock here. ProcessFrameCommands(env);}
开发者ID:animaonline,项目名称:ppsspp,代码行数:15,
示例12: Java_com_henrikrydgard_libnative_NativeRenderer_displayRenderextern "C" void Java_com_henrikrydgard_libnative_NativeRenderer_displayRender(JNIEnv *env, jobject obj) { // Too spammy // ILOG("NativeApp.displayRender()"); if (renderer_inited) { // TODO: Look into if these locks are a perf loss { lock_guard guard(input_state.lock); pad_buttons_down |= pad_buttons_async_set; pad_buttons_down &= ~pad_buttons_async_clear; input_state.pad_buttons = pad_buttons_down; KeyQueueCopyQueue(key_queue_async, input_state.key_queue); UpdateInputState(&input_state); } { lock_guard guard(input_state.lock); input_state.pad_lstick_x = left_joystick_x_async; input_state.pad_lstick_y = left_joystick_y_async; } NativeUpdate(input_state); { lock_guard guard(input_state.lock); EndInputState(&input_state); } NativeRender(); time_update(); } else { ELOG("BAD: Ended up in nativeRender even though app has quit.%s", ""); // Shouldn't really get here. Let's draw magenta. glstate.depthWrite.set(GL_TRUE); glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearColor(1.0, 0.0, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } if (!frameCommand.empty()) { ILOG("frameCommand %s %s", frameCommand.c_str(), frameCommandParam.c_str()); jstring cmd = env->NewStringUTF(frameCommand.c_str()); jstring param = env->NewStringUTF(frameCommandParam.c_str()); env->CallVoidMethod(obj, postCommand, cmd, param); frameCommand = ""; frameCommandParam = ""; }}
开发者ID:daniel-dressler,项目名称:native,代码行数:48,
示例13: _server_evwaitstatic rstatus_i_server_evwait(void){ int n; n = event_wait(ctx->evb, ctx->timeout); if (n < 0) { return n; } INCR(server_metrics, server_event_loop); INCR_N(server_metrics, server_event_total, n); time_update(); return CC_OK;}
开发者ID:sagar0,项目名称:pelikan,代码行数:16,
示例14: Java_org_ppsspp_ppsspp_NativeRenderer_displayRender// JavaEGLextern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayRender(JNIEnv *env, jobject obj) { static bool hasSetThreadName = false; if (!hasSetThreadName) { hasSetThreadName = true; setCurrentThreadName("AndroidRender"); } if (renderer_inited) { // TODO: Look into if these locks are a perf loss { lock_guard guard(input_state.lock); input_state.pad_lstick_x = left_joystick_x_async; input_state.pad_lstick_y = left_joystick_y_async; input_state.pad_rstick_x = right_joystick_x_async; input_state.pad_rstick_y = right_joystick_y_async; UpdateInputState(&input_state); } NativeUpdate(input_state); { lock_guard guard(input_state.lock); EndInputState(&input_state); } NativeRender(graphicsContext); time_update(); } else { ELOG("BAD: Ended up in nativeRender even though app has quit.%s", ""); // Shouldn't really get here. Let's draw magenta. // TODO: Should we have GL here? glDepthMask(GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearColor(1.0, 0.0, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } lock_guard guard(frameCommandLock); if (!nativeActivity) { while (!frameCommands.empty()) frameCommands.pop(); return; } ProcessFrameCommands(env);}
开发者ID:njh08d,项目名称:ppsspp,代码行数:48,
示例15: service_zoom_leftvoid service_zoom_left(GtkWidget *text, gpointer data){GtkAdjustment *hadj;if(GLOBALS->helpbox_is_active) { help_text_bold("/n/nZoom To Start"); help_text( " is used to jump scroll to the trace's beginning." ); return; }hadj=GTK_ADJUSTMENT(GLOBALS->wave_hslider);hadj->value=GLOBALS->tims.timecache=GLOBALS->tims.first;time_update();}
开发者ID:Pidbip,项目名称:egtkwave,代码行数:17,
示例16: update_handlervoid update_handler( void ){ static int pulse_area; static int pulse_mobile; static int pulse_violence; static int pulse_point; static int pulse_room; struct timeval start; gettimeofday( &start, NULL ); event_update( ); delete_list( extracted ); if( --pulse_area <= 0 ) { pulse_area = number_range( PULSE_AREA/2, 3*PULSE_AREA/2 ); area_update( ); } if( --pulse_mobile <= 0 ) { pulse_mobile = PULSE_MOBILE; action_update( ); auction_update( ); regen_update( ); time_update( ); } if( --pulse_point <= 0 ) { pulse_point = number_range( PULSE_TICK/2, 3*PULSE_TICK/2 ); char_update( ); obj_update( ); } if( --pulse_room <= 0 ) { pulse_room = number_range( PULSE_ROOM/2, 3*PULSE_ROOM/2 ); room_update( ); w3_who( ); } if( --pulse_violence <= 0 ) { pulse_violence = PULSE_VIOLENCE; update_queue( ); } pulse_time[ TIME_UPDATE ] = stop_clock( start ); }
开发者ID:thefightingferret,项目名称:tfe-1.0,代码行数:46,
示例17: test_casvoidtest_cas(uint32_t policy){#define KEY "key"#define VAL "value"#define VAL2 "value2" struct bstring key; struct val val; rstatus_i status; struct item *it; uint64_t cas1, cas2; test_reset(policy, true); key.data = KEY; key.len = sizeof(KEY) - 1; val.type = VAL_TYPE_STR; val.vstr.data = VAL; val.vstr.len = sizeof(VAL) - 1; time_update(); status = cuckoo_insert(&key, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); it = cuckoo_get(&key); cas1 = item_cas(it); ck_assert_uint_ne(cas1, 0); val.vstr.data = VAL2; val.vstr.len = sizeof(VAL2) - 1; status = cuckoo_update(it, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_update not OK - return status %d", status); it = cuckoo_get(&key); cas2 = item_cas(it); ck_assert_uint_ne(cas2, 0); ck_assert_uint_ne(cas1, cas2);#undef KEY#undef VAL#undef VAL2}
开发者ID:adityamarella,项目名称:pelikan,代码行数:45,
示例18: Java_com_henrikrydgard_libnative_NativeRenderer_displayRenderextern "C" void Java_com_henrikrydgard_libnative_NativeRenderer_displayRender(JNIEnv *env, jobject obj) { if (renderer_inited) { // TODO: Look into if these locks are a perf loss { lock_guard guard(input_state.lock); input_state.pad_lstick_x = left_joystick_x_async; input_state.pad_lstick_y = left_joystick_y_async; input_state.pad_rstick_x = right_joystick_x_async; input_state.pad_rstick_y = right_joystick_y_async; UpdateInputState(&input_state); } NativeUpdate(input_state); { lock_guard guard(input_state.lock); EndInputState(&input_state); } NativeRender(); time_update(); } else { ELOG("BAD: Ended up in nativeRender even though app has quit.%s", ""); // Shouldn't really get here. Let's draw magenta. glstate.depthWrite.set(GL_TRUE); glstate.colorMask.set(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearColor(1.0, 0.0, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } lock_guard guard(frameCommandLock); while (!frameCommands.empty()) { FrameCommand frameCmd; frameCmd = frameCommands.front(); frameCommands.pop(); DLOG("frameCommand %s %s", frameCmd.command.c_str(), frameCmd.params.c_str()); jstring cmd = env->NewStringUTF(frameCmd.command.c_str()); jstring param = env->NewStringUTF(frameCmd.params.c_str()); env->CallVoidMethod(obj, postCommand, cmd, param); }}
开发者ID:Bigpet,项目名称:native,代码行数:44,
示例19: test_insert_collisionvoidtest_insert_collision(uint32_t policy, bool cas){ struct bstring key; struct val val; rstatus_i status; struct item *it; int hits = 0; char keystring[CC_UINTMAX_MAXLEN]; uint64_t i, testval; test_reset(policy, cas); time_update(); for (i = 0; i < CUCKOO_NITEM + 1; i++) { key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; val.type = VAL_TYPE_INT; val.vint = i; status = cuckoo_insert(&key, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); } for (i = 0; i < CUCKOO_NITEM + 1; i++) { key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; it = cuckoo_get(&key); if (it == NULL) { continue; } hits++; ck_assert_int_eq(it->klen, key.len); testval = item_value_int(it); ck_assert_int_eq(testval, i); } ck_assert_msg(hits > (double)CUCKOO_NITEM * 9 / 10, "hit rate is lower than expected when hash collision occurs"); ck_assert_msg(hits <= CUCKOO_NITEM, "hit rate is too high, expected more evicted values");}
开发者ID:adityamarella,项目名称:pelikan,代码行数:43,
示例20: CalculateFPSvoid CalculateFPS(){ time_update(); double now = time_now_d(); if (now >= lastFpsTime + 1.0) { double frames = (gpuStats.numVBlanks - lastFpsFrame); fps = frames / (now - lastFpsTime); flips = 60.0 * (double) (gpuStats.numFlips - lastNumFlips) / frames; lastFpsFrame = gpuStats.numVBlanks; lastNumFlips = gpuStats.numFlips; lastFpsTime = now; fpsHistory[fpsHistoryPos++] = fps; fpsHistoryPos = fpsHistoryPos % ARRAY_SIZE(fpsHistory); ++fpsHistoryValid; }}
开发者ID:hemingke,项目名称:ppsspp,代码行数:20,
示例21: calculateFPSfloat calculateFPS(){ static double highestFps = 0.0; static int lastFpsFrame = 0; static double lastFpsTime = 0.0; static double fps = 0.0; time_update(); double now = time_now_d(); if (now >= lastFpsTime + 1.0) { fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime); if (fps > highestFps) highestFps = fps; lastFpsFrame = gpuStats.numFrames; lastFpsTime = now; } return fps;}
开发者ID:rasyid-irsyadi,项目名称:ppsspp,代码行数:21,
示例22: service_right_pagevoidservice_right_page(GtkWidget *text, gpointer data){ TimeType ntinc, ntfrac; if(GLOBALS->helpbox_is_active) { help_text_bold("/n/nPage Right"); help_text( " scrolls the display window right one page worth of data." " The net action is that the data scrolls left a page."#ifdef WAVE_USE_GTK2 " Scrollwheel Down also hits this button in non-alternative wheel mode."#endif ); return; } ntinc=(TimeType)(((gdouble)GLOBALS->wavewidth)*GLOBALS->nspx); ntfrac=ntinc*GLOBALS->page_divisor; if((ntfrac<1)||(ntinc<1)) ntfrac=ntinc=1; if((GLOBALS->tims.start+ntfrac)<(GLOBALS->tims.last-ntinc+1)) { GLOBALS->tims.timecache=GLOBALS->tims.start+ntfrac; } else { GLOBALS->tims.timecache=GLOBALS->tims.last-ntinc+1; if(GLOBALS->tims.timecache<GLOBALS->tims.first) GLOBALS->tims.timecache=GLOBALS->tims.first; } GTK_ADJUSTMENT(GLOBALS->wave_hslider)->value=GLOBALS->tims.timecache; time_update(); DEBUG(printf("Right Page/n"));}
开发者ID:Pidbip,项目名称:egtkwave,代码行数:40,
示例23: test_delete_basicvoidtest_delete_basic(uint32_t policy, bool cas){#define KEY "key"#define VAL "value" struct bstring key; struct val val; rstatus_i status; struct item *it; bool deleted; test_reset(policy, cas); key.data = KEY; key.len = sizeof(KEY) - 1; val.type = VAL_TYPE_STR; val.vstr.data = VAL; val.vstr.len = sizeof(VAL) - 1; time_update(); status = cuckoo_insert(&key, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); it = cuckoo_get(&key); ck_assert_msg(it != NULL, "cuckoo_get returned NULL"); deleted = cuckoo_delete(&key); ck_assert_msg(deleted, "cuckoo_delete return false"); it = cuckoo_get(&key); ck_assert_msg(it == NULL, "cuckoo_get returned not NULL"); deleted = cuckoo_delete(&key); ck_assert_msg(!deleted, "cuckoo_delete return true");#undef KEY#undef VAL}
开发者ID:adityamarella,项目名称:pelikan,代码行数:39,
示例24: kernel_mainintkernel_main (void) { //attach stdin and stdout serial_startup(); printf("*****************************************/n"); printf("kernel_main()/n"); //any setup functions that need to be called? timer_setup(); /* The main processing loop */ while (1) { serial_poll(); clock_update(); time_update(); if (task_spin() < 0) { //print_func("task error. Restarting/n"); } }}
开发者ID:TomDoug,项目名称:AOS,代码行数:23,
示例25: service_zoom_rightvoid service_zoom_right(GtkWidget *text, gpointer data){GtkAdjustment *hadj;TimeType ntinc;if(GLOBALS->helpbox_is_active) { help_text_bold("/n/nZoom To End"); help_text( " is used to jump scroll to the trace's end." ); return; }ntinc=(TimeType)(((gdouble)GLOBALS->wavewidth)*GLOBALS->nspx);GLOBALS->tims.timecache=GLOBALS->tims.last-ntinc+1; if(GLOBALS->tims.timecache<GLOBALS->tims.first) GLOBALS->tims.timecache=GLOBALS->tims.first;hadj=GTK_ADJUSTMENT(GLOBALS->wave_hslider);hadj->value=GLOBALS->tims.timecache;time_update();}
开发者ID:Pidbip,项目名称:egtkwave,代码行数:23,
示例26: CalculateFPSvoid CalculateFPS(){ static double highestFps = 0.0; static int lastFpsFrame = 0; static double lastFpsTime = 0.0; static double fps = 0.0; time_update(); double now = time_now_d(); if (now >= lastFpsTime + 1.0) { fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime); if (fps > highestFps) highestFps = fps; lastFpsFrame = gpuStats.numFrames; lastFpsTime = now; } char stats[50]; sprintf(stats, "VPS: %0.1f", fps); #ifdef USING_GLES2 float zoom = 0.7f; /// g_Config.iWindowZoom; float soff = 0.7f; #else float zoom = 0.5f; /// g_Config.iWindowZoom; float soff = 0.5f; #endif PPGeBegin(); PPGeDrawText(stats, 476 + soff, 4 + soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476 + -soff, 4 -soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476, 4, PPGE_ALIGN_RIGHT, zoom, 0xFF30FF30); PPGeEnd();}
开发者ID:foreveralive,项目名称:ppsspp,代码行数:36,
示例27: timerstatic void timer(param, psize)/*ARGSUSED*/{ static int watch_count; for (;;) { sleep(60); time_update(); /* We must keep the time, which is stored with the directory entries * consistent among the members. Otherwise programs like 'make' might * be confused. */ broadcast_time(); if ((watch_count++ % WATCHDOG_INTERVAL) == 0) { if (dirsvr_functioning()) { MON_EVENT("watchdog"); sp_begin(); watchdog(); /* which calls sp_end() */ } } }}
开发者ID:yeonsh,项目名称:Amoeba,代码行数:24,
示例28: time_updatebool GPUCommon::InterpretList(DisplayList &list) { // Initialized to avoid a race condition with bShowDebugStats changing. double start = 0.0; if (g_Config.bShowDebugStats) { time_update(); start = time_now_d(); } easy_guard guard(listLock); // TODO: This has to be right... but it freezes right now? //if (list.state == PSP_GE_DL_STATE_PAUSED) // return false; currentList = &list; // I don't know if this is the correct place to zero this, but something // need to do it. See Sol Trigger title screen. // TODO: Maybe this is per list? Should a stalled list remember the old value? gstate_c.offsetAddr = 0; if (!Memory::IsValidAddress(list.pc)) { ERROR_LOG_REPORT(G3D, "DL PC = %08x WTF!!!!", list.pc); return true; }#if defined(USING_QT_UI) if (host->GpuStep()) { host->SendGPUStart(); }#endif cycleLastPC = list.pc; downcount = list.stall == 0 ? 0x0FFFFFFF : (list.stall - list.pc) / 4; list.state = PSP_GE_DL_STATE_RUNNING; list.interrupted = false; gpuState = list.pc == list.stall ? GPUSTATE_STALL : GPUSTATE_RUNNING; guard.unlock(); const bool dumpThisFrame = dumpThisFrame_; // TODO: Add check for displaylist debugger. const bool useFastRunLoop = !dumpThisFrame; while (gpuState == GPUSTATE_RUNNING) { { easy_guard innerGuard(listLock); if (list.pc == list.stall) { gpuState = GPUSTATE_STALL; downcount = 0; } } if (useFastRunLoop) { FastRunLoop(list); } else { SlowRunLoop(list); } { easy_guard innerGuard(listLock); downcount = list.stall == 0 ? 0x0FFFFFFF : (list.stall - list.pc) / 4; if (gpuState == GPUSTATE_STALL && list.stall != list.pc) { // Unstalled. gpuState = GPUSTATE_RUNNING; } } } // We haven't run the op at list.pc, so it shouldn't count. if (cycleLastPC != list.pc) { UpdatePC(list.pc - 4, list.pc); } if (g_Config.bShowDebugStats) { time_update(); gpuStats.msProcessingDisplayLists += time_now_d() - start; } return gpuState == GPUSTATE_DONE || gpuState == GPUSTATE_ERROR;}
开发者ID:Bulkman,项目名称:ppsspp,代码行数:79,
示例29: main//.........这里部分代码省略......... if (strncmp(SDL_JoystickName(i), "nub0", 4) == 0) ljoy=SDL_JoystickOpen(i); if (strncmp(SDL_JoystickName(i), "nub1", 4) == 0) rjoy=SDL_JoystickOpen(i); }#endif int framecount = 0; bool nextFrameMD = 0; float t = 0, lastT = 0; while (true) { input_state.accelerometer_valid = false; input_state.mouse_valid = true; int quitRequested = 0; SDL_Event event; while (SDL_PollEvent(&event)) { float mx = event.motion.x * dp_xscale; float my = event.motion.y * dp_yscale; if (event.type == SDL_QUIT) { quitRequested = 1; } else if (event.type == SDL_KEYDOWN) { if (event.key.keysym.sym == SDLK_ESCAPE) { quitRequested = 1; } } else if (event.type == SDL_MOUSEMOTION) { input_state.pointer_x[0] = mx; input_state.pointer_y[0] = my; NativeTouch(0, mx, my, 0, TOUCH_MOVE); } else if (event.type == SDL_MOUSEBUTTONDOWN) { if (event.button.button == SDL_BUTTON_LEFT) { //input_state.mouse_buttons_down = 1; input_state.pointer_down[0] = true; nextFrameMD = true; NativeTouch(0, mx, my, 0, TOUCH_DOWN); } } else if (event.type == SDL_MOUSEBUTTONUP) { if (event.button.button == SDL_BUTTON_LEFT) { input_state.pointer_down[0] = false; nextFrameMD = false; //input_state.mouse_buttons_up = 1; NativeTouch(0, mx, my, 0, TOUCH_UP); } } } if (quitRequested) break; const uint8 *keys = (const uint8 *)SDL_GetKeyState(NULL); if (keys[SDLK_ESCAPE]) break; SimulateGamepad(keys, &input_state); UpdateInputState(&input_state); NativeUpdate(input_state); NativeRender(); EndInputState(&input_state); if (framecount % 60 == 0) { // glsl_refresh(); // auto-reloads modified GLSL shaders once per second. }#ifdef EGL eglSwapBuffers(g_eglDisplay, g_eglSurface);#else if (!keys[SDLK_TAB] || t - lastT >= 1.0/60.0) { SDL_GL_SwapBuffers(); lastT = t; }#endif // Simple frame rate limiting// while (time_now() < t + 1.0f/60.0f) {// sleep_ms(0);// time_update();// } time_update(); t = time_now(); framecount++; } // Faster exit, thanks to the OS. Remove this if you want to debug shutdown // The speed difference is only really noticable on Linux. On Windows you do notice it though#ifdef _WIN32 exit(0);#endif NativeShutdownGraphics(); SDL_PauseAudio(1); SDL_CloseAudio(); NativeShutdown();#ifdef EGL EGL_Close();#endif SDL_Quit(); net::Shutdown(); exit(0); return 0;}
开发者ID:PeterTh,项目名称:native,代码行数:101,
注:本文中的time_update函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ timecounter_init函数代码示例 C++ time_type函数代码示例 |