Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add process.uvCounters() for debugging

  • Loading branch information...
ry committed Oct 6, 2011
1 parent 311fe73 commit c344fbc2852adfa495c0701fdf0e577cddfd6305
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/node.cc
@@ -1557,6 +1557,38 @@ static Handle<Value> Uptime(const Arguments& args) {
return scope.Close(Number::New(uptime));
}


v8::Handle<v8::Value> UVCounters(const v8::Arguments& args) {
HandleScope scope;

uv_counters_t* c = &uv_default_loop()->counters;

Local<Object> obj = Object::New();

#define setc(name) obj->Set(String::New(#name), Integer::New(c->name));

setc(eio_init)
setc(req_init)
setc(handle_init)
setc(stream_init)
setc(tcp_init)
setc(udp_init)
setc(pipe_init)
setc(tty_init)
setc(prepare_init)
setc(check_init)
setc(idle_init)
setc(async_init)
setc(timer_init)
setc(process_init)
setc(fs_event_init)

#undef setc

return scope.Close(obj);
}


v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
HandleScope scope;
assert(args.Length() == 0);
@@ -2167,6 +2199,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {

NODE_SET_METHOD(process, "uptime", Uptime);
NODE_SET_METHOD(process, "memoryUsage", MemoryUsage);
NODE_SET_METHOD(process, "uvCounters", UVCounters);

NODE_SET_METHOD(process, "binding", Binding);

0 comments on commit c344fbc

Please sign in to comment.
You can’t perform that action at this time.