您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ stop_timer函数代码示例

51自学网 2021-06-03 08:24:32
  C++
这篇教程C++ stop_timer函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中stop_timer函数的典型用法代码示例。如果您正苦于以下问题:C++ stop_timer函数的具体用法?C++ stop_timer怎么用?C++ stop_timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了stop_timer函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: while

void *thread_function(void *wf_context) {  struct timeval start_time, end_time;  double total_time;  void *input = ((workflow_context_t *) wf_context)->input;  workflow_t *wf = ((workflow_context_t *) wf_context)->wf;    void *data = NULL;  int num_threads = wf->num_threads;  workflow_producer_function_t producer_function = (workflow_producer_function_t)wf->producer_function;  workflow_consumer_function_t consumer_function = (workflow_consumer_function_t)wf->consumer_function;  while (workflow_get_status(wf) == WORKFLOW_STATUS_RUNNING) {    if (producer_function                        &&	workflow_get_num_items(wf) < num_threads && 	(!workflow_is_producer_finished(wf))     &&	workflow_lock_producer(wf)) {            //	 Extrae_event(6000019, 7);       total_time = 0;      start_timer(start_time);      data = producer_function(input);      stop_timer(start_time, end_time, total_time);      wf->producer_time += (total_time / 1000000.0f);      //	 Extrae_event(6000019, 0);       if (data) {	workflow_insert_item(data, wf);      } else {	workflow_producer_finished(wf);      }      workflow_unlock_producer(wf);          } else if (consumer_function                         &&	       workflow_get_num_completed_items_(wf) > 0 && 	       workflow_lock_consumer(wf)) {	       if ((data = workflow_remove_item(wf))) {	total_time = 0;	start_timer(start_time);	consumer_function(data);	stop_timer(start_time, end_time, total_time);	wf->consumer_time += (total_time / 1000000.0f);      }      workflow_unlock_consumer(wf);    } else {      workflow_schedule(wf);    }  }    return NULL;  //printf("Thread function end/n");}
开发者ID:mrG7,项目名称:hpg-libs,代码行数:56,


示例2: perft_test_perft

int perft_test_perft(EPDFile* epdFile){	int i = 0;	Timer totalTimer, perftTimer;	printf("Testing %i perfts/n", epdFile->numEPD);	start_timer(&totalTimer);	for (i = 0; i < epdFile->numEPD; ++i)	{		EPD* epd = &epdFile->epds[i];		int depth = 1;		char depthKey[8];		unsigned int perftExpected = 0, perftActual;		printf("%i/%i %s/n", i + 1, epdFile->numEPD, epd->description);		while (1)		{			snprintf(depthKey, 8, "D%i", depth);			if (!epd_has_operation(epd, depthKey))			{				break;			}			perftExpected = epd_uint_operation(epd, depthKey);			start_timer(&perftTimer);			perftActual = perft_perft(&epd->board, depth);			stop_timer(&perftTimer);			printf("perft %i: %i [%03fs] (%i) %s/n", depth, perftActual, get_elapsed_time(&perftTimer), perftExpected,			perftActual == perftExpected ? "PASS" : "FAIL");			if (perftActual != perftExpected)			{				printf("Fail in perft test/n");				printf("FEN: %s/n", epd->description);				printf("Level: %i/n", depth);				printf("Expected: %i/n", perftExpected);				printf("Found: %i/n", perftActual);				return 0;			}			++depth;		}		printf("/n");	}	stop_timer(&totalTimer);	printf("Perft suite finished in %03fs/n", get_elapsed_time(&totalTimer));	return 1;}
开发者ID:tompko,项目名称:Patrician,代码行数:55,


示例3: main

int main(int argc, char *argv[]){  double integral;  start_timer();  integral = NormalIntegral(-0.1146);  printf ("%.20lf/nseq:%.3lf ms/n",integral,stop_timer());  start_timer();  integral = vNormalIntegral(-0.1146);  printf ("%.20lf/nvec:%.3lf ms/n",integral,stop_timer());  return 0;}
开发者ID:francktcheng,项目名称:BSERROR,代码行数:12,


示例4: main

int main (int argc, char *argv[])  {    // Déclare un timer, ainsi que deux recorder qui vont contenir les résultats de l'exécution du programme    timer *t = timer_alloc();    recorder *bash_rec = recorder_alloc("shell-bash.csv");    recorder *prog_rec = recorder_alloc("shell-prog.csv");    // Nom du programme C et du script à comparer    char * progr = "./shell-program ";    char * bash =  "./shell-bash.sh ";    // Cette variable contient la transformation du nombre d'instruction (i).    // Puisque cette variable est un int, 7 caractères suffisent à sa représentation.    char  nbr[7];    int i;    // Allocation des emplacements contenant la commande à exécuter    char*argProgr = (char *) malloc(24*sizeof(char));    char*argBash = (char *) malloc(24*sizeof(char));    if(argProgr == NULL || argBash == NULL)        exit(EXIT_FAILURE);    for(i=1; i<MAX_SIZE; i+=1) {        // Convertit "i" en char* et le place dans nbr        snprintf(nbr, 7, "%d", i);        // Concatene les deux parties de la commande        strncpy(argProgr, progr, 24);        strncpy(argBash, bash, 24);        strncat(argProgr, nbr, 7);        strncat(argBash, nbr, 7);        // Commence le timer et lance la commande, puis écrit le résultat dans le record approprié        start_timer(t);        system(argProgr);        write_record(prog_rec, i, stop_timer(t));        start_timer(t);        system(argBash);        write_record(bash_rec, i, stop_timer(t));    }    // Libère la mémoire    recorder_free(bash_rec);    recorder_free(prog_rec);    timer_free(t);    return EXIT_SUCCESS;}
开发者ID:jbarreravega,项目名称:SINF1252-P3,代码行数:50,


示例5: main

int main(int argc, char *argv[]) {	removefile_state_t state = NULL;	removefile_callback_t callback = NULL;	pthread_t thread = NULL;	int err = 0;	mkdirs();	start_timer("removefile(NULL)");	assert(removefile("/tmp/removefile-test", NULL, REMOVEFILE_SECURE_1_PASS | REMOVEFILE_RECURSIVE) == 0);	stop_timer();	mkdirs();	assert((state = removefile_state_alloc()) != NULL);	assert(pthread_create(&thread, NULL, threadproc, state) == 0);	start_timer("removefile(state) with cancel");        assert(removefile_state_set(state, REMOVEFILE_STATE_ERROR_CALLBACK, removefile_error_callback) == 0);        assert(removefile_state_set(state, REMOVEFILE_STATE_ERROR_CONTEXT, (void*)4567) == 0);	assert(removefile("/tmp/removefile-test", state, REMOVEFILE_SECURE_1_PASS | REMOVEFILE_RECURSIVE) == -1 && errno == ECANCELED);	stop_timer();        start_timer("removefile(NULL)");        assert(removefile("/tmp/removefile-test", NULL, REMOVEFILE_SECURE_1_PASS | REMOVEFILE_RECURSIVE) == 0);        stop_timer();	mkdirs();	assert(removefile_state_set(state, 1234567, (void*)1234567) == -1 && errno == EINVAL);	assert(removefile_state_set(state, REMOVEFILE_STATE_CONFIRM_CALLBACK, removefile_confirm_callback) == 0);	assert(removefile_state_get(state, REMOVEFILE_STATE_CONFIRM_CALLBACK, &callback) == 0);	assert(callback == removefile_confirm_callback);	assert(removefile_state_set(state, REMOVEFILE_STATE_CONFIRM_CONTEXT, (void*)1234) == 0);	assert(removefile_state_set(state, REMOVEFILE_STATE_ERROR_CALLBACK, removefile_error_callback) == 0);	assert(removefile_state_get(state, REMOVEFILE_STATE_ERROR_CALLBACK, &callback) == 0);	assert(callback == removefile_error_callback);	assert(removefile_state_set(state, REMOVEFILE_STATE_ERROR_CONTEXT, (void*)4567) == 0);	assert(removefile_state_set(state, REMOVEFILE_STATE_STATUS_CALLBACK, removefile_status_callback) == 0);	assert(removefile_state_get(state, REMOVEFILE_STATE_STATUS_CALLBACK, &callback) == 0);	assert(callback == removefile_status_callback);	assert(removefile_state_set(state, REMOVEFILE_STATE_STATUS_CONTEXT, (void*)5678) == 0);	start_timer("removefile(state)");	assert(removefile("/tmp/removefile-test", state, REMOVEFILE_SECURE_1_PASS | REMOVEFILE_RECURSIVE) == 0);	stop_timer();	return 0;}
开发者ID:010001111,项目名称:darling,代码行数:49,


示例6: main

int main() {  test_setup();  perf_start();  for (int i = 0; i < NUM_ITER; ++i) {    test_clear();    reset_timer();    start_timer();    test_run(i);    stop_timer();    samples[i] = get_time();  }  perf_stop();  int check = test_check();  printf("Correct: %d/n", check);  for (int i = 0; i < NUM_ITER; ++i)    printf("TS[%d]: %d/n", i, samples[i]);  perf_print_all();  return 0;}
开发者ID:pulp-platform,项目名称:pulpino,代码行数:29,


示例7: handle_packet

/* * Handle packets from the receiver */void handle_packet(struct packet* pckt){	switch(pckt->header.type)	{		case DAT:			break;		case ACK:			// update statistics			ACK_packets_received++;			// mark data packet as acknowledged by stopping its timer			pthread_mutex_lock(&timers_mutex);			stop_timer(timer_list, pckt->header.seqno);			//printf("Timer %d stopped/n", pckt->header.seqno);			pthread_mutex_unlock(&timers_mutex);			break;		case SYN:			break;		case RST:			// update statistics			RST_packets_received++;			break;		case FIN:			break;		default:			break;	}}
开发者ID:esmurphy7,项目名称:UDP-Reliable,代码行数:30,


示例8: saal_okay

void saal_okay(SIG_ENTITY *sig){    SOCKET *curr;    trace_msg("SAAL came up");#ifdef THOMFLEX    /*     * Some versions of the Thomson Thomflex 5000 won't do any signaling before     * they get a RESTART. Whenever SAAL comes up, this may indicate that the     * switch got booted, so we send that RESTART. We also have to clear all     * pending connections, which isn't that nice ... Note that the rest of the     * RESTART state machine is not implemented, so the RESTART ACKNOWLEDGE     * will yield a warning.     */    {	Q_DSC dsc;	int size;	clear_all_calls(sig);	q_create(&dsc,q_buffer,MAX_Q_MSG);	q_assign(&dsc,QF_msg_type,QMSG_RESTART);	q_assign(&dsc,QF_call_ref,0);	q_assign(&dsc,QF_rst_class,ATM_RST_ALL_VC);	if ((size = q_close(&dsc)) >= 0) to_signaling(sig,q_buffer,size);    }#endif    if (!t309) return;    stop_timer(t309);    t309 = NULL;    for (curr = sockets; curr; curr = curr->next)	if (curr->sig == sig && curr->call_state != cs_null)	    send_status_enq(curr);}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:33,


示例9: get_display_time

//Display time and recalculate based on Pebble Time//This is based on the difference of start and current time from the PebblePblTm get_display_time() {    //get the current time    PblTm currentTime;    get_time(&currentTime);    //convert start time and current time to seconds for easier difference calculation    long startTimeSeconds = PblTm_to_seconds(startTime);    long currentTimeSeconds = PblTm_to_seconds(currentTime);    //find difference in seconds    diffSeconds = currentTimeSeconds - startTimeSeconds;    //Remember to use decisecond offsest    if (diffSeconds == 0 && dSecondsOffset > 0)        totalSeconds++;    //Add total running time (totalSeconds) to display time    displaySeconds = totalSeconds + diffSeconds;    // Stop the count if max reached    if (displaySeconds >= MAX_SECONDS)    {       	stop_timer();    	PblTm zeroTime = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0};    	return zeroTime;    }    return seconds_to_PblTm(displaySeconds);}
开发者ID:BitHangar,项目名称:app-stopwatch,代码行数:32,


示例10: free_reasm

/* Free all resources associated with a reassembly descriptor */static voidfree_reasm(struct reasm *r){	register struct reasm *rp;	struct reasm *rplast = NULL;	register struct frag *fp;	for(rp = Reasmq;rp != NULL;rplast = rp,rp=rp->next)		if(r == rp)			break;	if(rp == NULL)		return;	/* Not on list */	stop_timer(&rp->timer);	/* Remove from list of reassembly descriptors */	if(rplast != NULL)		rplast->next = rp->next;	else		Reasmq = rp->next;	/* Free any fragments on list, starting at beginning */	while((fp = rp->fraglist) != NULL){		rp->fraglist = fp->next;		free_p(&fp->buf);		free(fp);	}	free(rp);}
开发者ID:zidier215,项目名称:tcpip,代码行数:30,


示例11: toggle_timer_click

// Button handlers// Start/stop timervoid toggle_timer_click(ClickRecognizerRef recognizer, Window *window) {    if(running) {			stop_timer();    } else {			start_timer();    }}
开发者ID:BillMyTime,项目名称:bill-my-time-pebble,代码行数:9,


示例12: new_sysinfo

/* check if sysinfo is complete, change to RACH state */static int new_sysinfo(void){	struct gsm48_sysinfo *s = &sysinfo;	/* restart timer */	start_timer(READ_WAIT);	/* mandatory */	if (!s->si1 || !s->si2 || !s->si3 || !s->si4) {		LOGP(DRR, LOGL_INFO, "not all mandatory SI received/n");		return 0;	}	/* extended band */	if (s->nb_ext_ind_si2 && !s->si2bis) {		LOGP(DRR, LOGL_INFO, "extended ba, but si2bis not received/n");		return 0;	}	/* 2ter */	if (s->si2ter_ind && !s->si2ter) {		LOGP(DRR, LOGL_INFO, "si2ter_ind, but si2ter not received/n");		return 0;	}	LOGP(DRR, LOGL_INFO, "Sysinfo complete/n");	stop_timer();	rach_count = 0;	start_rach();	return 0;}
开发者ID:0x7678,项目名称:Typhon-imsiCatcher-Catcher,代码行数:35,


示例13: dotcpwatch

int dotcpwatch (int argc, char** argv, void *p){    if(argc < 2)    {        tprintf ("TCP Watch Dog timer %d/%d seconds/n",        	read_timer (&TcpWatchTimer)/1000,        		dur_timer(&TcpWatchTimer)/1000);        return 0;    }    stop_timer (&TcpWatchTimer);	/* in case it's already running */	/* what to call on timeout */    TcpWatchTimer.func = (void (*)(void*))dowatchtick;    TcpWatchTimer.arg = NULLCHAR;	/* dummy value */	/* set timer duration */    set_timer (&TcpWatchTimer, (uint32)atoi (argv[1])*1000);    start_timer (&TcpWatchTimer);	/* and fire it up */    return 0;}
开发者ID:mlangelaar,项目名称:jnos2,代码行数:25,


示例14: start_timer

static void start_timer(int sec, int micro){	stop_timer();	timer.cb = timeout_cb;	timer.data = ms;	osmo_timer_schedule(&timer, sec, micro);}
开发者ID:0x7678,项目名称:Typhon-imsiCatcher-Catcher,代码行数:7,


示例15: tr_multi_socket_action

/* note: this function can free the tr_web if its 'closing' flag is set   and no tasks remain.  callers must not reference their g pointer   after calling this function */static voidtr_multi_socket_action( tr_web * g, int fd, int mask ){    int closed = FALSE;    CURLMcode rc;    dbgmsg( "check_run_count: prev_running %d, still_running %d",            g->prev_running, g->still_running );    /* invoke libcurl's processing */    do {        rc = curl_multi_socket_action( g->multi, fd, mask, &g->still_running );        dbgmsg( "event_cb(): fd %d, mask %d, still_running is %d",                fd, mask, g->still_running );    } while( rc == CURLM_CALL_MULTI_PERFORM );    if( rc != CURLM_OK )        tr_err( "%s", curl_multi_strerror( rc ) );    remove_finished_tasks( g );    add_tasks_from_queue( g );    if( !g->still_running ) {        stop_timer( g );        if( g->closing ) {            web_close( g );            closed = TRUE;        }    }    if( !closed )        restart_timer( g );}
开发者ID:fangang190,项目名称:canary,代码行数:36,


示例16: web_close

static voidweb_close( tr_web * g ){    stop_timer( g );    curl_multi_cleanup( g->multi );    tr_free( g );}
开发者ID:fangang190,项目名称:canary,代码行数:7,


示例17: gradient_end_txrx

void gradient_end_txrx(){  stop_timer();  Qprint();  gradient_set_state(GRADIENT_IDLE);  wor_start(IS_SINK_NODE);}
开发者ID:MDPMapleseed,项目名称:rf2500-wireless,代码行数:7,


示例18: timer_close

static voidtimer_close(struct sol_flow_node *node, void *data){    struct timer_data *mdata = data;    stop_timer(mdata);}
开发者ID:Learn-iot,项目名称:soletta,代码行数:7,


示例19: timer_stop

void timer_stop(void){    int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);    /* Halt timer if running - stop module clock */    stop_timer(true);    restore_interrupt(oldstatus);}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:7,


示例20: do_adc

void do_adc(void){	uint8_t	channel = adc_work_channels[adc_current_channel];		if (ADC_USE_INTERRUPT == g_use_interrupt)		return;		if ((0 == adc[channel].timer_id) ||		(0 == timer_value(adc[channel].timer_id)))	{		adc[channel].new_value += adc_single_value(channel);		adc[channel].count++;		if (adc[channel].count > adc[channel].max_count - 1)		{			adc[channel].count = 0;			adc[channel].mean_value = 				(int16_t)(adc[channel].new_value / adc[channel].max_count);			adc[channel].new_value = 0;		}				stop_timer(adc[channel].timer_id);		adc[channel].timer_id = start_timer(adc[channel].delay);	}		adc_current_channel++;	if (-1 == adc_work_channels[adc_current_channel])		adc_current_channel = 0;}
开发者ID:gluke77,项目名称:avr-uzg,代码行数:28,


示例21: vtimer_cntp_ctl

static int vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, int read){    struct vcpu *v = current;    if ( !ACCESS_ALLOWED(regs, EL0PTEN) )        return 0;    if ( read )    {        *r = v->arch.phys_timer.ctl;    }    else    {        uint32_t ctl = *r & ~CNTx_CTL_PENDING;        if ( ctl & CNTx_CTL_ENABLE )            ctl |= v->arch.phys_timer.ctl & CNTx_CTL_PENDING;        v->arch.phys_timer.ctl = ctl;        if ( v->arch.phys_timer.ctl & CNTx_CTL_ENABLE )        {            set_timer(&v->arch.phys_timer.timer,                      v->arch.phys_timer.cval + v->domain->arch.phys_timer_base.offset);        }        else            stop_timer(&v->arch.phys_timer.timer);    }    return 1;}
开发者ID:HackLinux,项目名称:xen-1,代码行数:28,


示例22: timer_set

bool timer_set(long cycles, bool start){    /* Maximum cycle count expressible in the cycles parameter is 2^31-1     * and the modulus counter is capable of 2^32-1 and as a result there is     * no requirement to use a prescaler > 1. This gives a frequency range of     * ~0.015366822Hz - 66000000Hz. The highest input frequency gives the     * greatest possible accuracy anyway. */    int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);    /* Halt timer if running - leave module clock enabled */    stop_timer(false);    if (start && pfn_unregister != NULL)    {        pfn_unregister();        pfn_unregister = NULL;    }    /* CLKSRC = ipg_clk,     * EPIT output disconnected,     * Enabled in wait mode     * Prescale 1 for 66MHz     * Reload from modulus register,     * Count from load value */    EPITCR2 = EPITCR_CLKSRC_IPG_CLK | EPITCR_WAITEN | EPITCR_IOVW |              ((1-1) << EPITCR_PRESCALER_POS) | EPITCR_RLD | EPITCR_ENMOD;    EPITLR2 = cycles;    /* Event when counter reaches 0 */    EPITCMPR2 = 0;    restore_interrupt(oldstatus);    return true;}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:33,


示例23: wait_for_interrupt

void wait_for_interrupt(){	int pending = 0;	int reenable = 1;	printf("Wait for the Timer interrupt to trigger /n");	printf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/n");	/* block on the file waiting for an interrupt */	read(timer_fd, (void *)&pending, sizeof(int));	printf("/n/[email
C++ stopped函数代码示例
C++ stop_t200函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。