1 //===-- xray_powerpc64.inc --------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file is a part of XRay, a dynamic runtime instrumentation system.
11 //===----------------------------------------------------------------------===//
16 #include <sys/platform/ppc.h>
17 #elif defined(__FreeBSD__)
18 #include <sys/types.h>
19 #include <sys/sysctl.h>
21 #define __ppc_get_timebase __builtin_ppc_get_timebase
23 uint64_t __ppc_get_timebase_freq (void)
26 size_t length = sizeof(tb_freq);
27 sysctlbyname("kern.timecounter.tc.timebase.frequency", &tb_freq, &length, nullptr, 0);
32 #include "xray_defs.h"
36 ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
38 return __ppc_get_timebase();
41 inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
43 std::lock_guard<std::mutex> Guard(M);
44 return __ppc_get_timebase_freq();
47 inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {