Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add TracingProcessor tests for getLogNormalDistribution and getRiskToResponsiveness #806

Merged
merged 3 commits into from
Oct 28, 2016

Conversation

paulirish
Copy link
Member

We didn't have test coverage for this method. The assertions test the shape of the curve and that our percentiles are correct.

image
https://www.desmos.com/calculator/0izses21rf

@paulirish paulirish changed the title test: add tests for TracingProcessor.getLogNormalDistribution test: add TracingProcessor tests for getLogNormalDistribution and getRiskToResponsiveness Oct 21, 2016
@paulirish paulirish force-pushed the testlognormal branch 3 times, most recently from da80c98 to 32118da Compare October 22, 2016 00:46
TracingProcessor._riskPercentiles = oldFn;
});

it('gets durations of top-level tasks', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this test, I think it would be better to just pull out a "get top level slices from main thread" function in tracing-processor.js and test that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call done.

const distribution = TracingProcessor.getLogNormalDistribution(median, pODM);

function getPct(distribution, value) {
return distribution.computeComplementaryPercentile(value).toFixed(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these string comparisons are somewhat horrifying :) Somewhat just jumping through hoops, but maybe return Number(distribution.computeComplementaryPercentile(value).toFixed(2))? and use numbers below?

Copy link
Member Author

@paulirish paulirish Oct 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg. done

@paulirish paulirish force-pushed the testlognormal branch 2 times, most recently from e7e3dac to 113e6c7 Compare October 26, 2016 01:24
Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some params nits

* Provides durations of all main thread top-level events
* @param {!traceviewer.Model} model
* @param {{traceEvents: !Array<!Object>}} trace
* @param {number=} startTime Optional start time (in ms) of range of interest. Defaults to trace start.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just @param {number} at this point

* @param {!traceviewer.Model} model
* @param {{traceEvents: !Array<!Object>}} trace
* @param {number=} startTime Optional start time (in ms) of range of interest. Defaults to trace start.
* @param {number=} endTime Optional end time (in ms) of range of interest. Defaults to trace end.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number

* @param {{traceEvents: !Array<!Object>}} trace
* @param {number=} startTime Optional start time (in ms) of range of interest. Defaults to trace start.
* @param {number=} endTime Optional end time (in ms) of range of interest. Defaults to trace end.
* @return {!Object>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@return {{durations: !Array<number>, clippedLength: number}} FWIW :)

@brendankenny
Copy link
Member

otherwise LGTM

@paulirish paulirish merged commit 5b4b1c5 into master Oct 28, 2016
@paulirish paulirish deleted the testlognormal branch October 28, 2016 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants