Sampling Memory Allocations
StartSampling and StopSampling just wrap the respective v8 API calls
NAN_METHOD(StartSampling) {
Local<Integer> interval = info[0].As<Integer>();
Local<Integer> stack_depth = info[1].As<Integer>();
HeapProfiler* hp = info.GetIsolate()->GetHeapProfiler();
hp->StartSamplingHeapProfiler(interval->Value(), stack_depth->Value());
}
NAN_METHOD(StopSampling) {
HeapProfiler* hp = info.GetIsolate()->GetHeapProfiler();
hp->StopSamplingHeapProfiler();
}
exports->Set(Nan::New<String>("startSampling").ToLocalChecked(),
Nan::New<FunctionTemplate>(StartSampling)->GetFunction());
exports->Set(Nan::New<String>("stopSampling").ToLocalChecked(),
Nan::New<FunctionTemplate>(StopSampling)->GetFunction());