diff --git a/cpuprofilenode.go b/cpuprofilenode.go index fe6117925..f3b3a951e 100644 --- a/cpuprofilenode.go +++ b/cpuprofilenode.go @@ -17,6 +17,12 @@ type CPUProfileNode struct { // The number of the column where the function originates. columnNumber int + // The number of samples recorded in the function + hitCount uint + + // The number of lines in which samples were recorded in the function + hitLineCount uint + // The children node of this node. children []*CPUProfileNode @@ -44,6 +50,16 @@ func (c *CPUProfileNode) GetColumnNumber() int { return c.columnNumber } +// Returns total samples recorded inside the function +func (c *CPUProfileNode) GetHitCount() uint { + return c.hitCount +} + +// Returns total number of lines inside the function recording samples +func (c *CPUProfileNode) GetHitLineCount() uint { + return c.hitLineCount +} + // Retrieves the ancestor node, or nil if the root. func (c *CPUProfileNode) GetParent() *CPUProfileNode { return c.parent diff --git a/cpuprofiler.go b/cpuprofiler.go index 30bc24579..fac20719e 100644 --- a/cpuprofiler.go +++ b/cpuprofiler.go @@ -79,6 +79,8 @@ func newCPUProfileNode(node *C.CPUProfileNode, parent *CPUProfileNode) *CPUProfi functionName: C.GoString(node.functionName), lineNumber: int(node.lineNumber), columnNumber: int(node.columnNumber), + hitCount: uint(node.hitCount), + hitLineCount: uint(node.hitLineCount), parent: parent, } diff --git a/v8go.cc b/v8go.cc index 97390883e..5308586f7 100644 --- a/v8go.cc +++ b/v8go.cc @@ -332,6 +332,8 @@ CPUProfileNode* NewCPUProfileNode(const CpuProfileNode* ptr_) { ptr_->GetFunctionNameStr(), ptr_->GetLineNumber(), ptr_->GetColumnNumber(), + ptr_->GetHitCount(), + ptr_->GetHitLineCount(), count, children, }; diff --git a/v8go.h b/v8go.h index 7acaf0425..cef2007da 100644 --- a/v8go.h +++ b/v8go.h @@ -88,6 +88,8 @@ typedef struct CPUProfileNode { const char* functionName; int lineNumber; int columnNumber; + unsigned int hitCount; + unsigned int hitLineCount; int childrenCount; struct CPUProfileNode** children; } CPUProfileNode;