Adding support for s390x in calculation of cpu_frequency (#12201)

This commit is contained in:
namrata-ibm 2017-08-11 20:58:49 +05:30 committed by Rasmus Munk Larsen
parent 7a144ad7fa
commit ed6b0d9050
3 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ namespace profile_utils {
static ICpuUtilsHelper* cpu_utils_helper_instance_ = nullptr;
#if defined(__powerpc__) || defined(__ppc__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#if (defined(__powerpc__) || defined(__ppc__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || (defined(__s390x__))
/* static */ uint64 CpuUtils::GetCycleCounterFrequency() {
static const uint64 cpu_frequency = GetCycleCounterFrequencyImpl();
return cpu_frequency;

View File

@ -97,7 +97,7 @@ class CpuUtils {
// Return cycle counter frequency.
// As this method caches the cpu frequency internally,
// the first call will incur overhead, but not subsequent calls.
#if defined(__powerpc__) || defined(__ppc__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#if (defined(__powerpc__) || defined(__ppc__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || (defined(__s390x__))
static uint64 GetCycleCounterFrequency();
#else
static int64 GetCycleCounterFrequency();

View File

@ -53,7 +53,7 @@ TEST_F(CpuUtilsTest, CheckGetCurrentClockCycle) {
}
TEST_F(CpuUtilsTest, CheckCycleCounterFrequency) {
#if defined(__powerpc__) || defined(__ppc__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#if (defined(__powerpc__) || defined(__ppc__) && ( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || (defined(__s390x__))
const uint64 cpu_frequency = CpuUtils::GetCycleCounterFrequency();
CHECK_GT(cpu_frequency, 0);
CHECK_NE(cpu_frequency, unsigned(CpuUtils::INVALID_FREQUENCY));