root/opal/mca/pmix/pmix4x/pmix/src/atomics/sys/sparcv9/timer.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pmix_sys_timer_get_cycles
  2. pmix_sys_timer_get_cycles

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * $COPYRIGHT$
  13  *
  14  * Additional copyrights may follow
  15  *
  16  * $HEADER$
  17  */
  18 
  19 #ifndef PMIX_SYS_ARCH_TIMER_H
  20 #define PMIX_SYS_ARCH_TIMER_H 1
  21 
  22 typedef uint64_t pmix_timer_t;
  23 
  24 #if PMIX_GCC_INLINE_ASSEMBLY
  25 
  26 
  27 #if PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64
  28 
  29 static inline pmix_timer_t
  30 pmix_sys_timer_get_cycles(void)
  31 {
  32     pmix_timer_t ret;
  33 
  34     __asm__ __volatile__("rd %%tick, %0" : "=r"(ret));
  35 
  36     return ret;
  37 }
  38 
  39 #else /* PMIX_SPARCV9_32 */
  40 
  41 static inline pmix_timer_t
  42 pmix_sys_timer_get_cycles(void)
  43 {
  44     pmix_timer_t ret;
  45     int a, b;
  46 
  47     __asm__ __volatile__("rd %%tick, %0    \n"
  48                          "srlx %0, 32, %1 " :
  49                          "=r"(a), "=r"(b)
  50                          );
  51 
  52     ret = (0x00000000FFFFFFFF & a) | (((pmix_timer_t) b) << 32);
  53 
  54     return ret;
  55 }
  56 
  57 #endif
  58 
  59 #define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1
  60 
  61 #else
  62 
  63 #define PMIX_HAVE_SYS_TIMER_GET_CYCLES 0
  64 
  65 #endif /* PMIX_GCC_INLINE_ASSEMBLY */
  66 
  67 #endif /* ! PMIX_SYS_ARCH_TIMER_H */

/* [<][>][^][v][top][bottom][index][help] */