forked from twitter/pelikan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ITT instrumentation option (twitter#204)
- ref: twitter#238
- Loading branch information
1 parent
236c98d
commit 24e3131
Showing
5 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# ITTNOTIFY is the instrumentation and tracing technology (ITT) APIs provided by | ||
# the Intel® VTune™Amplifier enable your application to generate and control | ||
# the collection of trace data during its execution. | ||
# | ||
# The following variables are set when ITTNOTIFY is found: | ||
# ITTNOTIFY_FOUND = Set to true, if all components of ITTNOTIFY have been found. | ||
# ITTNOTIFY_INCLUDE_DIRS = Include path for the header files of ITTNOTIFY. | ||
# ITTNOTIFY_LIBRARY_DIRS = Library search path for the ITTNOTIFY libraries. | ||
# ITTNOTIFY_LIBRARIES = Link these to use ITTNOTIFY. | ||
# ITTNOTIFY_LFLAGS = Linker flags (optional). | ||
|
||
if (NOT ITTNOTIFY_FOUND) | ||
|
||
find_program(VTUNE_EXECUTABLE amplxe-cl) | ||
|
||
if(NOT VTUNE_EXECUTABLE) | ||
set(ITTNOTIFY_FOUND false) | ||
return() | ||
endif() | ||
|
||
get_filename_component(VTUNE_DIR ${VTUNE_EXECUTABLE} PATH) | ||
set(ITTNOTIFY_ROOT_DIR "${VTUNE_DIR}/..") | ||
|
||
##_____________________________________________________________________________ | ||
## Check for the header files | ||
|
||
find_path (ITTNOTIFY_INCLUDE_DIRS | ||
NAMES ittnotify.h | ||
HINTS ${ITTNOTIFY_ROOT_DIR} | ||
PATHS /usr /usr/local | ||
PATH_SUFFIXES include | ||
) | ||
|
||
##_____________________________________________________________________________ | ||
## Check for the library | ||
|
||
find_library (ITTNOTIFY_LIBRARIES ittnotify | ||
HINTS ${ITTNOTIFY_ROOT_DIR} | ||
PATHS /usr /usr/local /opt/local | ||
PATH_SUFFIXES lib64 lib | ||
) | ||
|
||
##_____________________________________________________________________________ | ||
## Actions taken when all components have been found | ||
|
||
find_package_handle_standard_args (ITTNOTIFY DEFAULT_MSG ITTNOTIFY_LIBRARIES ITTNOTIFY_INCLUDE_DIRS) | ||
|
||
if (ITTNOTIFY_FOUND) | ||
if (NOT ITTNOTIFY_FIND_QUIETLY) | ||
message (STATUS "Found components for ITTNOTIFY") | ||
message (STATUS "ITTNOTIFY_ROOT_DIR = ${ITTNOTIFY_ROOT_DIR}") | ||
message (STATUS "ITTNOTIFY_INCLUDE_DIRS = ${ITTNOTIFY_INCLUDE_DIRS}") | ||
message (STATUS "ITTNOTIFY_LIBRARIES = ${ITTNOTIFY_LIBRARIES}") | ||
endif (NOT ITTNOTIFY_FIND_QUIETLY) | ||
else (ITTNOTIFY_FOUND) | ||
if (ITTNOTIFY_FIND_REQUIRED) | ||
message (FATAL_ERROR "Could not find ITTNOTIFY!") | ||
endif (ITTNOTIFY_FIND_REQUIRED) | ||
endif (ITTNOTIFY_FOUND) | ||
|
||
if(UNIX) | ||
list(APPEND ITTNOTIFY_LIBRARIES dl) | ||
endif() | ||
|
||
endif (NOT ITTNOTIFY_FOUND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ | |
#cmakedefine HAVE_STATS | ||
|
||
#cmakedefine HAVE_DEBUG_MM | ||
|
||
#cmakedefine HAVE_ITT_INSTRUMENTATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#pragma once | ||
|
||
#include <cc_define.h> | ||
|
||
#ifdef CC_ITT | ||
#include "ittnotify.h" | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#ifdef CC_ITT | ||
|
||
#define ITT_DOMAIN_NAME "cc_itt" | ||
|
||
#define cc_declare_itt_function(_keyword, _name) \ | ||
_keyword __itt_heap_function _name | ||
|
||
#define cc_create_itt_malloc(_name) \ | ||
_name = __itt_heap_function_create(#_name, ITT_DOMAIN_NAME) | ||
|
||
#define cc_create_itt_free(_name) \ | ||
_name = __itt_heap_function_create(#_name, ITT_DOMAIN_NAME) | ||
|
||
#define cc_create_itt_realloc(_name) \ | ||
_name = __itt_heap_function_create(#_name, ITT_DOMAIN_NAME) | ||
|
||
#define cc_itt_alloc(_itt_heap_f, _p, _s) do { \ | ||
__itt_heap_allocate_begin(_itt_heap_f, (size_t)(_s), 0); \ | ||
__itt_heap_allocate_end(_itt_heap_f, (void *)&(_p), (size_t)(_s), 0); \ | ||
} while (0) | ||
|
||
#define cc_itt_zalloc(_itt_heap_f, _p, _s) do { \ | ||
__itt_heap_allocate_begin(_itt_heap_f, (size_t)(_s), 1); \ | ||
__itt_heap_allocate_end(_itt_heap_f, (void *)&(_p), (size_t)(_s), 1); \ | ||
} while (0) | ||
|
||
#define cc_itt_free(_itt_heap_f, _p) do { \ | ||
__itt_heap_free_begin(_itt_heap_f, _p); \ | ||
__itt_heap_free_end(_itt_heap_f, _p); \ | ||
} while (0) | ||
|
||
#define cc_itt_realloc(_itt_heap_f, _p, _np, _s) do { \ | ||
__itt_heap_reallocate_begin(_itt_heap_f, _p, (size_t)(_s), 0); \ | ||
__itt_heap_reallocate_end(_itt_heap_f, _p, (void *)&(_np), (size_t)(_s), 0); \ | ||
} while (0) | ||
|
||
#define cc_itt_heap_internal_access() \ | ||
__itt_heap_internal_access_begin() | ||
|
||
#define cc_itt_heap_internal_access_end() \ | ||
__itt_heap_internal_access_end() | ||
|
||
#else | ||
#define cc_declare_itt_function(_keyword, _name) | ||
#define cc_create_itt_malloc(_name) | ||
#define cc_create_itt_free(_name) | ||
#define cc_create_itt_realloc(_name) | ||
#define cc_itt_alloc(_itt_heap_f, _p, _s) | ||
#define cc_itt_zalloc(_itt_heap_f, _p, _s) | ||
#define cc_itt_free(_itt_heap_f, _p) | ||
#define cc_itt_realloc(_itt_heap_f, _p, _np, _s) | ||
#define cc_itt_heap_internal_access_begin() | ||
#define cc_itt_heap_internal_access_end() | ||
#endif /* CC_ITT */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |