| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 470bd7d commit 834ea2c
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,6 +92,14 @@ parser.add_option("--partly-static", | |||
| 92 | 92 | help="Generate an executable with libgcc and libstdc++ libraries. This " | |
| 93 | 93 | "will not work on OSX when using the default compilation environment") | |
| 94 | 94 | ||
| 95 | + parser.add_option("--enable-vtune-profiling", | ||
| 96 | + action="store_true", | ||
| 97 | + dest="enable_vtune_profiling", | ||
| 98 | + help="Enable profiling support for Intel Vtune profiler to profile" | ||
| 99 | + "JavaScript code executed in nodejs. This feature is only available " | ||
| 100 | + "for ia32, x32 or x64 platform.") | ||
| 101 | + | ||
| 102 | + | ||
| 95 | 103 | parser.add_option("--link-module", | |
| 96 | 104 | action="append", | |
| 97 | 105 | dest="linked_module", | |
@@ -686,6 +694,15 @@ def configure_node(o): | |||
| 686 | 694 | o['variables']['node_core_target_name'] = 'node_base' | |
| 687 | 695 | o['variables']['node_target_type'] = 'static_library' | |
| 688 | 696 | ||
| 697 | + if target_arch in ('x86', 'x64', 'ia32', 'x32'): | ||
| 698 | + o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling) | ||
| 699 | + elif options.enable_vtune_profiling: | ||
| 700 | + raise Exception( | ||
| 701 | + 'vtune profiler for JavaScript is only supported on x86, x32 or x64 ' | ||
| 702 | + 'platform.') | ||
| 703 | + else: | ||
| 704 | + o['variables']['node_enable_v8_vtunejit'] = 'false' | ||
| 705 | + | ||
| 689 | 706 | if flavor in ('solaris', 'mac', 'linux', 'freebsd'): | |
| 690 | 707 | use_dtrace = not options.without_dtrace | |
| 691 | 708 | # 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': [ | |
@@ -235,6 +236,13 @@ | |||
| 235 | 236 | 'defines': [ 'NODE_HAVE_SMALL_ICU=1' ], | |
| 236 | 237 | }]], | |
| 237 | 238 | }], | |
| 239 | + [ 'node_enable_v8_vtunejit=="true" and (target_arch=="x64" or \ | ||
| 240 | + target_arch=="ia32" or target_arch=="x32")', { | ||
| 241 | + 'defines': [ 'NODE_ENABLE_VTUNE_PROFILING' ], | ||
| 242 | + 'dependencies': [ | ||
| 243 | + 'deps/v8/src/third_party/vtune/v8vtune.gyp:v8_vtune' | ||
| 244 | + ], | ||
| 245 | + }], | ||
| 238 | 246 | [ 'node_use_openssl=="true"', { | |
| 239 | 247 | 'defines': [ 'HAVE_OPENSSL=1' ], | |
| 240 | 248 | 'sources': [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,6 +44,10 @@ | |||
| 44 | 44 | #include "v8-profiler.h" | |
| 45 | 45 | #include "zlib.h" | |
| 46 | 46 | ||
| 47 | + #ifdef NODE_ENABLE_VTUNE_PROFILING | ||
| 48 | + #include "../deps/v8/src/third_party/vtune/v8-vtune.h" | ||
| 49 | + #endif | ||
| 50 | + | ||
| 47 | 51 | #include <errno.h> | |
| 48 | 52 | #include <limits.h> // PATH_MAX | |
| 49 | 53 | #include <locale.h> | |
@@ -4070,6 +4074,9 @@ static void StartNodeInstance(void* arg) { | |||
| 4070 | 4074 | Isolate::CreateParams params; | |
| 4071 | 4075 | ArrayBufferAllocator* array_buffer_allocator = new ArrayBufferAllocator(); | |
| 4072 | 4076 | params.array_buffer_allocator = array_buffer_allocator; | |
| 4077 | + #ifdef NODE_ENABLE_VTUNE_PROFILING | ||
| 4078 | + params.code_event_handler = vTune::GetVtuneCodeEventHandler(); | ||
| 4079 | + #endif | ||
| 4073 | 4080 | Isolate* isolate = Isolate::New(params); | |
| 4074 | 4081 | if (track_heap_objects) { | |
| 4075 | 4082 | isolate->GetHeapProfiler()->StartTrackingHeapObjects(true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,6 +36,7 @@ set release_urls_arg= | |||
| 36 | 36 | set build_release= | |
| 37 | 37 | set configure_flags= | |
| 38 | 38 | set build_addons= | |
| 39 | + set enable_vtune_profiling= | ||
| 39 | 40 | ||
| 40 | 41 | :next-arg | |
| 41 | 42 | if "%1"=="" goto args-done | |
@@ -73,6 +74,7 @@ if /i "%1"=="full-icu" set i18n_arg=%1&goto arg-ok | |||
| 73 | 74 | if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok | |
| 74 | 75 | if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok | |
| 75 | 76 | if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok | |
| 77 | + if /i "%1"=="enable-vtune" set enable_vtune_profiling="--enable-vtune-profiling"&goto arg-ok | ||
| 76 | 78 | ||
| 77 | 79 | echo Warning: ignoring invalid command line option `%1`. | |
| 78 | 80 | ||
@@ -179,7 +181,7 @@ if defined noprojgen goto msbuild | |||
| 179 | 181 | ||
| 180 | 182 | @rem Generate the VS project. | |
| 181 | 183 | echo configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG% | |
| 182 | - python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG% | ||
| 184 | + python configure %configure_flags% %enable_vtune_profiling% --dest-cpu=%target_arch% --tag=%TAG% | ||
| 183 | 185 | if errorlevel 1 goto create-msvs-files-failed | |
| 184 | 186 | if not exist node.sln goto create-msvs-files-failed | |
| 185 | 187 | echo Project files generated. | |
@@ -294,14 +296,15 @@ goto exit | |||
| 294 | 296 | ||
| 295 | 297 | :help | |
| 296 | 298 | ||
| 297 | - 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] [vc2013/vc2015] [download-all] | ||
| 299 | + 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] [vc2013/vc2015] [download-all] [enable-vtune] | ||
| 298 | 300 | ||
| 299 | 301 | echo Examples: | |
| 300 | 302 | echo vcbuild.bat : builds release build | |
| 301 | 303 | echo vcbuild.bat debug : builds debug build | |
| 302 | 304 | echo vcbuild.bat release msi : builds release build and MSI installer package | |
| 303 | 305 | echo vcbuild.bat test : builds debug build and runs tests | |
| 304 | 306 | echo vcbuild.bat build-release : builds the release distribution as used by nodejs.org | |
| 307 | + echo vcbuild.bat enable-vtune : builds nodejs with Intel Vtune profiling support to profile JavaScript | ||
| 305 | 308 | goto exit | |
| 306 | 309 | ||
| 307 | 310 | :exit | |
| Back | FazBrowse Home | New Git URL |
0 commit comments