Annotation of sys/dev/raidframe/rf_etimer.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: rf_etimer.h,v 1.7 2004/06/24 19:35:24 tholo Exp $ */
2: /* $NetBSD: rf_etimer.h,v 1.4 1999/08/13 03:26:55 oster Exp $ */
3:
4: /*
5: * Copyright (c) 1995 Carnegie-Mellon University.
6: * All rights reserved.
7: *
8: * Author: Mark Holland
9: *
10: * Permission to use, copy, modify and distribute this software and
11: * its documentation is hereby granted, provided that both the copyright
12: * notice and this permission notice appear in all copies of the
13: * software, derivative works or modified versions, and any portions
14: * thereof, and that both notices appear in supporting documentation.
15: *
16: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19: *
20: * Carnegie Mellon requests users of this software to return to
21: *
22: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23: * School of Computer Science
24: * Carnegie Mellon University
25: * Pittsburgh PA 15213-3890
26: *
27: * any improvements or extensions that they make and grant Carnegie the
28: * rights to redistribute these changes.
29: */
30:
31: #ifndef _RF__RF_TIMER_H_
32: #define _RF__RF_TIMER_H_
33:
34:
35: #include "rf_options.h"
36: #include "rf_utils.h"
37:
38: #include <sys/time.h>
39:
40: struct RF_Etimer_s {
41: struct timeval st;
42: struct timeval et;
43: struct timeval diff;
44: };
45:
46: #if defined(_KERNEL)
47: #include <sys/kernel.h>
48:
49: #define RF_ETIMER_START(_t_) \
50: do { \
51: bzero(&(_t_), sizeof (_t_)); \
52: getmicrouptime(&(_t_).st); \
53: } while (0)
54:
55: #define RF_ETIMER_STOP(_t_) \
56: do { \
57: getmicrouptime(&(_t_).et); \
58: } while (0)
59:
60: #define RF_ETIMER_EVAL(_t_) \
61: do { \
62: RF_TIMEVAL_DIFF(&(_t_).st, &(_t_).et, &(_t_).diff); \
63: } while (0)
64:
65: #define RF_ETIMER_VAL_US(_t_) (RF_TIMEVAL_TO_US((_t_).diff))
66: #define RF_ETIMER_VAL_MS(_t_) (RF_TIMEVAL_TO_US((_t_).diff)/1000)
67:
68: #endif /* _KERNEL */
69:
70: #endif /* !_RF__RF_TIMER_H_ */
CVSweb