This sample demonstrates how his Fibonacci number calculation written in Node.js has abysmal performance.
Prerequisites
Node.js needs to be installed on your system.
Installing and Running
To install:
- This command gets all dependencies needed
npm install
To run the provided sample run TNT4J-Steams with the provided parser configuration tnt-data-source.xml, or simply start run.bat (run.sh in Linux)
run sample
npm start
Apply to Other node.js Software
You need to inject three objects: JsTimedProcess, Tnt4jStreamsFormatter, and njsTrace.
JsTimedProcess comes with a timeout option (in this case, 10). If you want to send only error traces to meshIQ, use option "true" in Tnt4jStreamsFormatter. njsTrace comes a with filter for which files to instrument and if function arguments should be inspected.
JsTimedProcess = require('njstrace-timed-process')(10); // Timeout value
var Tnt4jStreamsFormatter = require('njstrace-tnt4j-formatter').Tnt4jStreamsFormatter;// ################# Tnt4JFormatter
var njstrace = require('njstrace').inject({ formatter: new Tnt4jStreamsFormatter("true"), inspectArgs: false, files: ['**/*.js', '*.js', '!**/node_modules/**'],});This sample uses a customized njsTrace library.