00001 /* Benchmarks 00002 Copyright (C) 2001 Free Software Foundation, Inc. 00003 Written by Stephane Carrez (stcarrez@worldnet.fr) 00004 00005 This file is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU General Public License as published by the 00007 Free Software Foundation; either version 2, or (at your option) any 00008 later version. 00009 00010 In addition to the permissions in the GNU General Public License, the 00011 Free Software Foundation gives you unlimited permission to link the 00012 compiled version of this file with other programs, and to distribute 00013 those programs without any restriction coming from the use of this 00014 file. (The General Public License restrictions do apply in other 00015 respects; for example, they cover modification of the file, and 00016 distribution when not linked into another program.) 00017 00018 This file is distributed in the hope that it will be useful, but 00019 WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 along with this program; see the file COPYING. If not, write to 00025 the Free Software Foundation, 59 Temple Place - Suite 330, 00026 Boston, MA 02111-1307, USA. */ 00027 00028 #ifndef _BENCHS_H 00029 #define _BENCHS_H 00030 00067 00068 #include <sys/param.h> 00069 #include <sys/ports.h> 00070 00075 struct bench 00076 { 00078 unsigned short b_start; 00079 00081 unsigned short b_stop; 00082 00085 unsigned short b_correction; 00086 00088 unsigned short b_delta; 00089 }; 00090 typedef struct bench bench_t; 00091 00103 extern void 00104 bench_init (bench_t *b); 00105 00114 extern void bench_start (bench_t *b); 00115 00116 extern __inline__ void 00117 bench_start (bench_t *b) 00118 { 00119 b->b_start = get_timer_counter (); 00120 } 00121 00130 extern void bench_stop (bench_t *b); 00131 00132 extern __inline__ void 00133 bench_stop (bench_t *b) 00134 { 00135 b->b_stop = get_timer_counter (); 00136 } 00137 00147 extern void 00148 bench_report (bench_t *b, const char *msg, ...); 00149 00150 00159 extern void 00160 bench_empty (bench_t *b); 00161 00164 #endif