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