| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1f0e8dc commit ed255ab
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,6 +86,14 @@ parser.add_option("--fully-static", | |||
| 86 | 86 | help="Generate an executable without external dynamic libraries. This " | |
| 87 | 87 | "will not work on OSX when using default compilation environment") | |
| 88 | 88 | ||
| 89 | + parser.add_option("--enable-vtune-profiling", | ||
| 90 | + action="store_true", | ||
| 91 | + dest="enable_vtune_profiling", | ||
| 92 | + help="Enable profiling support for Intel Vtune profiler to profile" | ||
| 93 | + "JavaScript code executed in nodejs. This feature is only available " | ||
| 94 | + "for ia32, x32 or x64 platform.") | ||
| 95 | + | ||
| 96 | + | ||
| 89 | 97 | parser.add_option("--link-module", | |
| 90 | 98 | action="append", | |
| 91 | 99 | dest="linked_module", | |
@@ -679,6 +687,15 @@ def configure_node(o): | |||
| 679 | 687 | o['variables']['node_core_target_name'] = 'node_base' | |
| 680 | 688 | o['variables']['node_target_type'] = 'static_library' | |
| 681 | 689 | ||
| 690 | + if target_arch in ('x86', 'x64', 'ia32', 'x32'): | ||
| 691 | + o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling) | ||
| 692 | + elif options.enable_vtune_profiling: | ||
| 693 | + raise Exception( | ||
| 694 | + 'vtune profiler for JavaScript is only supported on x86, x32 or x64 ' | ||
| 695 | + 'platform.') | ||
| 696 | + else: | ||
| 697 | + o['variables']['node_enable_v8_vtunejit'] = 'false' | ||
| 698 | + | ||
| 682 | 699 | if flavor in ('solaris', 'mac', 'linux', 'freebsd'): | |
| 683 | 700 | use_dtrace = not options.without_dtrace | |
| 684 | 701 | # Don't enable by default on linux and freebsd | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ | |||
| 12 | 12 | 'node_use_openssl%': 'true', | |
| 13 | 13 | 'node_shared_openssl%': 'false', | |
| 14 | 14 | 'node_v8_options%': '', | |
| 15 | + 'node_enable_v8_vtunejit%': 'false', | ||
| 15 | 16 | 'node_target_type%': 'executable', | |
| 16 | 17 | 'node_core_target_name%': 'node', | |
| 17 | 18 | 'library_files': [ | |
@@ -221,6 +222,13 @@ | |||
| 221 | 222 | 'defines': [ 'NODE_HAVE_SMALL_ICU=1' ], | |
| 222 | 223 | }]], | |
| 223 | 224 | }], | |
| 225 | + [ 'node_enable_v8_vtunejit=="true" and (target_arch=="x64" or \ | ||
| 226 | + target_arch=="ia32" or target_arch=="x32")', { | ||
| 227 | + 'defines': [ 'NODE_ENABLE_VTUNE_PROFILING' ], | ||
| 228 | + 'dependencies': [ | ||
| 229 | + 'deps/v8/src/third_party/vtune/v8vtune.gyp:v8_vtune' | ||
| 230 | + ], | ||
| 231 | + }], | ||
| 224 | 232 | [ 'node_use_openssl=="true"', { | |
| 225 | 233 | 'defines': [ 'HAVE_OPENSSL=1' ], | |
| 226 | 234 | 'sources': [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,10 @@ | |||
| 43 | 43 | #include "v8-profiler.h" | |
| 44 | 44 | #include "zlib.h" | |
| 45 | 45 | ||
| 46 | + #ifdef NODE_ENABLE_VTUNE_PROFILING | ||
| 47 | + #include "../deps/v8/src/third_party/vtune/v8-vtune.h" | ||
| 48 | + #endif | ||
| 49 | + | ||
| 46 | 50 | #include <errno.h> | |
| 47 | 51 | #include <limits.h> // PATH_MAX | |
| 48 | 52 | #include <locale.h> | |
@@ -4025,6 +4029,9 @@ static void StartNodeInstance(void* arg) { | |||
| 4025 | 4029 | Isolate::CreateParams params; | |
| 4026 | 4030 | ArrayBufferAllocator* array_buffer_allocator = new ArrayBufferAllocator(); | |
| 4027 | 4031 | params.array_buffer_allocator = array_buffer_allocator; | |
| 4032 | + #ifdef NODE_ENABLE_VTUNE_PROFILING | ||
| 4033 | + params.code_event_handler = vTune::GetVtuneCodeEventHandler(); | ||
| 4034 | + #endif | ||
| 4028 | 4035 | Isolate* isolate = Isolate::New(params); | |
| 4029 | 4036 | if (track_heap_objects) { | |
| 4030 | 4037 | isolate->GetHeapProfiler()->StartTrackingHeapObjects(true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,7 @@ set i18n_arg= | |||
| 37 | 37 | set download_arg= | |
| 38 | 38 | set release_urls_arg= | |
| 39 | 39 | set build_release= | |
| 40 | + set enable_vtune_profiling= | ||
| 40 | 41 | ||
| 41 | 42 | :next-arg | |
| 42 | 43 | if "%1"=="" goto args-done | |
@@ -71,6 +72,7 @@ if /i "%1"=="full-icu" set i18n_arg=%1&goto arg-ok | |||
| 71 | 72 | if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok | |
| 72 | 73 | if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok | |
| 73 | 74 | if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok | |
| 75 | + if /i "%1"=="enable-vtune" set enable_vtune_profiling="--enable-vtune-profiling"&goto arg-ok | ||
| 74 | 76 | ||
| 75 | 77 | echo Warning: ignoring invalid command line option `%1`. | |
| 76 | 78 | ||
@@ -168,7 +170,7 @@ goto run | |||
| 168 | 170 | if defined noprojgen goto msbuild | |
| 169 | 171 | ||
| 170 | 172 | @rem Generate the VS project. | |
| 171 | - python configure %download_arg% %i18n_arg% %debug_arg% %snapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% | ||
| 173 | + python configure %download_arg% %i18n_arg% %debug_arg% %snapshot_arg% %noetw_arg% %noperfctr_arg% %enable_vtune_profiling% --dest-cpu=%target_arch% --tag=%TAG% | ||
| 172 | 174 | if errorlevel 1 goto create-msvs-files-failed | |
| 173 | 175 | if not exist node.sln goto create-msvs-files-failed | |
| 174 | 176 | echo Project files generated. | |
@@ -259,13 +261,14 @@ echo Failed to create vc project files. | |||
| 259 | 261 | goto exit | |
| 260 | 262 | ||
| 261 | 263 | :help | |
| 262 | - echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/intl-none] [nobuild] [nosign] [x86/x64] [download-all] | ||
| 264 | + echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/intl-none] [nobuild] [nosign] [x86/x64] [download-all] [enable-vtune] | ||
| 263 | 265 | echo Examples: | |
| 264 | 266 | echo vcbuild.bat : builds release build | |
| 265 | 267 | echo vcbuild.bat debug : builds debug build | |
| 266 | 268 | echo vcbuild.bat release msi : builds release build and MSI installer package | |
| 267 | 269 | echo vcbuild.bat test : builds debug build and runs tests | |
| 268 | 270 | echo vcbuild.bat build-release : builds the release distribution as used by nodejs.org | |
| 271 | + echo vcbuild.bat enable-vtune : builds nodejs with Intel Vtune profiling support to profile JavaScript | ||
| 269 | 272 | goto exit | |
| 270 | 273 | ||
| 271 | 274 | :exit | |
| Back | FazBrowse Home | New Git URL |
0 commit comments