-
Notifications
You must be signed in to change notification settings - Fork 258
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
add default instruments selected run number #203
Conversation
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.
Hi @Archerlly,
Thanks for the submission!
Do you have a small .trace
file that you can include as a test to ensure that this behavior doesn't regress in the future?
I should be able to create this myself, though I'm not sure where to find a .tracetemplate
file to create this.
src/import/instruments.ts
Outdated
@@ -361,7 +361,11 @@ async function readFormTemplate(tree: TraceDirectoryTree): Promise<FormTemplateD | |||
const archive = readInstrumentsKeyedArchive(await readAsArrayBuffer(formTemplate)) | |||
|
|||
const version = archive['com.apple.xray.owner.template.version'] | |||
const selectedRunNumber = archive['com.apple.xray.owner.template'].get('_selectedRunNumber') | |||
let selectedRunNumber = 1 | |||
if ('com.apple.xray.owner.template' in Object.keys(archive)) { |
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 don't think this is quite right. The in
test is for objects, not arrays, and Object.keys
returns an array, so I think this condition will always be false.
Instead, I think you want:
if ('com.apple.xray.owner.template' in Object.keys(archive)) { | |
if ('com.apple.xray.owner.template' in archive) { |
src/import/instruments.ts
Outdated
let selectedRunNumber = 1 | ||
if ('com.apple.xray.owner.template' in Object.keys(archive)) { | ||
selectedRunNumber = archive['com.apple.xray.owner.template'].get('_selectedRunNumber') | ||
console.log('get selectedRunNumber', selectedRunNumber) |
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'm guessing this was useful for debugging, but can you please remove this before we merge?
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.
.tracetemplate
file create by InstrumentsFile
->Save As Template
console.log('get selectedRunNumber', selectedRunNumber)
is debug code and have removed- add a testing with small
.trace
file that without selected run number
Thanks for your suggestion
Thanks for your suggestion |
@Archerlly Your fix has now been published to npm and deployed to https://speedscope.app/. Thanks for the fix! |
this's will lack
com.apple.xray.owner.template
in instruments archive data where run instruments with command line.like:
instruments -t Template.tracetemplate -D demo.trace -l 10000 -w test.app
demo.trace
intohttps://www.speedscope.app
Unrecognized format! See documentation about supported formats