Skip to content

Commit

Permalink
Updated perfetto's GN build files to support traced compilation in QNX
Browse files Browse the repository at this point in the history
Created new argument 'is_qnx' to handle all QNX-specific compilation
steps in GN build system. Currently, compilation for QNX is only
supported via perfetto's standalone builds. Also, updated the perfetto's
codebase to avoid running Linux-specific code in QNX. When compiling for
QNX the PERFETTO_OS_LINUX flag is still set to keep the QNX build as
compatible as possible with the Linux build.

With this change, one can build the QNX target of traced by compiling
with the following args.gn file:
'''
target_os = "qnx"
target_cpu = "arm64"
'''

Only arm64 architecture is supported and one needs to setup the QNX
developer environment before being able to compile.

NOTE: traced_relay compiles but still does not run with this change.

Test: tools/ninja -C out/qnx traced traced_relay perfetto
Bug: 382283537
Change-Id: I08bd3672a60b69cb92ba87eaeda9cec5b893afbc
  • Loading branch information
Jahdiel Alvarez committed Dec 11, 2024
1 parent 785e811 commit 61f4b96
Show file tree
Hide file tree
Showing 26 changed files with 227 additions and 40 deletions.
9 changes: 7 additions & 2 deletions gn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ action("gen_buildflags") {
# We can't just use (is_linux || is_android) in perfetto.gni because that
# doesn't work in Android Mac host builds. We lose the GN notion of OS once
# we run the tools/gen_xxx generators.
#
# Currently, QNX has the OS_LINUX flag enabled to remain as compatible as
# possible. Watchdog is an exception where it uses Linux-specific system
# calls. Therefore we skip enabling the watchdog in QNX.
if (enable_perfetto_watchdog) {
perfetto_watchdog = "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || " +
"PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX()"
perfetto_watchdog =
"PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || " +
"PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX()"
} else {
perfetto_watchdog = "0"
}
Expand Down
9 changes: 5 additions & 4 deletions gn/perfetto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ declare_args() {
enable_perfetto_integration_tests =
perfetto_build_standalone || perfetto_build_with_android

enable_perfetto_benchmarks = perfetto_build_standalone && !is_win
enable_perfetto_benchmarks = perfetto_build_standalone && !is_win && !is_qnx

enable_perfetto_fuzzers =
perfetto_build_standalone && defined(is_fuzzer) && is_fuzzer
Expand Down Expand Up @@ -237,7 +237,7 @@ declare_args() {
# the stack and prints the stack trace on stderr. Requires a dependency on
# libbacktrace when enabled.
enable_perfetto_stderr_crash_dump =
is_debug && perfetto_build_standalone && !is_wasm && !is_win
is_debug && perfetto_build_standalone && !is_wasm && !is_win && !is_qnx

# Enables more aggressive compiler flags that assume recent Intel CPUs.
# Runtime checks during initialization will print an error message and exit
Expand Down Expand Up @@ -269,12 +269,13 @@ declare_args() {

# The traced_probes daemon is very Linux-specific, as it depends on ftrace and
# various /proc interfaces. There is no point making its code platform-neutral
# as it won't do anything useful on Windows.
# as it won't do anything useful on Windows or QNX.
# The only reason why we still build it on Mac OS is to be able to run the
# unittests there and making dev on mac less cumbersome. The traced_probes
# code happens to build cleanly and for now the mainteinance cost on Mac is
# extremely low.
enable_perfetto_traced_probes = enable_perfetto_platform_services && !is_win
enable_perfetto_traced_probes =
enable_perfetto_platform_services && !is_win && !is_qnx

# The relay service is enabled when platform services are enabled.
# TODO(chinglinyu) check if we can enable on Windows.
Expand Down
16 changes: 8 additions & 8 deletions gn/proto_library.gni
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ template("ipc_library") {
} else {
link_deps += [ "$perfetto_root_path/src/ipc:common" ]
}
if (is_win) {
# TODO(primiano): investigate this. In Windows standalone builds, some
# executable targets end up in a state where no code pulls a dep on the
# ipc:client (in turn that seems a subtle consequence of not having
# traced_probes on Windows). This dep here is effectively needed because
# the client-side code in the generated .ipc.cc effectively depends on the
# client-side IPC library. Perhaps we just should do this unconditionally
# on all platforms?
if (is_win || is_qnx) {
# TODO(primiano): investigate this. In Windows and QNX standalone builds,
# some executable targets end up in a state where no code pulls a dep on
# the ipc:client (in turn that seems a subtle consequence of not having
# traced_probes on Windows or QNX). This dep here is effectively needed
# because the client-side code in the generated .ipc.cc effectively
# depends on the client-side IPC library. Perhaps we just should do this
# unconditionally on all platforms?
if (perfetto_component_type == "static_library") {
link_deps += [ "$perfetto_root_path/src/ipc:perfetto_ipc" ]
} else {
Expand Down
20 changes: 18 additions & 2 deletions gn/standalone/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ config("default") {
ldflags = []
libs = []

if ((is_android || is_linux) && !is_wasm) {
if ((is_android || is_linux || is_qnx) && !is_wasm) {
ldflags += [
"-Wl,--build-id",
"-Wl,-z,max-page-size=16384",
Expand Down Expand Up @@ -335,6 +335,16 @@ config("default") {
]
}

if (is_qnx) {
cflags += [
"-D_QNX_SOURCE",
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE_SOURCE",
"-D_LARGEFILE64_SOURCE",
]
libs += [ "socket" ]
}

if (is_win && !is_clang) {
# When using MSVC we need to manually pass the include dirs. clang-cl.exe
# doesn't need them because it's smart enough to figure out the right path
Expand All @@ -352,7 +362,7 @@ config("default") {
cflags += [ "-gcodeview-ghash" ]
ldflags = [ "/DEBUG:GHASH" ]
}
} else {
} else if (!is_qnx) {
libs += [ "dl" ]
}
}
Expand Down Expand Up @@ -431,6 +441,12 @@ config("release") {
]
} else if (is_mac) {
ldflags = [ "-dead_strip" ]
} else if (is_qnx) {
# QNX doesn't support the --icf linker option
ldflags = [
"-Wl,--gc-sections",
"-Wl,-O1",
]
} else if (!is_win && !is_wasm) {
ldflags = [
"-Wl,--gc-sections",
Expand Down
5 changes: 4 additions & 1 deletion gn/standalone/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

declare_args() {
is_debug = true
is_clang = true
is_system_compiler = false
is_lto = false

# Currently QNX is only supported via their gcc-compatible compiler.
is_clang = target_os != "qnx"

# This is defined here because it's needed below for determining the value of
# |is_cross_compiling|.
target_triplet = ""
Expand All @@ -39,6 +41,7 @@ is_mac = current_os == "mac"
is_mac_host = host_os == "mac"
is_win = current_os == "win"
is_win_host = host_os == "win"
is_qnx = current_os == "qnx"

# Building with Windows/Fuchsia/nacl is currently only supported in the Chromium
# tree so always set this to false.
Expand Down
33 changes: 30 additions & 3 deletions gn/standalone/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ declare_args() {
_target_triplet = "i686-linux-android"
} else if (target_os == "android" && target_cpu == "x64") {
_target_triplet = "x86_64-linux-android"
} else if (target_os == "qnx" && target_cpu == "arm64") {
_target_triplet = "ntoaarch64"
} else {
assert(
false,
Expand All @@ -160,6 +162,9 @@ declare_args() {
if (sysroot != "") {
# If the user specifies a sysroot, use that for both host and target.
target_sysroot = sysroot
} else if (is_qnx) {
# Do not set any sysroot for QNX.
target_sysroot = ""
} else {
# If no explicit sysroot has been set, use the guessed sysroot from the ones
# pulled by //tools/install-build-deps (only for Linux).
Expand Down Expand Up @@ -190,6 +195,12 @@ declare_args() {
target_cxx = "$android_llvm_dir/bin/clang++"
target_linker = "$android_llvm_dir/bin/ld.lld"
target_strip = "$android_llvm_dir/bin/llvm-strip"
} else if (is_qnx) {
target_ar = "${_target_triplet}-ar"
target_cc = "qcc -V8.3.0,gcc_${_target_triplet}le"
target_cxx = "q++ -V8.3.0,gcc_${_target_triplet}le_cxx"
target_linker = "${_target_triplet}-ld"
target_strip = "${_target_triplet}-strip"
} else {
assert(_target_triplet != "",
"target_triplet must be non-empty when cross-compiling")
Expand All @@ -207,6 +218,7 @@ declare_args() {
target_ar = "${_target_triplet}-ar"
target_cc = "${_target_triplet}-gcc"
target_cxx = "${_target_triplet}-g++"
target_strip = "${_target_triplet}-strip"
}
}
}
Expand Down Expand Up @@ -253,7 +265,12 @@ template("gcc_like_toolchain") {

tool("cc") {
depfile = "{{output}}.d"
command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} ${external_cflags} -c {{source}} -o {{output}}"
if (is_qnx) {
depfile_args = "-Wp,-MMD,$depfile -Wp,-MF,$depfile"
} else {
depfile_args = "-MMD -MF $depfile"
}
command = "$cc_wrapper $cc $depfile_args {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} ${external_cflags} -c {{source}} -o {{output}}"
depsformat = "gcc"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
Expand All @@ -262,7 +279,12 @@ template("gcc_like_toolchain") {

tool("cxx") {
depfile = "{{output}}.d"
command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} ${external_cflags} ${external_cxxflags} -c {{source}} -o {{output}}"
if (is_qnx) {
depfile_args = "-Wp,-MMD,$depfile -Wp,-MF,$depfile"
} else {
depfile_args = "-MMD -MF $depfile"
}
command = "$cc_wrapper $cxx $depfile_args {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} ${external_cflags} ${external_cxxflags} -c {{source}} -o {{output}}"
depsformat = "gcc"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
Expand All @@ -271,7 +293,12 @@ template("gcc_like_toolchain") {

tool("asm") {
depfile = "{{output}}.d"
command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
if (is_qnx) {
depfile_args = "-Wp,-MMD,$depfile -Wp,-MF,$depfile"
} else {
depfile_args = "-MMD -MF $depfile"
}
command = "$cc_wrapper $cc $depfile_args {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
depsformat = "gcc"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
Expand Down
25 changes: 25 additions & 0 deletions include/perfetto/base/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,25 @@
#if defined(__ANDROID__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 0
#elif defined(__APPLE__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 0
// Include TARGET_OS_IPHONE when on __APPLE__ systems.
#include <TargetConditionals.h>
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
Expand All @@ -54,46 +58,67 @@
#elif defined(__linux__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 0
#elif defined(__QNXNTO__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 1
#elif defined(_WIN32)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 0
#elif defined(__EMSCRIPTEN__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 0
#elif defined(__Fuchsia__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_NACL() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_QNX() 0
#elif defined(__native_client__)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_STANDALONE_BUILD() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_START_DAEMONS() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_IPC() (1)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_WATCHDOG() (PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX())
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_WATCHDOG() (PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX_BUT_NOT_QNX())
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPONENT_BUILD() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_ETM_IMPORTER() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_ON() (0)
Expand Down
6 changes: 5 additions & 1 deletion include/perfetto/base/thread_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
}
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_FUCHSIA)
#include <zircon/types.h>
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_QNX)
#include <sys/types.h>
#include <unistd.h>
#elif PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
#include <sys/syscall.h>
Expand All @@ -41,7 +44,8 @@ __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
namespace perfetto {
namespace base {

#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
PERFETTO_BUILDFLAG(PERFETTO_OS_QNX)
using PlatformThreadId = pid_t;
inline PlatformThreadId GetThreadId() {
return gettid();
Expand Down
27 changes: 27 additions & 0 deletions include/perfetto/base/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,33 @@ inline TimeNanos GetBootTimeNs() {
return TimeNanos(0);
}

#elif PERFETTO_BUILDFLAG(PERFETTO_OS_QNX)

constexpr clockid_t kWallTimeClockSource = CLOCK_MONOTONIC;

inline TimeNanos GetTimeInternalNs(clockid_t clk_id) {
struct timespec ts = {};
PERFETTO_CHECK(clock_gettime(clk_id, &ts) == 0);
return FromPosixTimespec(ts);
}

inline TimeNanos GetWallTimeNs() {
return GetTimeInternalNs(kWallTimeClockSource);
}

inline TimeNanos GetWallTimeRawNs() {
return GetTimeInternalNs(CLOCK_MONOTONIC);
}

inline TimeNanos GetThreadCPUTimeNs() {
return GetTimeInternalNs(CLOCK_THREAD_CPUTIME_ID);
}

// TODO: Clock that counts time during suspend is not implemented on QNX.
inline TimeNanos GetBootTimeNs() {
return GetWallTimeNs();
}

#else // posix

constexpr clockid_t kWallTimeClockSource = CLOCK_MONOTONIC;
Expand Down
5 changes: 4 additions & 1 deletion include/perfetto/ext/base/event_fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class EventFd {
// the pipe for fallback mode.
ScopedPlatformHandle event_handle_;

#if !PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && \
// QNX is specified because it is a non-Linux UNIX platform but it
// still sets the PERFETTO_OS_LINUX flag to be as compatible as possible
// with the Linux build.
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX_BUT_NOT_QNX) && \
!PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) && \
!PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
// On Mac and other non-Linux UNIX platforms a pipe-based fallback is used.
Expand Down
Loading

0 comments on commit 61f4b96

Please sign in to comment.