void AdvancedThresholdPolicy::initialize() { // Turn on ergonomic compiler count selection if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) { FLAG_SET_DEFAULT(CICompilerCountPerCPU, true); } int count = CICompilerCount; if (CICompilerCountPerCPU) { // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n int log_cpu = log2_intptr(os::active_processor_count()); int loglog_cpu = log2_intptr(MAX2(log_cpu, 1)); count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2; } set_c1_count(MAX2(count / 3, 1)); set_c2_count(MAX2(count - count / 3, 1)); // Some inlining tuning #ifdef X86 if (FLAG_IS_DEFAULT(InlineSmallCode)) { FLAG_SET_DEFAULT(InlineSmallCode, 2000); } #endif #ifdef SPARC if (FLAG_IS_DEFAULT(InlineSmallCode)) { FLAG_SET_DEFAULT(InlineSmallCode, 2500); } #endif set_start_time(os::javaTimeMillis()); }
GCMParams::GCMParams() : gcm_rank(-1), gcm_root(-1) { // Set a reasonable default initial value for start time. giss::time::tm const time_base(1900,1,1); set_start_time(time_base, -1); }
void Scene_Gang_Manager::tick(Time_Value &now) { if (ACTIVITY_CLOSE == this->switch_) { return ; } if (GANG_WAR_CREATE_16 == this->switch_) { if (stage() == 2) { index_ = 0; } match_arena_team(); last_match_time_ = now; this->switch_ = GANG_WAR_CREATE_16_END; } if (ACTIVITY_READY == this->switch_) { match_arena_team(); last_match_time_ = now; this->switch_ = ACTIVITY_MATCHED; } if (ACTIVITY_OPEN == this->switch_ && now - last_match_time_ > Time_Value(0)) { last_match_time_ = now; set_start_time(now); this->switch_ = ACTIVITY_FIGHT; } }
/* callback for the creation of a dialog. */ static void cdr_on_create( struct dlg_cell* dialog, int type, struct dlg_cb_params* params) { if( !dialog || !params || !params->req) { LM_ERR( "invalid values\n!"); return; } if( cdr_enable == 0) { return; } if( dlgb.register_dlgcb( dialog, DLGCB_CONFIRMED, cdr_on_start, 0, 0) != 0) { LM_ERR("can't register create dialog CONFIRM callback\n"); return; } if( dlgb.register_dlgcb( dialog, DLGCB_FAILED, cdr_on_failed, 0, 0) != 0) { LM_ERR("can't register create dialog FAILED callback\n"); return; } if( dlgb.register_dlgcb( dialog, DLGCB_TERMINATED, cdr_on_end, 0, 0) != 0) { LM_ERR("can't register create dialog TERMINATED callback\n"); return; } if( dlgb.register_dlgcb( dialog, DLGCB_TERMINATED_CONFIRMED, cdr_on_end_confirmed, 0, 0) != 0) { LM_ERR("can't register create dialog TERMINATED CONFIRMED callback\n"); return; } if( dlgb.register_dlgcb( dialog, DLGCB_EXPIRED, cdr_on_expired, 0, 0) != 0) { LM_ERR("can't register create dialog EXPIRED callback\n"); return; } if( dlgb.register_dlgcb( dialog, DLGCB_DESTROY, cdr_on_destroy, 0, 0) != 0) { LM_ERR("can't register create dialog DESTROY callback\n"); return; } LM_DBG("dialog '%p' created!", dialog); if( set_start_time( dialog) != 0) { LM_ERR( "failed to set start time"); return; } }
void profile_ops_start(nialptr entr) { struct node *childnode; childnode = current_node->children[find_child(current_node, entr)]; set_start_time(childnode, profile_time()); current_node = childnode; }
void GCStatInfo::copy_stat(GCStatInfo* stat) { set_index(stat->gc_index()); set_start_time(stat->start_time()); set_end_time(stat->end_time()); assert(_usage_array_size == stat->usage_array_size(), "Must have same array size"); for (int i = 0; i < _usage_array_size; i++) { set_before_gc_usage(i, stat->before_gc_usage_for_pool(i)); set_after_gc_usage(i, stat->after_gc_usage_for_pool(i)); } }
/* * Function: ri_timer_start * * Starts time recoding specified by *name*. * If the name specified by *name* doesn't been found in *timer*, * create new timerinfo_t named *name* into *timer*. * * Parameters: * * *timer - The pointer to ri_timer_t structure. * *name - The timer name to start. * * Returns: * * None. * */ void ri_timer_start(ri_timer_t *timer, const char *name) { timerinfo_t *p; ri_log_and_return_if(name == NULL); p = (timerinfo_t *)ri_hash_lookup(timer->entrylist, name); if (p == NULL) { /* there is no entry */ p = (timerinfo_t *)ri_mem_alloc(sizeof(timerinfo_t)); p->count = 0; p->elapsed = 0.0; p->name = strdup(name); set_start_time(p); ri_hash_insert(timer->entrylist, name, (void *)p); } else { set_start_time(p); } }
void isetprofile() { nialptr z; int tv, oldprofile = profile; /* old value of profiling switch */ z = apop(); if (kind(z) == inttype) tv = intval(z); else if (kind(z) == booltype) tv = boolval(z); else { buildfault("invalid arg to setprofile"); return; } if (tv && !oldprofile) { /* turning on profiling */ profile = true; if (newprofile) { inittime(); calltree = make_node(); current_node = calltree; /* initialize first node */ set_opid(calltree, 0); /* doesn't correspond to a defn */ set_start_time(calltree, profile_time()); /* nprintf(OF_DEBUG,"start time for call tree%f\n",calltree->start_time); */ swplace = 0; #ifdef OLD_BUILD_SYMBOL_TABLE build_symbol_table(); #endif newprofile = false; } } else if (oldprofile != false) { double lasttime = profile_time(); profile = false; if (current_node != calltree) { exit_cover(NC_PROFILE_SYNCH_W); } set_end_time(calltree, lasttime); add_time(calltree); } apush(createbool(oldprofile)); }
/* callback for a confirmed (INVITE) dialog. */ static void cdr_on_start( struct dlg_cell* dialog, int type, struct dlg_cb_params* params) { if( !dialog || !params) { LM_ERR("invalid values\n!"); return; } if( cdr_start_on_confirmed == 0) { return; } if( set_start_time( dialog) != 0) { LM_ERR( "failed to set start time!\n"); return; } }
Airplane::Airplane(const int cur_time, const int max_time) { set_start_time(cur_time); set_crash_time(cur_time - max_time); }
void connection_basic::do_send_handler_write_from_queue( const boost::system::error_code& e, size_t cb, int q_len ) { // No sleeping here; sleeping is done once and for all in connection<t_protocol_handler>::handle_write MTRACE("handler_write (after write, from queue="<<q_len<<") - before ASIO write, for packet="<<cb<<" B (after sleep)"); set_start_time(); }
void connection_basic::do_send_handler_write(const void* ptr , size_t cb ) { // No sleeping here; sleeping is done once and for all in connection<t_protocol_handler>::handle_write MTRACE("handler_write (direct) - before ASIO write, for packet="<<cb<<" B (after sleep)"); set_start_time(); }
// O primeiro parâmetro é o tamanho do vetor, e o segundo é o número de threads. int main(int argc, char *argv[]) { if (argc!=3) { printf("Número incorreto de parâmetros\n"); printf("Uso: ./<nome do programa> <ordem da matriz> <qtd. de threads>\n"); return 0; } int thread_quantity, sum, sum_thread=0, counter; int offset=0, partition_size; long int **matrix_copy; int_tuple *offset_vector; double time_main, time_thread; // Um vetor de pthreads permite a criação dinâmica de threads. pthread_t *thread_vector; sscanf(argv[1],"%d",&matrix_size); sscanf(argv[2],"%d",&thread_quantity); printf("Criando dados para as matrizes... "); thread_vector=(pthread_t*)malloc(sizeof(pthread_t)*thread_quantity); offset_vector=(int_tuple*)malloc(sizeof(int_tuple)*thread_quantity); partition_size=matrix_size/thread_quantity; partition_size--; for(counter=0; counter<thread_quantity-1; counter++) { offset_vector[counter].start=offset; offset=offset+partition_size; offset_vector[counter].end=offset; offset++; } offset_vector[thread_quantity-1].start=offset; offset_vector[thread_quantity-1].end=matrix_size-1; matrix_a=create_random_matrix(); matrix_b=create_random_matrix(); printf("feito.\n\n"); matrix_result=(long int**)malloc(sizeof(long int*)*matrix_size); for(counter=0; counter<matrix_size; counter++) matrix_result[counter]=(long int*)malloc(sizeof(long int)*matrix_size); printf("Iniciando as contas na função main().\n"); set_start_time(); multiply_matrix(); set_end_time(); time_main=end_time-start_time; printf("As contas na main() foram finalizadas.\n"); /* Aloca uma nova matriz para fazer uma cópia do resultado. * Isso é feito para saber se a multiplicação está igual. */ matrix_copy=(long int**)malloc(sizeof(long int*)*matrix_size); for(counter=0; counter<matrix_size; counter++) matrix_copy[counter]=(long int*)malloc(sizeof(long int)*matrix_size); for(counter=0; counter<matrix_size; counter++) { for(offset=0; offset<matrix_size; offset++) matrix_copy[counter][offset]=matrix_result[counter][offset]; } printf("\nIniciando as contas com %d threads.\n",thread_quantity); // Inicia as contas com as threads, assim como a marcação de tempo. set_start_time(); for(counter=0; counter<thread_quantity; counter++) pthread_create(thread_vector+counter,NULL,threaded_matrix_multiplier,(void*)(offset_vector+counter)); for(counter=0; counter<thread_quantity; counter++) pthread_join(thread_vector[counter],NULL); set_end_time(); time_thread=end_time-start_time; printf("As threads foram finalizadas.\n\n"); check_matrix_match(matrix_copy); printf("\n"); printf("Tempo na main(): %f segundos\n",time_main); printf("Tempo com threads: %f segundos\n",time_thread); //Libera tudo que foi alocado. free(thread_vector); free(offset_vector); for(counter=0; counter<matrix_size; counter++) { free(matrix_a[counter]); free(matrix_b[counter]); free(matrix_result[counter]); free(matrix_copy[counter]); } free(matrix_a); free(matrix_b); free(matrix_result); free(matrix_copy); return 0; }
void connection_basic::do_send_handler_write_from_queue( const boost::system::error_code& e, size_t cb, int q_len ) { sleep_before_packet(cb,2,q_len); _info_c("net/out/size", "handler_write (after write, from queue="<<q_len<<") - before ASIO write, for packet="<<cb<<" B (after sleep)"); set_start_time(); }
void connection_basic::do_send_handler_write(const void* ptr , size_t cb ) { sleep_before_packet(cb,1,-1); _info_c("net/out/size", "handler_write (direct) - before ASIO write, for packet="<<cb<<" B (after sleep)"); set_start_time(); }
void android_main(struct android_app *app) { //Making sure glue is not stripped app_dummy(); Engine engine(app); //We never leave this scope anyways app->userData = &engine; //Trying to get files to load. File_Utils::asset_mgr = app->activity->assetManager; //Setting start time as now (a reference point) set_start_time(); //==================================== #ifdef DEBUG_MODE LOGI("LIFECYCLE: ANDROID_MAIN RAN\n"); #endif //Reads saved data and writes saved data /* const char* data = File_Utils::read_savedata("test.dat"); LOGI("Read file: %s.\n",data); free((char*)data); File_Utils::write_savedata("test.dat");*/ float last_frame_time = 0.0; //run the engine loop while(1) { //Reading all pending events int ident; int events; struct android_poll_source *source; //When not animating: block waiting for events //When animating, handle all events then draw frame while((ident = ALooper_pollAll(engine.animating ? 0 : -1,NULL, &events,(void**) &source))>=0) { //Process event if(source != NULL) { source->process(app,source); } //Unused accelerometer update handling //If sensor has data, process it //if(ident == LOOPER_ID_USER) //{ // //if(engine.accelerometer_sensor != NULL) // //{ // ASensorEvent event; // while(ASensorEventQueue_getEvents(engine.sensor_event_queue,&event,1) > 0) // { // //do nothing // app_dummy(); // //LOGI("accelerometer: x=%f y=%f z=%f", event.acceleration.x, // // event.acceleration.y, event.acceleration.z); // } // //} //} //Check if exiting if(app->destroyRequested != 0) { #ifdef DEBUG_MODE LOGI("LIFECYCLE: Exiting application.\n"); #endif engine.last_frame(); return; } } if(engine.animating) { engine.draw_frame(); //No guarantees that the we're actually drawing until gl_initialized is 1 if(engine.gl_initialized) { //===== Temporary variable stuff ======= engine.state.angle += 0.01f; if(engine.state.angle > 1) { engine.state.angle = 0; } //====================================== //Drawing throttled by screen update rate, no timing code needed here static long frame = 0; //if(frame % 60 == 0) // LOGE("60 frames passed\n"); //LOGE("Frame: %ld, frame mod 60 = %ld\n",frame,(frame % 60)); frame++; float ctime = time(); engine.delta_time = ctime - last_frame_time; last_frame_time = ctime; //LOGE("delta_time = %f, last_frame_time = %f, avg fps = %f\n",delta_time, last_frame_time,frame/time()); } } } }