Comparing version 1.0.0 to 1.1.0
14
index.js
var exec = require('child_process').exec; | ||
var parseWrk = require('./lib/parseWrk') | ||
var parseWrk = require('./lib/parseWrk'); | ||
var util = require("util"); | ||
function wrk(opts, callback) { | ||
var cmd = opts.path || 'wrk'; | ||
@@ -18,4 +18,12 @@ | ||
cmd += ' --timeout ' + opts.timeout; | ||
if (opts.rate) | ||
cmd += ' -R' + opts.rate; | ||
if (opts.printLatency) | ||
cmd += ' --latency '; | ||
if (opts.headers) { | ||
Object.keys(opts.headers).forEach(function(key) { | ||
cmd += util.format(' -H \'%s: %s\'', key, opts.headers[key]); | ||
}) | ||
} | ||
cmd += ' ' + opts.url; | ||
@@ -51,2 +59,2 @@ | ||
} | ||
} | ||
}; |
@@ -39,2 +39,21 @@ module.exports = parseWrk | ||
var histogram = []; | ||
for (var i=0; i < lines.length; ++i) { | ||
if (lines[i].match(/Detailed Percentile spectrum:/) && i < lines.length - 3) { | ||
for (var l=i+4; lines[l] != ''; ++l) { | ||
var nums = lines[l].trim().split(/[ \t]+/); | ||
if (nums.length != 4) break; | ||
console.log('Histo: ', nums); | ||
histogram.push({ | ||
latency: Number(nums[0]), | ||
percentile: Number(nums[1]), | ||
total: Number(nums[2]) | ||
}); | ||
} | ||
break; | ||
} | ||
} | ||
if (histogram.length) { | ||
result.histogram = histogram; | ||
} | ||
return result; | ||
@@ -41,0 +60,0 @@ } |
{ | ||
"name": "wrk", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "wrk load test tool wrapper and output parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
11154
250
1