Download json manually in chrome: // tracing

I have trace event JSON data and I want to view it with chrome://tracing . However, I do not want to load JSON every time.

Is there a way to pass JSON data to chrome://tracing so that without manually clicking on the download data all my data is loaded?

+6
source share
3 answers

The Trace-viewer tool loads a JSON file in three ways:

  • When recording a new trace
  • When downloading a file using the download button after selecting a file
  • When deletes a file in a tab (drag and drop)

All of them perform a one-time update of the active trace.


Technical details

Take a look at profiling_view and notice

  tr.ui.b.readFile(file).then( ... this.setActiveTrace(file.name, data); 

and several setActiveTrace call options from beginRecording, onLoadClicked_ and dropHandler_.


Solution Recommendations

Yes, there are several ways to transfer json data to chrome: // tracing (i.e. a trace viewer) without manually clicking on the load data.

Depending on how much effort you want to put into it:

See fswatch, a cross-platform file change monitor.

+2
source

this GopherCon video shows another solution, which I think is to load an HTML page into the browser, possibly with built-in Javascript that โ€œdownloadsโ€ the trace file. Although I suspect that it is not from a file on disk, but "serving" it directly through a user http-server.

0
source

Here's a solution if you can ease the requirement to open it using Chrome-Tracing. Speedscope is a great replacement that can be easily run from the command line.

For offline use or convenience in the terminal, you can also set the speedoscope via npm:

 npm install -g speedscope 

Calling speedscope / path / to / profile will load speedscope into the default browser. A source

speedscope <my-chrome-tracing.json> opens the file.

enter image description here

Speedscopes offers different views, but sometimes they do not coincide with Chrome-Tracing. So this may not be the right choice for all use cases.

0
source

Source: https://habr.com/ru/post/1275751/


All Articles