<commit_before>/* module-stats
 
 A utility for collecting usage information on a per module basis

 Copyright 2013 Concurix Corporation
*/

var wrapper = require('./lib/wrapper');
var archive = require('./lib/archive');
var os      = require('os');

exports.wrap = function wrap(name, obj, options){
  options = configureOptions(options);
  if( obj ){
    return wrapper.wrapExports(name, obj, options);
  }
}

exports.blacklist = function blacklist(obj) {
  if (obj) {
    wrapper.blacklist(obj);
  }
}

exports.reset = function reset(){
  if( global.concurix ){
    if( global.concurix.traceAggregate ){
      global.concurix.traceAggregate.stop();
      global.concurix.traceAggregate.start();
    }
    if( global.concurix.archive ){
      global.concurix.archive.reset();
    }
  } 
}

exports.start = function start(){
  if( global.concurix && global.concurix.traceAggregate ){
    global.concurix.traceAggregate.start();
  }
}

exports.stop = function stop(){
  if( global.concurix ){
    if( global.concurix.traceAggregate ){
      global.concurix.traceAggregate.stop();
    }
    if( global.concurix.archive ){
      global.concurix.archive.stop();
    }
  }
}

function configureOptions(options){
  var defaultOptions = {
    hostname: os.hostname(),
    archiveHost: 'api.concurix.com', 
    archivePort: 80,
    accountKey: '28164101-1362-769775-170247',
    archiveInterval: process.env.NODE_ENV == 'production' ? 600000 : 2000, 
    logsPath: null,
  };
  
  options = options || {};
  Object.keys(options).forEach(function(name){
    defaultOptions[name] = options[name];
  });

  archive.configure(defaultOptions);
  return defaultOptions;
}<commit_msg>reduce to 1 minute<commit_after>/* module-stats
 
 A utility for collecting usage information on a per module basis

 Copyright 2013 Concurix Corporation
*/

var wrapper = require('./lib/wrapper');
var archive = require('./lib/archive');
var os      = require('os');

exports.wrap = function wrap(name, obj, options){
  options = configureOptions(options);
  if( obj ){
    return wrapper.wrapExports(name, obj, options);
  }
}

exports.blacklist = function blacklist(obj) {
  if (obj) {
    wrapper.blacklist(obj);
  }
}

exports.reset = function reset(){
  if( global.concurix ){
    if( global.concurix.traceAggregate ){
      global.concurix.traceAggregate.stop();
      global.concurix.traceAggregate.start();
    }
    if( global.concurix.archive ){
      global.concurix.archive.reset();
    }
  } 
}

exports.start = function start(){
  if( global.concurix && global.concurix.traceAggregate ){
    global.concurix.traceAggregate.start();
  }
}

exports.stop = function stop(){
  if( global.concurix ){
    if( global.concurix.traceAggregate ){
      global.concurix.traceAggregate.stop();
    }
    if( global.concurix.archive ){
      global.concurix.archive.stop();
    }
  }
}

function configureOptions(options){
  var defaultOptions = {
    hostname: os.hostname(),
    archiveHost: 'api.concurix.com', 
    archivePort: 80,
    accountKey: '28164101-1362-769775-170247',
    archiveInterval: process.env.NODE_ENV == 'production' ? 60000 : 2000, 
    logsPath: null,
  };
  
  options = options || {};
  Object.keys(options).forEach(function(name){
    defaultOptions[name] = options[name];
  });

  archive.configure(defaultOptions);
  return defaultOptions;
}
{'fraction_non_alphanumeric': 0.13935406698564592, 'fraction_numerical': 0.023923444976076555, 'mean_word_length': 3.52027027027027, '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': '6448074', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1074, 'n_words': 207}