diff options
Diffstat (limited to 'src/node_options.cc')
-rw-r--r-- | src/node_options.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/node_options.cc b/src/node_options.cc index 37aefca1e4..da7a49231f 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -168,6 +168,19 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { } } + if (!heap_prof) { + if (!heap_prof_name.empty()) { + errors->push_back("--heap-prof-name must be used with --heap-prof"); + } + if (!heap_prof_dir.empty()) { + errors->push_back("--heap-prof-dir must be used with --heap-prof"); + } + // We can't catch the case where the value passed is the default value, + // then the option just becomes a noop which is fine. + if (heap_prof_interval != kDefaultHeapProfInterval) { + errors->push_back("--heap-prof-interval must be used with --heap-prof"); + } + } debug_options_.CheckOptions(errors); #endif // HAVE_INSPECTOR } @@ -369,6 +382,24 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "Directory where the V8 profiles generated by --cpu-prof will be " "placed. Does not affect --prof.", &EnvironmentOptions::cpu_prof_dir); + AddOption( + "--heap-prof", + "Start the V8 heap profiler on start up, and write the heap profile " + "to disk before exit. If --heap-prof-dir is not specified, write " + "the profile to the current working directory.", + &EnvironmentOptions::heap_prof); + AddOption("--heap-prof-name", + "specified file name of the V8 CPU profile generated with " + "--heap-prof", + &EnvironmentOptions::heap_prof_name); + AddOption("--heap-prof-dir", + "Directory where the V8 heap profiles generated by --heap-prof " + "will be placed.", + &EnvironmentOptions::heap_prof_dir); + AddOption("--heap-prof-interval", + "specified sampling interval in bytes for the V8 heap " + "profile generated with --heap-prof. (default: 512 * 1024)", + &EnvironmentOptions::heap_prof_interval); #endif // HAVE_INSPECTOR AddOption("--redirect-warnings", "write warnings to file instead of stderr", |