Permalink
Browse files

profiler, feat: not log empty sample.

  • Loading branch information...
xicilion committed Oct 17, 2017
1 parent 7b42a50 commit 21425c9eae2415c4bea60fe113aa7c85ce638bdf
Showing with 7 additions and 6 deletions.
  1. +7 −6 fibjs/src/profiler/CpuProfiler.cpp
@@ -33,12 +33,14 @@ static void cpu_profiler(const v8::FunctionCallbackInfo<v8::Value>& args)
stacks->Set(cnt++, NewString(isolate, stack));
}
exlib::string str;
json_base::encode(stacks, str);
v8::Local<v8::Object> _data = v8::Local<v8::Object>::Cast(args.Data());
obj_ptr<Buffer_base> buf = new Buffer(str + '\n');
SeekableStream_base::getInstance(_data)->cc_write(buf);
if (cnt > 0) {
exlib::string str;
json_base::encode(stacks, str);
obj_ptr<Buffer_base> buf = new Buffer(str + '\n');
SeekableStream_base::getInstance(_data)->cc_write(buf);
}
date_t d;
d.now();
@@ -51,7 +53,6 @@ result_t profiler_base::start(exlib::string fname, int32_t time, int32_t interva
Isolate* isolate = Isolate::current();
obj_ptr<SeekableStream_base> f;
OptArgs args;
date_t d;
result_t hr;
hr = fs_base::ac_openFile(fname, "a", f);

0 comments on commit 21425c9

Please sign in to comment.