Adding support for s390x in calculation of cpu_frequency (#12201)
This commit is contained in:
parent
7a144ad7fa
commit
ed6b0d9050
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user