<commit_before>// Copyright Concurix Corporation 2012-2013. All Rights Reserved.
//
// see LICENSE for licensing details
//
// The Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
//
// functions to handle trace data from before and after hooks

var util = require('./util');

exports.store = function store(trace, clientState) {
  var node = {
    id: traceName(trace),
    proxyId: trace.funInfo.id,
    pid: trace.processId,
    fun_name: trace.funInfo.name,
    line: trace.funInfo.loc.line,
    start: util.hrtToUs(trace.startTime),
    duration: util.hrtToUs(trace.execTime || 0),
    child_duration: trace.childExecTime ? util.hrtToUs(trace.childExecTime) : 0,
    mem_delta: trace.memDelta || 0,
    nest_level: trace.nestLevel,
    num_calls: (trace.execTime) ? 1 : 0,  // if we are initializing in the before hook, we don't have a call yet.
    module: clientState && clientState.modInfo,
    name: traceName(trace),
  
    merge: function merge(trace){
      //console.log("merge ", this, trace);
      this.nest_level = Math.floor(((this.nest_level * this.num_calls) + trace.nestLevel) / (this.num_calls + 1));
      this.num_calls += 1;
      this.duration += util.hrtToUs(trace.execTime);
      this.mem_delta += trace.memDelta;
      if( trace.child_duration ){
        this.child_duration += trace.child_duration;<commit_msg>fix child time computation<commit_after>// Copyright Concurix Corporation 2012-2013. All Rights Reserved.
//
// see LICENSE for licensing details
//
// The Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
//
// functions to handle trace data from before and after hooks

var util = require('./util');

exports.store = function store(trace, clientState) {
  var node = {
    id: traceName(trace),
    proxyId: trace.funInfo.id,
    pid: trace.processId,
    fun_name: trace.funInfo.name,
    line: trace.funInfo.loc.line,
    start: util.hrtToUs(trace.startTime),
    duration: util.hrtToUs(trace.execTime || [0,0]),
    child_duration: trace.childExecTime ? util.hrtToUs(trace.childExecTime) : 0,
    mem_delta: trace.memDelta || 0,
    nest_level: trace.nestLevel,
    num_calls: (trace.execTime) ? 1 : 0,  // if we are initializing in the before hook, we don't have a call yet.
    module: clientState && clientState.modInfo,
    name: traceName(trace),
  
    merge: function merge(trace){
      //console.log("merge ", this, trace);
      this.nest_level = Math.floor(((this.nest_level * this.num_calls) + trace.nestLevel) / (this.num_calls + 1));
      this.num_calls += 1;
      this.duration += util.hrtToUs(trace.execTime);
      this.mem_delta += trace.memDelta;
      if( trace.childExecTime ){
        this.child_duration += util.hrtToUs(trace.childExecTime);
{'fraction_non_alphanumeric': 0.12348248352410683, 'fraction_numerical': 0.010752688172043012, 'mean_word_length': 3.403053435114504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5671877', 'n_tokens_mistral': 929, 'n_tokens_neox': 896, 'n_words': 248}