Skip to content

support array format of chrome event trace #5429

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

Open
hardfist opened this issue Apr 16, 2025 · 5 comments · May be fixed by #5439
Open

support array format of chrome event trace #5429

hardfist opened this issue Apr 16, 2025 · 5 comments · May be fixed by #5439

Comments

@hardfist
Copy link

hardfist commented Apr 16, 2025

It seems profiler already support the following format of chrome event trace

{
  "traceEvents": [
  {
      "ph": "M",
      "pid": 1,
      "name": "thread_name",
      "tid": 0,
      "args": {
        "name": "tokio-13"
      }
    },
    {
      "ph": "b",
      "pid": 1,
      "ts": 41996.458,
      "name": "Compiler:build",
      "cat": "rspack",
      "tid": 0,
      "id": 1,
      ".file": "crates/rspack_core/src/compiler/mod.rs",
      ".line": 197
    },
]
}

but doesn't support array format(which is supported in other tools like perfetto)

 [
  {
      "ph": "M",
      "pid": 1,
      "name": "thread_name",
      "tid": 0,
      "args": {
        "name": "tokio-13"
      }
    },
    {
      "ph": "b",
      "pid": 1,
      "ts": 41996.458,
      "name": "Compiler:build",
      "cat": "rspack",
      "tid": 0,
      "id": 1,
      ".file": "crates/rspack_core/src/compiler/mod.rs",
      ".line": 197
    },
]

so I wonder whether profiler could support array format since it's more friendly when you combine multi trace file

┆Issue is synchronized with this Jira Task

@julienw
Copy link
Contributor

julienw commented Apr 16, 2025

My understanding is that we should support this too, see

if (Array.isArray(json)) {

Do you have a profile example that we could take a peek at ? :-)

@hardfist
Copy link
Author

@julienw trace.json this will throw following error but works fine in perfetto

Image

@hardfist
Copy link
Author

@julienw sorry to ping you again, do you need more extra info?

@julienw
Copy link
Contributor

julienw commented Apr 30, 2025

Thanks for reminding me.
I have a patch that makes this trace work.
@hardfist Would it be OK to include this trace or part of it in a test?

julienw added a commit to julienw/perf.html that referenced this issue Apr 30, 2025
@julienw julienw linked a pull request Apr 30, 2025 that will close this issue
@hardfist
Copy link
Author

Thanks for reminding me. I have a patch that makes this trace work. @hardfist Would it be OK to include this trace or part of it in a test?

thanks feel free to use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants