hires_clock.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Copyright (C) 2001 Silicon Graphics, Inc. All rights reserved.
  7.  *
  8.  * SGI Hi Resolution Clock
  9.  *
  10.  * SGI SN platforms provide a high resolution clock that is
  11.  * synchronized across all nodes. The clock can be memory mapped
  12.  * and directly read from user space.
  13.  *
  14.  * Access to the clock is thru the following:
  15.  *       (error checking not shown)
  16.  *
  17.  * (Note: should library routines be provided to encapsulate this??)
  18.  *
  19.  * int fd:
  20.  * volatile long *clk;
  21.  *
  22.  * fd = open (HIRES_FULLNAME, O_RDONLY);
  23.  * clk = mmap(0, getpagesize(), PROT_READ, MAP_SHARED, fd, 0);
  24.  * clk += ioctl(fd, HIRES_IOCQGETOFFSET, 0);
  25.  *
  26.  * At this point, clk is a pointer to the high resolution clock.
  27.  *
  28.  * The clock period can be obtained via:
  29.  *
  30.  * long picosec_per_tick;
  31.  * picosec_per_tick = ioctl(fd, HIRES_IOCQGETPICOSEC, 0);
  32.  */
  33. #ifndef _ASM_IA64_SN_HIRES_CLOCK_H
  34. #define _ASM_IA64_SN_HIRES_CLOCK_H
  35. #define HIRES_BASENAME "sgi_hires_clock"
  36. #define HIRES_FULLNAME  "/dev/sgi_hires_clock"
  37. #define HIRES_IOC_BASE 's'
  38. /* Get page offset of hires timer */
  39. #define HIRES_IOCQGETOFFSET _IO( HIRES_IOC_BASE, 0 )
  40. /* get clock period in picoseconds per tick */
  41. #define HIRES_IOCQGETPICOSEC _IO( HIRES_IOC_BASE, 1 )
  42. /* get number of significant bits in clock counter */
  43. #define HIRES_IOCQGETCLOCKBITS _IO( HIRES_IOC_BASE, 2 )
  44. #endif /* _ASM_IA64_SN_HIRES_CLOCK_H */