00001 /* 00002 * See the dyninst/COPYRIGHT file for copyright information. 00003 * 00004 * We provide the Paradyn Tools (below described as "Paradyn") 00005 * on an AS IS basis, and do not warrant its validity or performance. 00006 * We reserve the right to update, modify, or discontinue this 00007 * software at any time. We shall have no obligation to supply such 00008 * updates or modifications or any other form of support to you. 00009 * 00010 * By your use of Paradyn, you understand and agree that we (or any 00011 * other person or entity with proprietary rights in Paradyn) are 00012 * under no obligation to provide either maintenance services, 00013 * update services, notices of latent defects, or correction of 00014 * defects for Paradyn. 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2.1 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 * Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this library; if not, write to the Free Software 00028 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00029 */ 00030 00031 #ifndef __TIMING_H 00032 #define __TIMING_H 00033 00034 #include "common/h/Types.h" // for getCurrentTimeRaw() 00035 #include "common/h/Time.h" // for getCurrentTime(), ... 00036 00037 00038 /* Function for general time retrieval. Use in dyninst, front-end; don't use 00039 in daemon when desire high res timer level if exists instead (see 00040 getWallTime in init.h) */ 00041 COMMON_EXPORT timeStamp getCurrentTime(); 00042 00043 /* returns primitive wall time in microsecond units since 1970, 00044 (eg. gettimeofday) used by getCurrentTime() */ 00045 COMMON_EXPORT int64_t getRawTime1970(); 00046 00047 /* Calculates the cpu cycle rate value. Needs to be called once, 00048 before any getCyclesPerSecond() call */ 00049 COMMON_EXPORT void initCyclesPerSecond(); 00050 00051 /* Returns the cpu cycle rate. Timeunits represented as units 00052 (ie. cycles) per nanosecond */ 00053 COMMON_EXPORT timeUnit getCyclesPerSecond(); 00054 00055 /* Platform dependent, used by initCyclesPerSecond(). */ 00056 COMMON_EXPORT double calcCyclesPerSecondOS(); 00057 00058 enum { cpsMethodNotAvailable = -1 }; 00059 00060 /* A default stab at getting the cycle rate. Used by calcCyclesPerSecondOS 00061 if a method which gets a more precise value isn't available. */ 00062 COMMON_EXPORT double calcCyclesPerSecond_default(); 00063 00064 00065 #endif 00066 00067 00068
1.6.1