Skip to content

Commit 3c4d02d

Browse files
Shi Leidanielleadams
Shi Lei
authored andcommitted
build,deps,src: fix Intel VTune profiling support
PR-URL: #45248 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent c8bbeb3 commit 3c4d02d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+16636
-2
lines changed

LICENSE

+12
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ The externally maintained libraries used by Node.js are:
107107
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108108
"""
109109

110+
- ittapi, located at deps/v8/third_party/ittapi, is licensed as follows:
111+
"""
112+
Copyright (c) 2019 Intel Corporation. All rights reserved.
113+
114+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
115+
116+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
117+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
118+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
119+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
120+
"""
121+
110122
- ICU, located at deps/icu-small, is licensed as follows:
111123
"""
112124
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE

configure.py

+16
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@
160160
help="Generate an executable with libgcc and libstdc++ libraries. This "
161161
"will not work on OSX when using the default compilation environment")
162162

163+
parser.add_argument("--enable-vtune-profiling",
164+
action="store_true",
165+
dest="enable_vtune_profiling",
166+
help="Enable profiling support for Intel VTune profiler to profile "
167+
"JavaScript code executed in Node.js. This feature is only available "
168+
"for x32, x86, and x64 architectures.")
169+
163170
parser.add_argument("--enable-pgo-generate",
164171
action="store_true",
165172
dest="enable_pgo_generate",
@@ -1309,6 +1316,15 @@ def configure_node(o):
13091316
if flavor == 'aix':
13101317
o['variables']['node_target_type'] = 'static_library'
13111318

1319+
if target_arch in ('x86', 'x64', 'ia32', 'x32'):
1320+
o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling)
1321+
elif options.enable_vtune_profiling:
1322+
raise Exception(
1323+
'The VTune profiler for JavaScript is only supported on x32, x86, and x64 '
1324+
'architectures.')
1325+
else:
1326+
o['variables']['node_enable_v8_vtunejit'] = 'false'
1327+
13121328
if flavor != 'linux' and (options.enable_pgo_generate or options.enable_pgo_use):
13131329
raise Exception(
13141330
'The pgo option is supported only on linux.')

deps/v8/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,4 @@ bazel-v8
121121
/third_party/zlib/contrib/bench
122122
/third_party/zlib/contrib/tests
123123
/third_party/zlib/google/test
124+
!/third_party/ittapi
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#
2+
# Copyright (C) 2005-2019 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 2.8.12)
8+
9+
project(ittapi)
10+
11+
OPTION(FORCE_32 "Force a 32bit compile on 64bit" OFF)
12+
OPTION(ITT_API_IPT_SUPPORT "ptmarks support")
13+
14+
IF(FORCE_32 AND UNIX)
15+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
16+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
17+
ENDIF()
18+
19+
if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT(FORCE_32))
20+
set(ARCH_64 1)
21+
endif()
22+
23+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
24+
add_definitions(-D_DEBUG)
25+
if (NOT WIN32)
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
27+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
28+
endif()
29+
else()
30+
if (NOT WIN32)
31+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
32+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
33+
endif()
34+
add_definitions(-DNDEBUG)
35+
endif()
36+
37+
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
38+
39+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
40+
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
41+
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${LIBRARY_OUTPUT_PATH} )
42+
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
43+
44+
set(ITT_PUBLIC_HDRS
45+
include/ittnotify.h
46+
include/jitprofiling.h
47+
include/libittnotify.h
48+
)
49+
50+
if (ITT_API_IPT_SUPPORT)
51+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DITT_API_IPT_SUPPORT")
52+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DITT_API_IPT_SUPPORT")
53+
if (NOT WIN32)
54+
enable_language(ASM)
55+
if (ARCH_64)
56+
set(ITT_PT src/ittnotify/ittptmark64.S)
57+
else()
58+
set(ASM_OPTIONS "-m32")
59+
set(ITT_PT src/ittnotify/ittptmark32.S)
60+
endif()
61+
set(CMAKE_ASM_FLAGS "${CFLAGS} ${ASM_OPTIONS}" )
62+
else()
63+
enable_language(ASM_MASM)
64+
if (ARCH_64)
65+
set(ITT_PT src/ittnotify/ittptmark64.asm)
66+
else()
67+
set(ITT_PT src/ittnotify/ittptmark32.asm)
68+
endif()
69+
endif()
70+
endif()
71+
72+
file(GLOB ITT_SRCS "src/ittnotify/*.c" "src/ittnotify/*.h")
73+
74+
add_library(ittnotify STATIC ${ITT_SRCS} ${ITT_PUBLIC_HDRS} ${ITT_PT})
75+
76+
if(WIN32)
77+
SET_TARGET_PROPERTIES(ittnotify PROPERTIES OUTPUT_NAME libittnotify)
78+
else()
79+
SET_TARGET_PROPERTIES(ittnotify PROPERTIES OUTPUT_NAME ittnotify)
80+
endif()
81+
82+
if (NOT WIN32)
83+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
84+
TARGET_LINK_LIBRARIES(ittnotify dl)
85+
endif()
86+
87+
SET_TARGET_PROPERTIES(ittnotify PROPERTIES LINKER_LANGUAGE C)
88+
89+
target_include_directories(ittnotify
90+
PUBLIC include src/ittnotify
91+
)
92+
93+
set(CMAKE_SUPPRESS_REGENERATION true)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Copyright (c) 2019 Intel Corporation. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)