示例#1
0
文件: timer.c 项目: Clanne/Projet_RP
void update_timer_stats(timer* t , timer_stats* stats){
	float resultat = timeval_to_float( t->resultat );
	if( resultat >  stats->max )  stats->max = resultat;
	if( resultat < stats->min  || stats->min < 0 ) stats->min = resultat;
	stats->totaltime += resultat;
	statlist_add( &stats->value_list , resultat );
}
示例#2
0
int sound_stop()
{
	int ret = 0;
	struct generic_receiver *receiver = NULL;
	struct generic_receiver *receiver_next = NULL;

	if (!sound.device) {
		return -1;
	}

	if (sound.ev) {
		event_free(sound.ev);
	}

	receiver = sound.receiver;
	while(receiver != NULL) {
		receiver_next = receiver->next;
		sound_remove_receiver(receiver);
		receiver = receiver_next;
	}

	ret = snd_pcm_oss_device_untrigger(sound.device);
	if (ret) {
		return -1;
	}

#ifdef ENABLE_TIMING
	timing_helper_free(sound_read);
	timing_helper_free(sound_send);
#endif

	struct timeval end;
	float totaltime;
	float fps;

	gettimeofday(&end, NULL);
	timeval_sub(&end, &(sound.begin), &end);
	totaltime = timeval_to_float(&end);
	fps = ((float)sound.cbcount) / totaltime;

	printf("Current sound connections %d\n", sound.connection_now);
	printf("Device running time: %.06f seconds\n", totaltime);
	printf("Statistis: %d frame, avg %2.2f fps\n", sound.cbcount, fps);

	return 0;
}
示例#3
0
文件: timer.c 项目: Clanne/Projet_RP
void sprint_timeval(struct timeval* tv , char* retstr ){
	sprintf( retstr , "%0.3f" , timeval_to_float(*tv) );
}