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

Support importing simpleperf trace files from Android Studio #5212

Merged
merged 13 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/profile-logic/import/proto
src/types/libdef/npm
docs-user
coverage
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ esproposal.optional_chaining=enable
[ignore]
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/dist/.*
src/profile-logic/import/proto/.*

[libs]
src/types/libdef
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/profile-logic/import/proto
src/types/libdef/npm
docs-user
src/test/fixtures/upgrades
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"flow-stop": "flow stop",
"flow-coverage": "flow-coverage-report -i 'src/**/*.js' -t html -t text",
"flow-generate-libdefs": "flow-typed install --libdefDir src/types/libdef",
"protoc": "npx -p protobufjs-cli pbjs -t static-module -w commonjs -o ./src/profile-logic/import/proto/simpleperf_report.js ./src/profile-logic/import/proto/simpleperf_report.proto",
"license-check": "devtools-license-check",
"preinstall": "node bin/pre-install.js",
"publish": "rimraf public_html && cp -r dist public_html",
Expand Down Expand Up @@ -78,12 +79,14 @@
"gecko-profiler-demangle": "^0.3.3",
"idb": "^8.0.0",
"jszip": "^3.10.1",
"long": "^5.2.3",
"memoize-immutable": "^3.0.0",
"memoize-one": "^6.0.0",
"minimist": "^1.2.8",
"mixedtuplemap": "^1.0.0",
"namedtuplemap": "^1.0.0",
"photon-colors": "^3.3.2",
"protobufjs": "^7.4.0",
"query-string": "^9.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
14 changes: 14 additions & 0 deletions src/profile-logic/data-structures.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ export function getEmptyStackTable(): StackTable {
};
}

export function getEmptySamplesTable(): SamplesTable {
return {
// Important!
// If modifying this structure, please update all callers of this function to ensure
// that they are pushing on correctly to the data structure. These pushes may not
// be caught by the type system.
weightType: 'samples',
weight: null,
stack: [],
time: [],
length: 0,
};
}

/**
* Returns an empty samples table with eventDelay field instead of responsiveness.
* eventDelay is a new field and it replaced responsiveness. We should still
Expand Down
9 changes: 9 additions & 0 deletions src/profile-logic/import/proto/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# proto files for importers - /src/profile-logic/import/proto

This directory contains the protocol buffer definition (`.proto`) files required for various importers, along with the corresponding compiled `.js` files.

When adding or changing the `.proto` files in this directory, you should compile the updated `.proto` files using the following command and commit both updated `.proto` and the compiled `.js` files.

```bash
yarn protoc
```
Loading