diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2015-09-26 19:52:37 -0700 |
---|---|---|
committer | Aliaksey Kandratsenka <alkondratenko@gmail.com> | 2015-10-05 21:00:49 -0700 |
commit | 6627f9217d8897b297c6da038cfbcff6a3086cfa (patch) | |
tree | 2eafd4ed22284e01849963e9bc490532c4df661d | |
parent | f985abc29607b8a5662ddac7bd1ed99c71ceeb11 (diff) | |
download | gperftools-6627f9217d8897b297c6da038cfbcff6a3086cfa.tar.gz |
drop cycleclock
-rwxr-xr-x | Makefile.am | 1 | ||||
-rw-r--r-- | src/base/cycleclock.h | 173 | ||||
-rw-r--r-- | src/base/sysinfo.cc | 1 | ||||
-rwxr-xr-x | vsprojects/addressmap_unittest/addressmap_unittest.vcproj | 3 | ||||
-rwxr-xr-x | vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj | 3 | ||||
-rwxr-xr-x | vsprojects/packed-cache_test/packed-cache_test.vcproj | 3 |
6 files changed, 0 insertions, 184 deletions
diff --git a/Makefile.am b/Makefile.am index ce40ecd..9f82fde 100755 --- a/Makefile.am +++ b/Makefile.am @@ -196,7 +196,6 @@ SYSINFO_INCLUDES = src/base/sysinfo.h \ src/getenv_safe.h \ src/base/logging.h \ src/base/commandlineflags.h \ - src/base/cycleclock.h \ src/base/arm_instruction_set_select.h \ src/base/basictypes.h noinst_LTLIBRARIES += libsysinfo.la diff --git a/src/base/cycleclock.h b/src/base/cycleclock.h deleted file mode 100644 index dc2d569..0000000 --- a/src/base/cycleclock.h +++ /dev/null @@ -1,173 +0,0 @@ -// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- -// Copyright (c) 2004, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// ---------------------------------------------------------------------- -// CycleClock -// A CycleClock tells you the current time in Cycles. The "time" -// is actually time since power-on. This is like time() but doesn't -// involve a system call and is much more precise. -// -// NOTE: Not all cpu/platform/kernel combinations guarantee that this -// clock increments at a constant rate or is synchronized across all logical -// cpus in a system. -// -// Also, in some out of order CPU implementations, the CycleClock is not -// serializing. So if you're trying to count at cycles granularity, your -// data might be inaccurate due to out of order instruction execution. -// ---------------------------------------------------------------------- - -#ifndef GOOGLE_BASE_CYCLECLOCK_H_ -#define GOOGLE_BASE_CYCLECLOCK_H_ - -#include "base/basictypes.h" // make sure we get the def for int64 -#include "base/arm_instruction_set_select.h" -// base/sysinfo.h is really big and we don't want to include it unless -// it is necessary. -#if defined(__arm__) || defined(__mips__) || defined(__aarch64__) -# include "base/sysinfo.h" -#endif -#if defined(__MACH__) && defined(__APPLE__) -# include <mach/mach_time.h> -#endif -// For MSVC, we want to use '_asm rdtsc' when possible (since it works -// with even ancient MSVC compilers), and when not possible the -// __rdtsc intrinsic, declared in <intrin.h>. Unfortunately, in some -// environments, <windows.h> and <intrin.h> have conflicting -// declarations of some other intrinsics, breaking compilation. -// Therefore, we simply declare __rdtsc ourselves. See also -// http://connect.microsoft.com/VisualStudio/feedback/details/262047 -#if defined(_MSC_VER) && !defined(_M_IX86) -extern "C" uint64 __rdtsc(); -#pragma intrinsic(__rdtsc) -#endif -#if defined(ARMV3) || defined(__mips__) || defined(__aarch64__) -#include <sys/time.h> -#endif - -// NOTE: only i386 and x86_64 have been well tested. -// PPC, sparc, alpha, and ia64 are based on -// http://peter.kuscsik.com/wordpress/?p=14 -// with modifications by m3b. See also -// https://setisvn.ssl.berkeley.edu/svn/lib/fftw-3.0.1/kernel/cycle.h -struct CycleClock { - // This should return the number of cycles since power-on. Thread-safe. - static inline int64 Now() { -#if defined(__MACH__) && defined(__APPLE__) - // this goes at the top because we need ALL Macs, regardless of - // architecture, to return the number of "mach time units" that - // have passed since startup. See sysinfo.cc where - // InitializeSystemInfo() sets the supposed cpu clock frequency of - // macs to the number of mach time units per second, not actual - // CPU clock frequency (which can change in the face of CPU - // frequency scaling). Also note that when the Mac sleeps, this - // counter pauses; it does not continue counting, nor does it - // reset to zero. - return mach_absolute_time(); -#elif defined(__i386__) - int64 ret; - __asm__ volatile ("rdtsc" : "=A" (ret) ); - return ret; -#elif defined(__x86_64__) || defined(__amd64__) - uint64 low, high; - __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high)); - return (high << 32) | low; -#elif defined(__powerpc64__) || defined(__ppc64__) - uint64 tb; - __asm__ volatile (\ - "mfspr %0, 268" - : "=r" (tb)); - return tb; -#elif defined(__powerpc__) || defined(__ppc__) - // This returns a time-base, which is not always precisely a cycle-count. - uint32 tbu, tbl, tmp; - __asm__ volatile (\ - "0:\n" - "mftbu %0\n" - "mftbl %1\n" - "mftbu %2\n" - "cmpw %0, %2\n" - "bne- 0b" - : "=r" (tbu), "=r" (tbl), "=r" (tmp)); - return (((uint64) tbu << 32) | tbl); -#elif defined(__sparc__) - int64 tick; - asm(".byte 0x83, 0x41, 0x00, 0x00"); - asm("mov %%g1, %0" : "=r" (tick)); - return tick; -#elif defined(__ia64__) - int64 itc; - asm("mov %0 = ar.itc" : "=r" (itc)); - return itc; -#elif defined(_MSC_VER) && defined(_M_IX86) - // Older MSVC compilers (like 7.x) don't seem to support the - // __rdtsc intrinsic properly, so I prefer to use _asm instead - // when I know it will work. Otherwise, I'll use __rdtsc and hope - // the code is being compiled with a non-ancient compiler. - _asm rdtsc -#elif defined(_MSC_VER) - return __rdtsc(); -#elif defined(ARMV3) || defined(__aarch64__) -#if defined(ARMV7) // V7 is the earliest arch that has a standard cyclecount - uint32 pmccntr; - uint32 pmuseren; - uint32 pmcntenset; - // Read the user mode perf monitor counter access permissions. - asm volatile ("mrc p15, 0, %0, c9, c14, 0" : "=r" (pmuseren)); - if (pmuseren & 1) { // Allows reading perfmon counters for user mode code. - asm volatile ("mrc p15, 0, %0, c9, c12, 1" : "=r" (pmcntenset)); - if (pmcntenset & 0x80000000ul) { // Is it counting? - asm volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r" (pmccntr)); - // The counter is set up to count every 64th cycle - return static_cast<int64>(pmccntr) * 64; // Should optimize to << 6 - } - } -#endif - struct timeval tv; - gettimeofday(&tv, NULL); - return static_cast<int64>((tv.tv_sec + tv.tv_usec * 0.000001) - * CyclesPerSecond()); -#elif defined(__mips__) - // mips apparently only allows rdtsc for superusers, so we fall - // back to gettimeofday. It's possible clock_gettime would be better. - struct timeval tv; - gettimeofday(&tv, NULL); - return static_cast<int64>((tv.tv_sec + tv.tv_usec * 0.000001) - * CyclesPerSecond()); -#else -// The soft failover to a generic implementation is automatic only for ARM. -// For other platforms the developer is expected to make an attempt to create -// a fast implementation and use generic version if nothing better is available. -#error You need to define CycleTimer for your O/S and CPU -#endif - } -}; - - -#endif // GOOGLE_BASE_CYCLECLOCK_H_ diff --git a/src/base/sysinfo.cc b/src/base/sysinfo.cc index 7b01e4c..789a47d 100644 --- a/src/base/sysinfo.cc +++ b/src/base/sysinfo.cc @@ -60,7 +60,6 @@ #include "base/commandlineflags.h" #include "base/dynamic_annotations.h" // for RunningOnValgrind #include "base/logging.h" -#include "base/cycleclock.h" #ifdef PLATFORM_WINDOWS #ifdef MODULEENTRY32 diff --git a/vsprojects/addressmap_unittest/addressmap_unittest.vcproj b/vsprojects/addressmap_unittest/addressmap_unittest.vcproj index d31836f..e63c4ec 100755 --- a/vsprojects/addressmap_unittest/addressmap_unittest.vcproj +++ b/vsprojects/addressmap_unittest/addressmap_unittest.vcproj @@ -286,9 +286,6 @@ RelativePath="..\..\src\base\spinlock_win32-inl.h">
</File>
<File
- RelativePath="..\..\src\base\cycleclock.h">
- </File>
- <File
RelativePath="..\..\src\base\dynamic_annotations.h">
</File>
<File
diff --git a/vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj b/vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj index bee8133..a82e4dd 100755 --- a/vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj +++ b/vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj @@ -331,9 +331,6 @@ RelativePath="..\..\src\config_for_unittests.h">
</File>
<File
- RelativePath="..\..\src\base\cycleclock.h">
- </File>
- <File
RelativePath="..\..\src\base\dynamic_annotations.h">
</File>
<File
diff --git a/vsprojects/packed-cache_test/packed-cache_test.vcproj b/vsprojects/packed-cache_test/packed-cache_test.vcproj index 387746c..9a53720 100755 --- a/vsprojects/packed-cache_test/packed-cache_test.vcproj +++ b/vsprojects/packed-cache_test/packed-cache_test.vcproj @@ -177,9 +177,6 @@ RelativePath="..\..\src\base\spinlock_win32-inl.h">
</File>
<File
- RelativePath="..\..\src\base\cycleclock.h">
- </File>
- <File
RelativePath="..\..\src\base\basictypes.h">
</File>
<File
|