Permalink
Browse files

profiler, feat: profiler.start(name, -1) will profile for ever.

  • Loading branch information...
xicilion committed Oct 17, 2017
1 parent c79d4bd commit 7b42a50f6b1fd52af97407e24cbd06c4c9f99194
Showing with 7 additions and 3 deletions.
  1. +7 −3 fibjs/src/profiler/CpuProfiler.cpp
@@ -60,9 +60,13 @@ result_t profiler_base::start(exlib::string fname, int32_t time, int32_t interva
v8::Local<v8::Object> _data = f->wrap();
d.now();
d.add(time, date_t::_MICROSECOND);
_data->Set(isolate->NewString("_time"), d.value(isolate->m_isolate));
if (time > 0) {
date_t d;
d.now();
d.add(time, date_t::_MICROSECOND);
_data->Set(isolate->NewString("_time"), d.value(isolate->m_isolate));
} else
_data->Set(isolate->NewString("_time"), v8::Number::New(isolate->m_isolate, INFINITY));
return timers_base::setHrInterval(isolate->NewFunction("_cpu_profiler", cpu_profiler, _data),
interval, args, retVal);

0 comments on commit 7b42a50

Please sign in to comment.