heimdalljs
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -238,5 +238,20 @@ // All Credit for this goes to the Ember.js Core Team | ||
var A = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; | ||
function fill(array, value, start, end) { | ||
if (typeof array.fill === 'function') { | ||
return array.fill(value, start, end); | ||
} else { | ||
var len = array.length; | ||
var s = start || 0; | ||
var e = end || len; | ||
for (; s < e; s++) { | ||
array[s] = value; | ||
} | ||
return array; | ||
} | ||
} | ||
var SMALL_ARRAY_LENGTH$1 = 250; | ||
var MAX_ARRAY_LENGTH = 1e6; | ||
var FastIntArray = function () { | ||
@@ -251,3 +266,3 @@ function FastIntArray() { | ||
createClass(FastIntArray, [{ | ||
key: "init", | ||
key: 'init', | ||
value: function init() { | ||
@@ -260,3 +275,3 @@ var length = arguments.length <= 0 || arguments[0] === undefined ? SMALL_ARRAY_LENGTH$1 : arguments[0]; | ||
this._fill = 0; | ||
this._data = new Uint32Array(length); | ||
this._data = new A(length); | ||
@@ -277,3 +292,3 @@ if (initialData) { | ||
}, { | ||
key: "toJSON", | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
@@ -283,3 +298,3 @@ return this._data.slice(0, this.length); | ||
}, { | ||
key: "get", | ||
key: 'get', | ||
value: function get(index) { | ||
@@ -293,3 +308,3 @@ if (index >= 0 && index < this.length) { | ||
}, { | ||
key: "increment", | ||
key: 'increment', | ||
value: function increment(index) { | ||
@@ -306,3 +321,3 @@ this._data[index]++; | ||
}, { | ||
key: "grow", | ||
key: 'grow', | ||
value: function grow(newLength) { | ||
@@ -313,3 +328,3 @@ var l = this._length; | ||
var data = this._data; | ||
var _d = this._data = new Uint32Array(newLength); | ||
var _d = this._data = new A(newLength); | ||
@@ -319,7 +334,7 @@ _d.set(data); | ||
if (this._fill !== 0) { | ||
_d.fill(this._fill, l); | ||
fill(_d, this._fill, l); | ||
} | ||
} | ||
}, { | ||
key: "claim", | ||
key: 'claim', | ||
value: function claim(count) { | ||
@@ -332,3 +347,3 @@ this.length += count; | ||
}, { | ||
key: "push", | ||
key: 'push', | ||
value: function push(int) { | ||
@@ -372,2 +387,9 @@ var index = this.length++; | ||
createClass(CounterStore, [{ | ||
key: 'clean', | ||
value: function clean() { | ||
this._storeInitialized = false; | ||
this._store = null; | ||
this._cache = null; | ||
} | ||
}, { | ||
key: 'toJSON', | ||
@@ -406,3 +428,3 @@ value: function toJSON() { | ||
this._cache = new Uint32Array(this._namespaceCount); | ||
this._cache = new A(this._namespaceCount); | ||
this._cache.set(cache); | ||
@@ -460,3 +482,3 @@ this._cache[namespaceIndex] = NULL_NUMBER; | ||
this._initializeStoreIfNeeded(); | ||
this._cache = new Uint32Array(this._namespaceCount).fill(NULL_NUMBER); | ||
this._cache = fill(new A(this._namespaceCount), NULL_NUMBER); | ||
} | ||
@@ -517,9 +539,6 @@ | ||
var HeimdallSession = function () { | ||
function HeimdallSession(options) { | ||
this.init(options); | ||
function HeimdallSession() { | ||
this.init(); | ||
} | ||
// separate from constructor mostly for testing purposes | ||
createClass(HeimdallSession, [{ | ||
@@ -532,2 +551,11 @@ key: 'init', | ||
} | ||
// mostly for test helper purposes | ||
}, { | ||
key: 'reset', | ||
value: function reset() { | ||
this.monitors.clean(); | ||
this.events.length = 0; | ||
} | ||
}]); | ||
@@ -630,2 +658,7 @@ return HeimdallSession; | ||
}, { | ||
key: 'hasMonitor', | ||
value: function hasMonitor(name) { | ||
return !!this._monitors.has(name); | ||
} | ||
}, { | ||
key: 'registerMonitor', | ||
@@ -636,3 +669,3 @@ value: function registerMonitor(name) { | ||
} | ||
if (this._monitors.has(name)) { | ||
if (this.hasMonitor(name)) { | ||
throw new Error('A monitor for "' + name + '" is already registered"'); | ||
@@ -639,0 +672,0 @@ } |
@@ -238,5 +238,20 @@ // All Credit for this goes to the Ember.js Core Team | ||
var A = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; | ||
function fill(array, value, start, end) { | ||
if (typeof array.fill === 'function') { | ||
return array.fill(value, start, end); | ||
} else { | ||
var len = array.length; | ||
var s = start || 0; | ||
var e = end || len; | ||
for (; s < e; s++) { | ||
array[s] = value; | ||
} | ||
return array; | ||
} | ||
} | ||
var SMALL_ARRAY_LENGTH$1 = 250; | ||
var MAX_ARRAY_LENGTH = 1e6; | ||
var FastIntArray = function () { | ||
@@ -251,3 +266,3 @@ function FastIntArray() { | ||
createClass(FastIntArray, [{ | ||
key: "init", | ||
key: 'init', | ||
value: function init() { | ||
@@ -260,3 +275,3 @@ var length = arguments.length <= 0 || arguments[0] === undefined ? SMALL_ARRAY_LENGTH$1 : arguments[0]; | ||
this._fill = 0; | ||
this._data = new Uint32Array(length); | ||
this._data = new A(length); | ||
@@ -277,3 +292,3 @@ if (initialData) { | ||
}, { | ||
key: "toJSON", | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
@@ -283,3 +298,3 @@ return this._data.slice(0, this.length); | ||
}, { | ||
key: "get", | ||
key: 'get', | ||
value: function get(index) { | ||
@@ -293,3 +308,3 @@ if (index >= 0 && index < this.length) { | ||
}, { | ||
key: "increment", | ||
key: 'increment', | ||
value: function increment(index) { | ||
@@ -306,3 +321,3 @@ this._data[index]++; | ||
}, { | ||
key: "grow", | ||
key: 'grow', | ||
value: function grow(newLength) { | ||
@@ -313,3 +328,3 @@ var l = this._length; | ||
var data = this._data; | ||
var _d = this._data = new Uint32Array(newLength); | ||
var _d = this._data = new A(newLength); | ||
@@ -319,7 +334,7 @@ _d.set(data); | ||
if (this._fill !== 0) { | ||
_d.fill(this._fill, l); | ||
fill(_d, this._fill, l); | ||
} | ||
} | ||
}, { | ||
key: "claim", | ||
key: 'claim', | ||
value: function claim(count) { | ||
@@ -332,3 +347,3 @@ this.length += count; | ||
}, { | ||
key: "push", | ||
key: 'push', | ||
value: function push(int) { | ||
@@ -372,2 +387,9 @@ var index = this.length++; | ||
createClass(CounterStore, [{ | ||
key: 'clean', | ||
value: function clean() { | ||
this._storeInitialized = false; | ||
this._store = null; | ||
this._cache = null; | ||
} | ||
}, { | ||
key: 'toJSON', | ||
@@ -406,3 +428,3 @@ value: function toJSON() { | ||
this._cache = new Uint32Array(this._namespaceCount); | ||
this._cache = new A(this._namespaceCount); | ||
this._cache.set(cache); | ||
@@ -460,3 +482,3 @@ this._cache[namespaceIndex] = NULL_NUMBER; | ||
this._initializeStoreIfNeeded(); | ||
this._cache = new Uint32Array(this._namespaceCount).fill(NULL_NUMBER); | ||
this._cache = fill(new A(this._namespaceCount), NULL_NUMBER); | ||
} | ||
@@ -517,9 +539,6 @@ | ||
var HeimdallSession = function () { | ||
function HeimdallSession(options) { | ||
this.init(options); | ||
function HeimdallSession() { | ||
this.init(); | ||
} | ||
// separate from constructor mostly for testing purposes | ||
createClass(HeimdallSession, [{ | ||
@@ -532,2 +551,11 @@ key: 'init', | ||
} | ||
// mostly for test helper purposes | ||
}, { | ||
key: 'reset', | ||
value: function reset() { | ||
this.monitors.clean(); | ||
this.events.length = 0; | ||
} | ||
}]); | ||
@@ -630,2 +658,7 @@ return HeimdallSession; | ||
}, { | ||
key: 'hasMonitor', | ||
value: function hasMonitor(name) { | ||
return !!this._monitors.has(name); | ||
} | ||
}, { | ||
key: 'registerMonitor', | ||
@@ -636,3 +669,3 @@ value: function registerMonitor(name) { | ||
} | ||
if (this._monitors.has(name)) { | ||
if (this.hasMonitor(name)) { | ||
throw new Error('A monitor for "' + name + '" is already registered"'); | ||
@@ -639,0 +672,0 @@ } |
@@ -239,5 +239,20 @@ var heimdall = (function () { | ||
var A = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; | ||
function fill(array, value, start, end) { | ||
if (typeof array.fill === 'function') { | ||
return array.fill(value, start, end); | ||
} else { | ||
var len = array.length; | ||
var s = start || 0; | ||
var e = end || len; | ||
for (; s < e; s++) { | ||
array[s] = value; | ||
} | ||
return array; | ||
} | ||
} | ||
var SMALL_ARRAY_LENGTH$1 = 250; | ||
var MAX_ARRAY_LENGTH = 1e6; | ||
var FastIntArray = function () { | ||
@@ -252,3 +267,3 @@ function FastIntArray() { | ||
createClass(FastIntArray, [{ | ||
key: "init", | ||
key: 'init', | ||
value: function init() { | ||
@@ -261,3 +276,3 @@ var length = arguments.length <= 0 || arguments[0] === undefined ? SMALL_ARRAY_LENGTH$1 : arguments[0]; | ||
this._fill = 0; | ||
this._data = new Uint32Array(length); | ||
this._data = new A(length); | ||
@@ -278,3 +293,3 @@ if (initialData) { | ||
}, { | ||
key: "toJSON", | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
@@ -284,3 +299,3 @@ return this._data.slice(0, this.length); | ||
}, { | ||
key: "get", | ||
key: 'get', | ||
value: function get(index) { | ||
@@ -294,3 +309,3 @@ if (index >= 0 && index < this.length) { | ||
}, { | ||
key: "increment", | ||
key: 'increment', | ||
value: function increment(index) { | ||
@@ -307,3 +322,3 @@ this._data[index]++; | ||
}, { | ||
key: "grow", | ||
key: 'grow', | ||
value: function grow(newLength) { | ||
@@ -314,3 +329,3 @@ var l = this._length; | ||
var data = this._data; | ||
var _d = this._data = new Uint32Array(newLength); | ||
var _d = this._data = new A(newLength); | ||
@@ -320,7 +335,7 @@ _d.set(data); | ||
if (this._fill !== 0) { | ||
_d.fill(this._fill, l); | ||
fill(_d, this._fill, l); | ||
} | ||
} | ||
}, { | ||
key: "claim", | ||
key: 'claim', | ||
value: function claim(count) { | ||
@@ -333,3 +348,3 @@ this.length += count; | ||
}, { | ||
key: "push", | ||
key: 'push', | ||
value: function push(int) { | ||
@@ -373,2 +388,9 @@ var index = this.length++; | ||
createClass(CounterStore, [{ | ||
key: 'clean', | ||
value: function clean() { | ||
this._storeInitialized = false; | ||
this._store = null; | ||
this._cache = null; | ||
} | ||
}, { | ||
key: 'toJSON', | ||
@@ -407,3 +429,3 @@ value: function toJSON() { | ||
this._cache = new Uint32Array(this._namespaceCount); | ||
this._cache = new A(this._namespaceCount); | ||
this._cache.set(cache); | ||
@@ -461,3 +483,3 @@ this._cache[namespaceIndex] = NULL_NUMBER; | ||
this._initializeStoreIfNeeded(); | ||
this._cache = new Uint32Array(this._namespaceCount).fill(NULL_NUMBER); | ||
this._cache = fill(new A(this._namespaceCount), NULL_NUMBER); | ||
} | ||
@@ -518,9 +540,6 @@ | ||
var HeimdallSession = function () { | ||
function HeimdallSession(options) { | ||
this.init(options); | ||
function HeimdallSession() { | ||
this.init(); | ||
} | ||
// separate from constructor mostly for testing purposes | ||
createClass(HeimdallSession, [{ | ||
@@ -533,2 +552,11 @@ key: 'init', | ||
} | ||
// mostly for test helper purposes | ||
}, { | ||
key: 'reset', | ||
value: function reset() { | ||
this.monitors.clean(); | ||
this.events.length = 0; | ||
} | ||
}]); | ||
@@ -631,2 +659,7 @@ return HeimdallSession; | ||
}, { | ||
key: 'hasMonitor', | ||
value: function hasMonitor(name) { | ||
return !!this._monitors.has(name); | ||
} | ||
}, { | ||
key: 'registerMonitor', | ||
@@ -637,3 +670,3 @@ value: function registerMonitor(name) { | ||
} | ||
if (this._monitors.has(name)) { | ||
if (this.hasMonitor(name)) { | ||
throw new Error('A monitor for "' + name + '" is already registered"'); | ||
@@ -640,0 +673,0 @@ } |
@@ -244,5 +244,20 @@ (function (global, factory) { | ||
var A = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; | ||
function fill(array, value, start, end) { | ||
if (typeof array.fill === 'function') { | ||
return array.fill(value, start, end); | ||
} else { | ||
var len = array.length; | ||
var s = start || 0; | ||
var e = end || len; | ||
for (; s < e; s++) { | ||
array[s] = value; | ||
} | ||
return array; | ||
} | ||
} | ||
var SMALL_ARRAY_LENGTH$1 = 250; | ||
var MAX_ARRAY_LENGTH = 1e6; | ||
var FastIntArray = function () { | ||
@@ -257,3 +272,3 @@ function FastIntArray() { | ||
createClass(FastIntArray, [{ | ||
key: "init", | ||
key: 'init', | ||
value: function init() { | ||
@@ -266,3 +281,3 @@ var length = arguments.length <= 0 || arguments[0] === undefined ? SMALL_ARRAY_LENGTH$1 : arguments[0]; | ||
this._fill = 0; | ||
this._data = new Uint32Array(length); | ||
this._data = new A(length); | ||
@@ -283,3 +298,3 @@ if (initialData) { | ||
}, { | ||
key: "toJSON", | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
@@ -289,3 +304,3 @@ return this._data.slice(0, this.length); | ||
}, { | ||
key: "get", | ||
key: 'get', | ||
value: function get(index) { | ||
@@ -299,3 +314,3 @@ if (index >= 0 && index < this.length) { | ||
}, { | ||
key: "increment", | ||
key: 'increment', | ||
value: function increment(index) { | ||
@@ -312,3 +327,3 @@ this._data[index]++; | ||
}, { | ||
key: "grow", | ||
key: 'grow', | ||
value: function grow(newLength) { | ||
@@ -319,3 +334,3 @@ var l = this._length; | ||
var data = this._data; | ||
var _d = this._data = new Uint32Array(newLength); | ||
var _d = this._data = new A(newLength); | ||
@@ -325,7 +340,7 @@ _d.set(data); | ||
if (this._fill !== 0) { | ||
_d.fill(this._fill, l); | ||
fill(_d, this._fill, l); | ||
} | ||
} | ||
}, { | ||
key: "claim", | ||
key: 'claim', | ||
value: function claim(count) { | ||
@@ -338,3 +353,3 @@ this.length += count; | ||
}, { | ||
key: "push", | ||
key: 'push', | ||
value: function push(int) { | ||
@@ -378,2 +393,9 @@ var index = this.length++; | ||
createClass(CounterStore, [{ | ||
key: 'clean', | ||
value: function clean() { | ||
this._storeInitialized = false; | ||
this._store = null; | ||
this._cache = null; | ||
} | ||
}, { | ||
key: 'toJSON', | ||
@@ -412,3 +434,3 @@ value: function toJSON() { | ||
this._cache = new Uint32Array(this._namespaceCount); | ||
this._cache = new A(this._namespaceCount); | ||
this._cache.set(cache); | ||
@@ -466,3 +488,3 @@ this._cache[namespaceIndex] = NULL_NUMBER; | ||
this._initializeStoreIfNeeded(); | ||
this._cache = new Uint32Array(this._namespaceCount).fill(NULL_NUMBER); | ||
this._cache = fill(new A(this._namespaceCount), NULL_NUMBER); | ||
} | ||
@@ -523,9 +545,6 @@ | ||
var HeimdallSession = function () { | ||
function HeimdallSession(options) { | ||
this.init(options); | ||
function HeimdallSession() { | ||
this.init(); | ||
} | ||
// separate from constructor mostly for testing purposes | ||
createClass(HeimdallSession, [{ | ||
@@ -538,2 +557,11 @@ key: 'init', | ||
} | ||
// mostly for test helper purposes | ||
}, { | ||
key: 'reset', | ||
value: function reset() { | ||
this.monitors.clean(); | ||
this.events.length = 0; | ||
} | ||
}]); | ||
@@ -636,2 +664,7 @@ return HeimdallSession; | ||
}, { | ||
key: 'hasMonitor', | ||
value: function hasMonitor(name) { | ||
return !!this._monitors.has(name); | ||
} | ||
}, { | ||
key: 'registerMonitor', | ||
@@ -642,3 +675,3 @@ value: function registerMonitor(name) { | ||
} | ||
if (this._monitors.has(name)) { | ||
if (this.hasMonitor(name)) { | ||
throw new Error('A monitor for "' + name + '" is already registered"'); | ||
@@ -645,0 +678,0 @@ } |
{ | ||
"name": "heimdalljs", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Structured instrumentation library", | ||
@@ -15,3 +15,4 @@ "main": "dist/heimdalljs.cjs.js", | ||
"build_and_test": "npm run build:test && npm run test", | ||
"trace": "node --trace-hydrogen --trace_phase=Z --trace_deopt --code_comments --hydrogen_track_positions --redirect_code_traces bench/ " | ||
"trace": "node --trace-hydrogen --trace_phase=Z --trace_deopt --code_comments --hydrogen_track_positions --redirect_code_traces bench/ ", | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -18,0 +19,0 @@ "repository": { |
# Heimdall | ||
![build status](https://travis-ci.org/heimdalljs/heimdalljs-lib.svg) | ||
[![Build Status](https://travis-ci.org/heimdalljs/heimdalljs-lib.svg?branch=master)](https://travis-ci.org/heimdalljs/heimdalljs-lib) | ||
@@ -21,6 +21,6 @@ A blazingly fast performance stat monitoring and collection library for | ||
tiny `TypedArray`, a four element `Array`, and `performance.now()`. On | ||
Desktop Chrome on a 2015 era MacBook Pro this amounts to roughly 200 | ||
Desktop Chrome on a 2015 era MacBook Pro this amounts to roughly 200 | ||
nano seconds. You can easily run the benchmarks on devices you care about | ||
to see what the cost will be for you. | ||
The overhead of counter based collection is the cost of a method call | ||
@@ -31,3 +31,3 @@ with two bitwise operations and an integer increment. An occasional | ||
in which the overhead of a timer is enough to significantly alter stats. | ||
## Usage | ||
@@ -45,3 +45,3 @@ | ||
``` | ||
**stop timing something** | ||
@@ -54,2 +54,7 @@ ```js | ||
**querying** | ||
```js | ||
let condition = heimdall.hasMonitor('<name>'); | ||
``` | ||
**register** | ||
@@ -86,4 +91,4 @@ ```js | ||
If desired, heimdall can be stripped from production builds using | ||
[this plugin]() for Babel5 or [this plugin]() for Babel6. | ||
[this plugin](https://github.com/heimdalljs/babel5-plugin-strip-heimdall) for Babel5 or [this plugin]() for Babel6. | ||
## Global Session | ||
@@ -104,2 +109,2 @@ | ||
is quite easy for this to result in lost detail & lost stats, although it is | ||
also easy to detect this situation and issue a warning. | ||
also easy to detect this situation and issue a warning. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
943515
31083
105