Change miniprofiler file extension to `.miniprof.json` (#50429)

Kunall Banerjee created

The main intention behind this change is to support uploading these
files
to GitHub. `.miniprof` is not a supported extension by GitHub, but
`.json` is.

The only “downside” to this change is that the cleanup process will have
to look
for `.miniprof` files AND `.miniprof.json` files. Maybe we can remove
that change
at a later date?

Ref:
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Changed miniprofiler file extension to `.miniprof.json`

Change summary

crates/miniprofiler_ui/src/miniprofiler_ui.rs | 2 +-
crates/zed/src/reliability.rs                 | 6 +++---
docs/src/performance.md                       | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)

Detailed changes

crates/miniprofiler_ui/src/miniprofiler_ui.rs 🔗

@@ -544,7 +544,7 @@ impl Render for ProfilerWindow {
 
                                         let path = cx.prompt_for_new_path(
                                             &active_path,
-                                            Some("performance_profile.miniprof"),
+                                            Some("performance_profile.miniprof.json"),
                                         );
 
                                         cx.background_spawn(async move {

crates/zed/src/reliability.rs 🔗

@@ -144,7 +144,7 @@ fn cleanup_old_hang_traces() {
                 entry
                     .path()
                     .extension()
-                    .is_some_and(|ext| ext == "miniprof")
+                    .is_some_and(|ext| ext == "json" || ext == "miniprof")
             })
             .collect();
 
@@ -175,7 +175,7 @@ fn save_hang_trace(
         .collect::<Vec<_>>();
 
     let trace_path = paths::hang_traces_dir().join(&format!(
-        "hang-{}.miniprof",
+        "hang-{}.miniprof.json",
         hang_time.format("%Y-%m-%d_%H-%M-%S")
     ));
 
@@ -193,7 +193,7 @@ fn save_hang_trace(
                 entry
                     .path()
                     .extension()
-                    .is_some_and(|ext| ext == "miniprof")
+                    .is_some_and(|ext| ext == "json" || ext == "miniprof")
             })
             .collect();
 

docs/src/performance.md 🔗

@@ -78,7 +78,7 @@ Download the importer
 - `cd import && mkdir build && cd build`
 - Run cmake to generate build files: `cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..`
 - Build the importer: `ninja`
-- Run the importer on the trace file: `./tracy-import-miniprofiler /path/to/trace.miniprof /path/to/output.tracy`
+- Run the importer on the trace file: `./tracy-import-miniprofiler /path/to/trace.miniprof.json /path/to/output.tracy`
 - Open the trace in tracy:
   - If you're on windows download the v0.12.2 version from the releases on the upstream repo
   - If you're on other platforms open it on the website: https://tracy.nereid.pl/ (the version might mismatch so your luck might vary, we need to host our own ideally..)
@@ -87,7 +87,7 @@ Download the importer
 
 - Run the action: `zed open performance profiler`
 - Hit the save button. This opens a save dialog or if that fails to open the trace gets saved in your working directory.
-- Convert the profile so it can be imported in tracy using the importer: `./tracy-import-miniprofiler <path to performance_profile.miniprof> output.tracy`
+- Convert the profile so it can be imported in tracy using the importer: `./tracy-import-miniprofiler <path to performance_profile.miniprof.json> output.tracy`
 - Go to <https://tracy.nereid.pl/> hit the 'power button' in the top left and then open saved trace.
 - Now zoom in to see the tasks and how long they took