Skip to content

Commit

Permalink
Nits and doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
busykai committed Nov 20, 2014
1 parent 0653d01 commit e81e7d0
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/utils/PerfUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ define(function (require, exports, module) {
var updatableTests = {};

/**
* @private
* Keeps the track of measurements sequence number for re-entrant sequences with
* the same name currently running. Entries are created and deleted as needed.
*/
var testSequenceIds = {};
var _reentTests = {};

/**
* @private
* A unique key to log performance data
*
* @param {!string} id Unique ID for this measurement name
* @param {(string|undefined)} id Unique ID for this measurement name
* @param {!string} name A short name for this measurement
* @param {?number} reent Sequence identifier for parallel tests of the same name
*/
Expand Down Expand Up @@ -119,12 +120,12 @@ define(function (require, exports, module) {
var i;
for (i = 0; i < id.length; i++) {
if (!(id[i] instanceof PerfMeasurement)) {
if (testSequenceIds[id[i]] === undefined) {
testSequenceIds[id[i]] = 0;
if (_reentTests[id[i]] === undefined) {
_reentTests[id[i]] = 0;
} else {
testSequenceIds[id[i]]++;
_reentTests[id[i]]++;
}
id[i] = new PerfMeasurement(undefined, id[i], testSequenceIds[id[i]]);
id[i] = new PerfMeasurement(undefined, id[i], _reentTests[id[i]]);
}
}
return id;
Expand Down Expand Up @@ -214,10 +215,10 @@ define(function (require, exports, module) {
}

if (id.reent !== undefined) {
if (testSequenceIds[id] === 0) {
delete testSequenceIds[id];
if (_reentTests[id] === 0) {
delete _reentTests[id];
} else {
testSequenceIds[id]--;
_reentTests[id]--;
}
}

Expand Down Expand Up @@ -302,9 +303,9 @@ define(function (require, exports, module) {
}

/**
* Returns the performance data as a tab deliminted string
* @return {string}
*/
* Returns the performance data as a tab deliminted string
* @return {string}
*/
function getDelimitedPerfData() {
var getValue = function (entry) {
// return single value, or tab deliminted values for an array
Expand Down Expand Up @@ -364,7 +365,7 @@ define(function (require, exports, module) {
perfData = {};
activeTests = {};
updatableTests = {};
testSequenceIds = {};
_reentTests = {};
}

// create performance measurement constants
Expand Down

0 comments on commit e81e7d0

Please sign in to comment.