-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
798234c
to
9548f87
Compare
da80c98
to
32118da
Compare
TracingProcessor._riskPercentiles = oldFn; | ||
}); | ||
|
||
it('gets durations of top-level tasks', () => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg. done
e7e3dac
to
113e6c7
Compare
There was a problem hiding this 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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>} |
There was a problem hiding this comment.
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 :)
otherwise LGTM |
113e6c7
to
70a2d94
Compare
We didn't have test coverage for this method. The assertions test the shape of the curve and that our percentiles are correct.
https://www.desmos.com/calculator/0izses21rf