-
Notifications
You must be signed in to change notification settings - Fork 413
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
Support simple perf output #2011
Support simple perf output #2011
Conversation
@@ -27,6 +27,29 @@ describe('converting Linux perf profile', function() { | |||
} | |||
expect(version).toEqual(CURRENT_GECKO_VERSION); | |||
}); | |||
|
|||
it('should import a simple perf profile', async function() { |
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.
I checked that this test throws on master.
36dacd1
to
67e9e04
Compare
Codecov Report
@@ Coverage Diff @@
## master #2011 +/- ##
=========================================
+ Coverage 84.79% 84.8% +<.01%
=========================================
Files 191 191
Lines 13013 13015 +2
Branches 3245 3246 +1
=========================================
+ Hits 11035 11037 +2
Misses 1797 1797
Partials 181 181
Continue to review full report at Codecov.
|
// | | | +- unknown number between brackets (optional) | ||
// | | | | +- timestamp | ||
// vvvvv vvvvvvvvv vvv vvvvvvvvvvvvvv vvvvvv | ||
return /^\S.+?\s+(?:\d+\/)?\d+\s+(?:\[\d+\]\s+)?[\d.]+:/.test(firstLine); |
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.
I completely rewrote this regexp to make it look closer to the other regexps in the same file.
67e9e04
to
90bb04c
Compare
90bb04c
to
ebe711e
Compare
@@ -133,25 +139,29 @@ export function convertPerfScriptProfile(profile: string): Object { | |||
let startTime = 0; | |||
while (lineIndex < lines.length) { | |||
const sampleStartLine = lines[lineIndex++]; | |||
if (sampleStartLine === '') { | |||
continue; | |||
} |
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.
This helps avoid some useless warning.
// | | +- tid | ||
// | | | +- end of word (space or end of string) | ||
// vvvv vvvvvvvvvvv vvvvv v | ||
const threadNamePidAndTidMatch = /^(.*)\s+(?:(\d+)\/)?(\d+)\b/.exec( |
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.
look, a \s
instead of a space, to match tabs!
// First, get the sample's time stamp and whatever comes before the timeStamp: | ||
const sampleStartMatch = /^(.*) ([\d.]+):/.exec(sampleStartLine); | ||
// First, get the sample's time stamp and whatever comes before the timestamp: | ||
const sampleStartMatch = /^(.*)\s+([\d.]+):/.exec(sampleStartLine); |
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.
look, a \s
instead of a space, to match tabs!
if (!sampleStartMatch) { | ||
console.log( | ||
'Could not parse line as the start of a sample in the "perf script" profile format:', | ||
'Could not parse line as the start of a sample in the "perf script" profile format: "%s"', |
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.
This makes it easier to see the result when the string is empty.
Hey @jesup, I flagged you for a review because you wrote the initial implementation and have some knowledge of the simple perf format. But please tell me if you'd rather have somebody else to review it :) |
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.
Looks great! Thanks for the comments on the diff.
Fixes #1792
deploy preview