fsal_status_t FSAL_uint64_to_cookie(fsal_handle_t *handle, fsal_op_context_t *p_context, uint64_t *data, fsal_cookie_t *cookie) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); if (fsal_functions.fsal_uint64_to_cookie) { rc = fsal_functions.fsal_uint64_to_cookie(handle, data, cookie); } else { memset(cookie, 0, sizeof(fsal_cookie_t)); memcpy(cookie, data, sizeof(uint64_t)); ReturnCode(ERR_FSAL_NO_ERROR, 0); } timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
int main(int argc, char **argv) { timer_init(); ((void) argc); total = 0; rank = atoi(argv[0]); open_noc_connectors(); getwork(); start = timer_get(); friendly_numbers(); end = timer_get(); syncNumbers(); total = timer_diff(start, end); data_send(outfd, &total, sizeof(uint64_t)); /* Close channels. */ mppa_close(infd); mppa_close(outfd); mppa_exit(0); return (0); }
fsal_status_t FSAL_getattrs_descriptor(fsal_file_t * p_file_descriptor, /* IN */ fsal_handle_t * p_filehandle, /* IN */ fsal_op_context_t * p_context, /* IN */ fsal_attrib_list_t * p_object_attributes /* IN/OUT */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); if(fsal_functions.fsal_getattrs_descriptor != NULL && p_file_descriptor != NULL) { LogFullDebug(COMPONENT_FSAL, "FSAL_getattrs_descriptor calling fsal_getattrs_descriptor"); rc = fsal_functions.fsal_getattrs_descriptor(p_file_descriptor, p_filehandle, p_context, p_object_attributes); } else { LogFullDebug(COMPONENT_FSAL, "FSAL_getattrs_descriptor calling fsal_getattrs"); rc = fsal_functions.fsal_getattrs(p_filehandle, p_context, p_object_attributes); } timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_share_op( fsal_file_t * p_file_descriptor, /* IN */ fsal_handle_t * p_filehandle, /* IN */ fsal_op_context_t * p_context, /* IN */ void * p_owner, /* IN (opaque to FSAL) */ fsal_share_param_t request_share) /* IN */ { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); if(fsal_functions.fsal_share_op != NULL) rc = fsal_functions.fsal_share_op(p_file_descriptor, p_filehandle, p_context, p_owner, request_share); else Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_share_op); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_readdir(fsal_dir_t * p_dir_descriptor, /* IN */ fsal_op_context_t * p_context, /* IN */ fsal_cookie_t start_position, /* IN */ fsal_attrib_mask_t get_attr_mask, /* IN */ fsal_mdsize_t buffersize, /* IN */ fsal_dirent_t * p_pdirent, /* OUT */ fsal_cookie_t * p_end_position, /* OUT */ fsal_count_t * p_nb_entries, /* OUT */ fsal_boolean_t * p_end_of_dir /* OUT */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_readdir(p_dir_descriptor, p_context, start_position, get_attr_mask, buffersize, p_pdirent, p_end_position, p_nb_entries, p_end_of_dir); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
/* * Initializes the timer. */ void timer_init(void) { uint64_t start, end; start = timer_get(); end = timer_get(); timer_error = (end - start); }
void task_schedule(GameState *state, task_t *tasks, uint8_t num_tasks) { uint8_t i; timer_tick_t now; task_t *next_task; GameMode initial_mode = state->mode; timer_init(); now = timer_get(); /* Start by scheduling the first task. */ next_task = tasks; while (state->mode == initial_mode) { timer_tick_t sleep_min; /* Wait until the next task is ready to run. */ timer_wait_until (next_task->reschedule); /* Schedule the task. */ next_task->func (state); /* Update the reschedule time. */ next_task->reschedule += next_task->period; sleep_min = ~0; now = timer_get (); /* Search array of tasks. Schedule the first task (highest priority) that needs to run otherwise wait until first task ready. */ for (i = 0; i < num_tasks; i++) { task_t * task = tasks + i; timer_tick_t overrun; overrun = now - task->reschedule; if (overrun < TASK_OVERRUN_MAX) { /* Have found a task that can run immediately. */ next_task = task; break; } else { timer_tick_t sleep; sleep = -overrun; if (sleep < sleep_min) { sleep_min = sleep; next_task = task; } } } } }
/* * Runs benchmark. */ int main(int argc, char **argv) { int i; /* Loop index. */ double *mask; /* Mask. */ uint64_t end; /* End time. */ uint64_t start; /* Start time. */ unsigned char *img; /* Image. */ readargs(argc, argv); timer_init(); srandnum(seed); /* Benchmark initialization. */ if (verbose) printf("initializing...\n"); start = timer_get(); img = smalloc(p->imgsize*p->imgsize*sizeof(char)); for (i = 0; i < p->imgsize*p->imgsize; i++) img[i] = randnum() & 0xff; mask = smalloc(p->masksize*p->masksize*sizeof(double)); generate_mask(mask); end = timer_get(); if (verbose) printf(" time spent: %f\n", timer_diff(start, end)*MICROSEC); /* Apply filter. */ if (verbose) printf("applying filter...\n"); start = timer_get(); gauss_filter(img, p->imgsize, mask, p->masksize); end = timer_get(); total = timer_diff(start, end); /* Print timing statistics. */ printf("timing statistics:\n"); printf(" master: %f\n", master*MICROSEC); for (i = 0; i < nclusters; i++) printf(" slave %d: %f\n", i, slave[i]*MICROSEC); printf(" communication: %f\n", communication*MICROSEC); printf(" total time: %f\n", total*MICROSEC); /* House keeping. */ free(mask); free(img); return (0); }
fsal_status_t FSAL_InitClientContext(fsal_op_context_t * p_context) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_initclientcontext(p_context); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
void pulse_control_init(void) // Initialize servo pulse control. { // Initialize the pulse time values. pulse_flag = 0; pulse_duration = 0; overflow_count = 0; // Initialize the pulse time. pulse_time = timer_get(); // Set timer/counter2 control register A. TCCR2A = (0<<COM2A1) | (0<<COM2A0) | // Disconnect OC2A. (0<<COM2B1) | (0<<COM2B0) | // Disconnect OC2B. (0<<WGM21) | (0<<WGM20); // Mode 0 - normal operation. // Configure PCINT3 to interrupt on change. PCMSK0 = (1<<PCINT3); PCMSK1 = 0; PCMSK2 = 0; PCICR = (0<<PCIE2) | (0<<PCIE1) | (1<<PCIE0); // Configure PB0/PCINT3 as an input. DDRB &= ~(1<<DDB3); PORTB &= ~(1<<PB3); }
virtual void TearDown() { SC_closePort(fdin); Shakespeare::log(Shakespeare::NOTICE, PROCESS, ">>>>>>>>>>>>>>>>>>>>>> END TEST <<<<<<<<<<<<<<<<<<<<<<"); // start timer from call timer_t wait_timer = timer_get(); timer_start(&wait_timer,2,0); while (!timer_complete(&wait_timer)) { /* pause */ } }
fsal_status_t FSAL_closedir(fsal_dir_t * p_dir_descriptor, /* IN */ fsal_op_context_t * p_context /* IN */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_closedir(p_dir_descriptor, p_context); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
void busy_wait(unsigned int ds) { timer_enable(0); timer_set_reload(0); timer_set_counter(get_system_frequency()/10*ds); timer_enable(1); while(timer_get()); }
fsal_status_t FSAL_link_access(fsal_op_context_t * p_context, /* IN */ fsal_attrib_list_t * pattr) /* IN */ { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_link_access(p_context, pattr); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
/* * Runs benchmark. */ int main(int argc, char **argv) { int i; /* Loop index. */ int *a; /* Array to be sorted. */ uint64_t end; /* End time. */ uint64_t start; /* Start time. */ readargs(argc, argv); timer_init(); srandnum(seed); /* Benchmark initialization. */ if (verbose) printf("initializing...\n"); start = timer_get(); a = smalloc(p->n*sizeof(int)); for (i = 0; i < p->n; i++) a[i] = randnum() & 0xfffff; end = timer_get(); if (verbose) printf(" time spent: %f\n", timer_diff(start, end)*MICROSEC); /* Cluster data. */ if (verbose) printf("sorting...\n"); start = timer_get(); bucketsort(a, p->n); end = timer_get(); total = timer_diff(start, end); /* Print timing statistics. */ printf("timing statistics:\n"); printf(" master: %f\n", master*MICROSEC); for (i = 0; i < nclusters; i++) printf(" slave %d: %f\n", i, slave[i]*MICROSEC); printf(" communication: %f\n", communication*MICROSEC); printf(" total time: %f\n", total*MICROSEC); /* House keeping. */ free(a); return (0); }
fsal_status_t FSAL_test_access(fsal_op_context_t * p_context, /* IN */ fsal_accessflags_t access_type, /* IN */ fsal_attrib_list_t * p_object_attributes /* IN */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_test_access(p_context, access_type, p_object_attributes); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_RemoveXAttrById(fsal_handle_t * p_objecthandle, /* IN */ fsal_op_context_t * p_context, /* IN */ unsigned int xattr_id) /* IN */ { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_removexattrbyid(p_objecthandle, p_context, xattr_id); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_close_by_fileid(fsal_file_t * file_descriptor /* IN */ , fsal_op_context_t * p_context, /* IN */ fsal_u64_t fileid) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_close_by_fileid(file_descriptor, p_context, fileid); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_getattrs(fsal_handle_t * p_filehandle, /* IN */ fsal_op_context_t * p_context, /* IN */ fsal_attrib_list_t * p_object_attributes /* IN/OUT */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_getattrs(p_filehandle, p_context, p_object_attributes); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
int timer_get_seconds() { if (!Timer_inited) { Int3(); return 0; } return (timer_get() / 1000); }
int timer_get_microseconds() { if (!Timer_inited) { Int3(); // Make sure you call timer_init before anything that uses timer functions! return 0; } return timer_get() * 1000; }
fsal_status_t FSAL_dynamic_fsinfo(fsal_handle_t * p_filehandle, /* IN */ fsal_op_context_t * p_context, /* IN */ fsal_dynamicfsinfo_t * p_dynamicinfo /* OUT */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_dynamic_fsinfo(p_filehandle, p_context, p_dynamicinfo); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_RemoveXAttrByName(fsal_handle_t * p_objecthandle, /* IN */ fsal_op_context_t * p_context, /* IN */ const fsal_name_t * xattr_name) /* IN */ { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_removexattrbyname(p_objecthandle, p_context, xattr_name); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
void cpu_get_timer(QEMUFile *f, CPUTimer *s) { qemu_get_be32s(f, &s->frequency); qemu_get_be32s(f, &s->disabled); qemu_get_be64s(f, &s->disabled_mask); qemu_get_sbe64s(f, &s->clock_offset); timer_get(f, s->qtimer); }
/** * @function: timer_restart * @param: timer_callback_t, timer event callback function. * @brief: Restarts the timer instance for the given callback function. */ void timer_restart (timer_callback_t callback) { struct timer_t * timer = timer_get (callback); if (timer == NULL) return; timer->start = clock_time (); }
/* * Runs benchmark. */ int main(int argc, char **argv) { int i; /* Loop index. */ int *map; /* Map of clusters. */ uint64_t end; /* End time. */ uint64_t start; /* Start time. */ vector_t *data; /* Data points. */ readargs(argc, argv); printf("CAPBench - KM kernel\n"); printf(" # of threads: %d \n", nthreads); timer_init(); srandnum(seed); omp_set_num_threads(nthreads); /* Benchmark initialization. */ start = timer_get(); data = smalloc(p->npoints*sizeof(vector_t)); for (i = 0; i < p->npoints; i++) { data[i] = vector_create(p->dimension); vector_random(data[i]); } end = timer_get(); /* Cluster data. */ printf("Entering in KM ROI - Clustering data...\n"); start = timer_get(); m5_reset_stats(0,0); map = kmeans(data, p->npoints, p->ncentroids, p->mindistance); end = timer_get(); m5_dump_stats(0,0); printf("KM total time: %f\n", timer_diff(start, end)*MICROSEC); /* House keeping. */ free(map); for (i = 0; i < p->npoints; i++) vector_destroy(data[i]); free(data); return (0); }
//zwraca czas w ms jaki czas up³yn¹³ od wartoœci podanej jako argument (argument czas timera) //Mierzy czas do 1 minuty!! potem siê przewija licznik!! uint16_t timer_time_elapsed(uint16_t time_stamp){ uint16_t current_timer=timer_get(); if( current_timer >= time_stamp){ return (current_timer-time_stamp); } else{ return (current_timer+(0xFFFF-time_stamp)); } };
fsal_status_t FSAL_commit( fsal_file_t * p_file_descriptor, fsal_op_context_t * p_context, /* IN */ fsal_off_t offset, fsal_size_t length ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_commit(p_file_descriptor, p_context, offset, length ); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_rcp(fsal_handle_t * filehandle, /* IN */ fsal_op_context_t * p_context, /* IN */ fsal_path_t * p_local_path, /* IN */ fsal_rcpflag_t transfer_opt /* IN */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_rcp(filehandle, p_context, p_local_path, transfer_opt); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }
fsal_status_t FSAL_setattr_access(fsal_op_context_t * p_context, /* IN */ fsal_attrib_list_t * candidate_attributes, /* IN */ fsal_attrib_list_t * object_attributes /* IN */ ) { fsal_status_t rc; msectimer_t timer_start, timer_end; timer_start = timer_get(); rc = fsal_functions.fsal_setattr_access(p_context, candidate_attributes, object_attributes); timer_end = timer_get(); p_context->latency += timer_end - timer_start; p_context->count++; return rc; }