/*************************************************************************** * * Copyright (c) 2008 Baidu.com, Inc. All Rights Reserved * $Id: yperfbench.h,v 1.1 2008/09/03 06:47:49 xiaowei Exp $ * **************************************************************************/ /** * @file yperfbench.h * @author yufan(com@baidu.com) * @date 2008/07/30 17:15:22 * @version $Revision: 1.1 $ * @brief * **/ #ifndef __YPERFBENCH_H_ #define __YPERFBENCH_H_ #include #include #include #include #define __YPERFPENCH_NAME_LENGTH 64 #define __YPERFPENCH_VALUE_LENGTH 64 namespace pb { struct output { char name[__YPERFPENCH_NAME_LENGTH]; char value[__YPERFPENCH_VALUE_LENGTH]; }; extern int argc; extern char ** argv; void init_opt(int _argc, char ** _argv); void print_result(); template T getopt(char * arg) { for(int i=1; i #include class timer { timeval start; char name[__YPERFPENCH_NAME_LENGTH]; public: timer(); timer(char * name); void check(); }; struct threading { pthread_t *threads; int num; }; threading create_threads(void *(void*), int num); void wait_threads(threading t); void run_threads(void *fun(void*), int num); } #endif //__YPERFBENCH_H_ /* vim: set ts=4 sw=4 sts=4 tw=100 */