Chrome trace startup got an unreadable json file

540 views
Skip to first unread message

Xing Xu

unread,
Feb 27, 2022, 8:55:39 PM2/27/22
to Chromium-dev
For example, when I start chrome like this: 
“chrome.exe"  --trace-startup --trace-startup-file=c:\foo.json --trace-startup-duration=7

The foo.json is messed with a lot of unreadable code.

However, the chrome://tracing still works.

Any hints for this?

Xu, Xing

unread,
Feb 28, 2022, 1:19:40 AM2/28/22
to Minoru Chikamune, Chromium-dev, Alexander Timin

This is great! Thanks Alex!

 

From: Minoru Chikamune <chik...@chromium.org>
Sent: Monday, February 28, 2022 1:07 PM
To: Xu, Xing <xin...@intel.com>
Cc: Chromium-dev <chromi...@chromium.org>; Alexander Timin <alt...@chromium.org>
Subject: Re: [chromium-dev] Chrome trace startup got an unreadable json file

 

Hi,

Recently, the default trace format has been changed from JSON to perfetto's proto traces. You can open the new format with http://ui.perfetto.dev/.

 

 

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/f5555fbf-27d9-4f36-a32c-c8324e9921ffn%40chromium.org.

Minoru Chikamune

unread,
Feb 28, 2022, 12:25:15 PM2/28/22
to xin...@intel.com, Chromium-dev, Alexander Timin
Hi,
Recently, the default trace format has been changed from JSON to perfetto's proto traces. You can open the new format with http://ui.perfetto.dev/.


On Mon, Feb 28, 2022 at 11:00 AM Xing Xu <xin...@intel.com> wrote:

Xing Xu

unread,
Mar 1, 2022, 9:28:56 AM3/1/22
to Chromium-dev, chik...@chromium.org, Chromium-dev, alt...@chromium.org, Xing Xu
Run below in git-bash, it complains:
$ trace_to_text.exe  json  test.json  testout.json
[030.646]     trace_to_json.cc:55 Could not convert userspace events: EXPORT_JSON: Couldn't open output file (errcode: 1)

The samejson file works in https://ui.perfetto.dev/.

Xu, Xing

unread,
Mar 1, 2022, 9:14:18 PM3/1/22
to Minoru Chikamune, Chromium-dev, alt...@chromium.org

Thanks! Below is how I run into this (Windows 10):

  1. “chrome.exe"  --trace-startup --trace-startup-file=c:\foo.json --trace-startup-duration=7, get the json file.
  2. First I tried traceconv, it seems failed to download trace_to_text.exe. So I download trace_to_text.exe  directly, and try ” trace_to_text.exe   json  test.json  testout.json”.

Then trace_to_text.exe  complains error “trace_to_json.cc:55 Could not convert userspace events: EXPORT_JSON: Couldn't open output file (errcode: 1)”

 

I also tried “trace_to_text.exe  text  test.json  testout.json”. It works, but not I want.

 

So maybe it is possible due to something wrong with mode = json ? or Have I missed any thing?

 

 

 

From: Minoru Chikamune <chik...@chromium.org>
Sent: Wednesday, March 2, 2022 9:16 AM
To: Xu, Xing <xin...@intel.com>
Cc: Chromium-dev <chromi...@chromium.org>; alt...@chromium.org <alt...@chromium.org>
Subject: Re: [chromium-dev] Chrome trace startup got an unreadable json file

 

I'm not sure if the following works for you, but

I'm using traceconv command that is included in the chromium repository.

I haven't seen any problems with this tool so far.

 

(There are several useful tools under third_party/perfetto/tools such as open_trace_in_ui (open trace log with https://ui.perfetto.dev/ from command line).)

 

chromium/src $ third_party/perfetto/tools/traceconv -h

Usage: perfetto/prebuilts/trace_to_text MODE [OPTIONS] [input file] [output file]

modes:

  systrace|json|ctrace|text|profile|hprof|symbolize|deobfuscate

options:

  [--truncate start|end]

  [--full-sort]

"profile" mode options:

  [--perf] generate a perf profile instead of a heap profile

  [--no-annotations] do not suffix frame names with derived annotations

  [--timestamps TIMESTAMP1,TIMESTAMP2,...] generate profiles only for these *specific* timestamps

  [--pid PID] generate profiles only for this process id

 

chromium/src $ third_party/perfetto/tools/traceconv text trace.pftrace | head

Processing trace:        0 KB

packet {

  trusted_uid: 778166

  clock_snapshot {

    clocks {

      clock_id: 6

      timestamp: 761542087044161

    }

    clocks {

      clock_id: 2

 

Siddhartha S

unread,
Mar 1, 2022, 11:44:51 PM3/1/22
to xin...@intel.com, Minoru Chikamune, Chromium-dev, alt...@chromium.org
To view the trace in the old trace viewer you can click on the "Switch to Legacy UI" button in the Perfetto UI. You do not need to run SQL to do this conversion.
You can also download the json trace by clicking "Convert to JSON" in the new UI and "Save" in the old UI.

Xu, Xing

unread,
Mar 2, 2022, 12:08:16 AM3/2/22
to Siddhartha S, Minoru Chikamune, Chromium-dev, alt...@chromium.org

Yes, the online tool “"Convert to JSON"” works (Also chrome tracing works). But for my case, I need to convert this perffetto format to JSON with a Windows (Windows 10) command like traceconv (As mentioned below.)

Minoru Chikamune

unread,
Mar 2, 2022, 3:32:55 PM3/2/22
to Xing Xu, Chromium-dev, alt...@chromium.org

Minoru Chikamune

unread,
Mar 2, 2022, 5:33:14 PM3/2/22
to Xu, Xing, Siddhartha S, Chromium-dev, alt...@chromium.org
> trace_to_text.exe  text  test.json  testout.json

You can convert the pftrace format to json like below.

third_party/perfetto/tools/traceconv  json  test.pftrace  testout.json

Xing Xu

unread,
Mar 2, 2022, 7:47:40 PM3/2/22
to Chromium-dev, chik...@chromium.org, Siddhartha S, Chromium-dev, alt...@chromium.org, Xing Xu
Thanks for all your feedback.  But what I am trying to convert is chrome tracing, not ptrace.

BTW, I filed a bug here: 
https://bugs.chromium.org/p/chromium/issues/detail?id=1302458
Reply all
Reply to author
Forward
0 new messages