Skip to content

Commit

Permalink
Debugging perfetto support with nvhpc
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Jan 3, 2023
1 parent b0a921e commit 420dcc4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/apex/CMakeLists.hpx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ set(apex_sources
gzstream.cpp
handler.cpp
memory_wrapper.cpp
${APEX_SOURCE_DIR}/src/perfetto_sdk/perfetto.cc
perfetto_listener.cpp
perfetto_static.cpp
policy_handler.cpp
profile_reducer.cpp
profiler_listener.cpp
Expand All @@ -361,6 +364,22 @@ set(apex_sources

include(GNUInstallDirs)

if (WIN32)
# Enable standards-compliant mode when using the Visual Studio compiler.
if (MSVC)
SET_SOURCE_FILES_PROPERTIES( perfetto.cc PROPERTIES COMPILE_FLAGS
"/permissive- /bigobj -DWIN32_LEAN_AND_MEAN -DNOMINMAX" )
else (MSVC)
SET_SOURCE_FILES_PROPERTIES( perfetto.cc PROPERTIES COMPILE_FLAGS
"/bigobj -DWIN32_LEAN_AND_MEAN -DNOMINMAX" )
endif (MSVC)
endif (WIN32)

# Force C++11 with NVHPC, it crashes otherwise
if (CMAKE_CXX_COMPILER_ID MATCHES NVHPC)
set(CMAKE_CXX_STANDARD 11)
endif()

# APEX has one dependency in HPX, just the main library.
# Unless HPXMP is also used.

Expand All @@ -379,6 +398,7 @@ target_include_directories(apex PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${APEX_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<BUILD_INTERFACE:${APEX_SOURCE_DIR}/src/perfetto_sdk>
$<INSTALL_INTERFACE:include>)

# To have the compile options and definitions
Expand Down
4 changes: 4 additions & 0 deletions src/perfetto_sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include_directories(${APEX_SOURCE_DIR}/src/perfetto_sdk)
# Force C++11 with NVHPC, it crashes otherwise
if (CMAKE_CXX_COMPILER_ID MATCHES NVHPC)
set(CMAKE_CXX_STANDARD 11)
endif()
add_library (perfetto perfetto.cc)

if (WIN32)
Expand Down
3 changes: 3 additions & 0 deletions src/perfetto_sdk/perfetto.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifdef __NVCOMPILER
#warning "nvc++ takes a long time to compile this file..."
#endif
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/perfetto_sdk/perfetto.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ enum class BufferExhaustedPolicy {
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_OFF() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_ON() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_OFF() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERBOSE_LOGS() (1)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERBOSE_LOGS() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERSION_GEN() (1)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_PERCENTILE() (0)
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_LINENOISE() (0)
Expand Down

0 comments on commit 420dcc4

Please sign in to comment.