Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #10 from postwait/master

support clearing of aggregates
  • Loading branch information...
commit b81b934275b733b5aabff42d6b72f5978b512629 2 parents 3f0403e + 60a49ad
@bcantrill authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 libdtrace.cc
View
19 libdtrace.cc
@@ -97,6 +97,7 @@ class DTraceConsumer : node::ObjectWrap {
static Handle<Value> New(const Arguments& args);
static Handle<Value> Consume(const Arguments& args);
+ static Handle<Value> Aggclear(const Arguments& args);
static Handle<Value> Aggwalk(const Arguments& args);
static Handle<Value> Aggmin(const Arguments& args);
static Handle<Value> Aggmax(const Arguments& args);
@@ -166,6 +167,8 @@ DTraceConsumer::Initialize(Handle<Object> target)
DTraceConsumer::Consume);
NODE_SET_PROTOTYPE_METHOD(dtc_templ, "aggwalk",
DTraceConsumer::Aggwalk);
+ NODE_SET_PROTOTYPE_METHOD(dtc_templ, "aggclear",
+ DTraceConsumer::Aggclear);
NODE_SET_PROTOTYPE_METHOD(dtc_templ, "aggmin", DTraceConsumer::Aggmin);
NODE_SET_PROTOTYPE_METHOD(dtc_templ, "aggmax", DTraceConsumer::Aggmax);
NODE_SET_PROTOTYPE_METHOD(dtc_templ, "stop", DTraceConsumer::Stop);
@@ -825,6 +828,22 @@ DTraceConsumer::aggwalk(const dtrace_aggdata_t *agg, void *arg)
}
Handle<Value>
+DTraceConsumer::Aggclear(const Arguments& args)
+{
+ HandleScope scope;
+ DTraceConsumer *dtc = ObjectWrap::Unwrap<DTraceConsumer>(args.Holder());
+ dtrace_hdl_t *dtp = dtc->dtc_handle;
+
+ if (dtrace_status(dtp) == -1) {
+ return (dtc->error("couldn't get status: %s\n",
+ dtrace_errmsg(dtp, dtrace_errno(dtp))));
+ }
+
+ dtrace_aggregate_clear(dtp);
+ return (Undefined());
+}
+
+Handle<Value>
DTraceConsumer::Aggwalk(const Arguments& args)
{
HandleScope scope;

0 comments on commit b81b934

Please sign in to comment.
Something went wrong with that request. Please try again.