1 #include "node.h" 2 #include "v8.h" 3 #include "v8-profiler.h" 4 StartCpuProfiler(const v8::FunctionCallbackInfo<v8::Value> & args)5static void StartCpuProfiler(const v8::FunctionCallbackInfo<v8::Value>& args) { 6 v8::CpuProfiler* profiler = v8::CpuProfiler::New(args.GetIsolate()); 7 v8::Local<v8::String> profile_title = v8::String::NewFromUtf8( 8 args.GetIsolate(), 9 "testing", 10 v8::NewStringType::kInternalized).ToLocalChecked(); 11 profiler->StartProfiling(profile_title, true); 12 } 13 NODE_MODULE_INIT()14NODE_MODULE_INIT(/* exports, module, context */) { 15 NODE_SET_METHOD(exports, "startCpuProfiler", StartCpuProfiler); 16 } 17