#include #include #include #include #include "yperfbench.h" namespace pb { int argc; char ** argv; int output_counter=0; output outputs[40]; pthread_mutex_t perfmutex = PTHREAD_MUTEX_INITIALIZER; void print_result() { for(int i=0; i #include timer::timer(char * _name) { strncpy(name, _name, sizeof(name)-1); name[sizeof(name)-1]=0; gettimeofday(&start, NULL); } timer::timer() { strcpy(name, "timer"); gettimeofday(&start, NULL); } void timer::check() { timeval end; gettimeofday(&end, NULL); put_result(name, 1000 * (end.tv_sec - start.tv_sec) + 0.001 * (end.tv_usec -start.tv_usec)); } void run_threads(void *fun(void*), int num) { if(num == 1) { fun(0); return; } pthread_t *threads = (pthread_t*) calloc(num, sizeof(threads)); for(int i=0; i