root/opal/mca/timer/timer.h

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

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 /**
  23  * @file
  24  *
  25  * High resolution timer / cycle counter
  26  *
  27  * High resolution timer / cycle counter interface.  This interface is
  28  * intended to hide the system-dependent nature of timers that provide
  29  * higher resolution and lower calling cost than gettimeofday().
  30  * Unlike most component interfaces, there should only ever be one
  31  * component available to be built on a particular platform.
  32  * Therefore, a number of #defines are available to determine how well
  33  * the platform supports high resolution timers:
  34  *
  35  * <UL>
  36  *  <LI><PRE>OPAL_TIMER_CYCLE_NATIVE</PRE> Whether
  37  *    opal_timer_base_get_cycle() is implemented directly or computed
  38  *    from some other data (such as a high res timer)</LI>
  39  *  <LI><PRE>OPAL_TIMER_CYCLE_SUPPORTED</PRE> Whether
  40  *    opal_timer_base_get_cycle() is supported on the current
  41  *    platform.</LI>
  42  *  <LI><PRE>OPAL_TIMER_USEC_SUPPORTED</PRE> Whether
  43  *    opal_timer_base_get_usec() is supported on the current
  44  *    platform or implemented on top of gettimeofday(), which
  45  *    may be unsuitable for some uses.
  46  * </UL>
  47  *
  48  * The cycle count may not be the cycle count of the CPU itself, if
  49  * there is another sufficiently close counter with better behavior
  50  * characteristics (like the Time Base counter on many Power/PowerPC
  51  * platforms).  The function opal_timer_base_get_freq() returns the
  52  * frequency of the cycle counter in use, *NOT* the frequency of the
  53  * main CPU.
  54  *
  55  * Unless otherwise noted, no attempt is made to cope with the the
  56  * differences in counters on SMP machines.  If your process switches
  57  * CPUs, your timer results may change.
  58  *
  59  * Build time priorities are allocated as follows:
  60  *
  61  * - 0   gettimeofday() wrapper
  62  * - 10  Assembly timers with bad frequency search (Linux)
  63  * - 20  NIC software stack (QSNet, Myrinet?)
  64  * - 30  Operating systems with native interfaces
  65  */
  66 
  67 #ifndef OPAL_MCA_TIMER_TIMER_H
  68 #define OPAL_MCA_TIMER_TIMER_H
  69 
  70 #include "opal_config.h"
  71 
  72 #include "opal/mca/mca.h"
  73 #include "opal/mca/base/base.h"
  74 
  75 
  76 /**
  77  * Structure for timer components.
  78  */
  79 struct opal_timer_base_component_2_0_0_t {
  80     /** MCA base component */
  81     mca_base_component_t timerc_version;
  82     /** MCA base data */
  83     mca_base_component_data_t timerc_data;
  84 };
  85 /**
  86  * Convenience typedef
  87  */
  88 typedef struct opal_timer_base_component_2_0_0_t opal_timer_base_component_2_0_0_t;
  89 
  90 /*
  91  * Macro for use in components that are of type timer
  92  */
  93 #define OPAL_TIMER_BASE_VERSION_2_0_0 \
  94     OPAL_MCA_BASE_VERSION_2_1_0("timer", 2, 0, 0)
  95 
  96 #endif /* OPAL_MCA_TIMER_TIMER_H */

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