feat(profiling): generate chrome compatible timeline data
PR Checklist
- [x] The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages.
- [ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
- [x] You have signed the CLA.
- [x] All existing tests are passing: https://github.com/NativeScript/nativescript-cli/blob/master/CONTRIBUTING.md#contribute-to-the-code-base
- [ ] Tests for the changes are included.
What is the current behavior?
Profiling requires installing an external tool (timeline-view) and piping the output of a run command into it to generate a timeline html view.
What is the new behavior?
A timeline json file is generated automatically when timeline profiling is enabled (profiling: "timeline" in the nativescript config). The file is saved when the run is canceled with ctrl+c. The output json can be loaded into chrome devtools -> Performance and loading the json.
Commented out the SIGINT handling override - as it prevented listening for it for writing the timeline jsons - however this might cause side effects, so a different approach might be required.
For example and idle timeout, if no new traces come in within X seconds, it's automatically saved.
Another approach is listening for a keypress (for example s for "stop") and then stopping the timeline.
Other...?