perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

How to open large trace files with perfetto

Open ManiacLook opened this issue 1 year ago • 6 comments

Hello.

I used the following trace configuration to obtain the trace data of the Linux system. The obtained trace file size is 1.8GB, but the perfetto tool shows that it cannot be opened.

I would like to ask, is there any way to open a larger trace file? (1)For example, is there a tool that can split trace files by time?
(2)Or adjust the upper limit of the file size that the perfetto tool can open?

In addition, I also followed the improvement of perfetto shown in the figure below and started the server on a Linux device, but I couldn't open the trace file either.

Image

Thank you.

buffers {
  size_kb: 32768
  fill_policy: DISCARD
}

# Ftrace data from the kernel, mainly the process scheduling events.
data_sources {
  config {
    name: "linux.ftrace"
    target_buffer: 0
    ftrace_config {
      ftrace_events: "sched_switch"
      ftrace_events: "sched_waking"
      ftrace_events: "sched_wakeup_new"

      ftrace_events: "task_newtask"
      ftrace_events: "task_rename"

      ftrace_events: "sched_process_exec"
      ftrace_events: "sched_process_exit"
      ftrace_events: "sched_process_fork"
      ftrace_events: "sched_process_free"
      ftrace_events: "sched_process_hang"
      ftrace_events: "sched_process_wait"
    }
  }
}

# Resolve process commandlines and parent/child relationships, to better
# interpret the ftrace events, which are in terms of pids.
data_sources {
  config {
    name: "linux.process_stats"
    target_buffer: 0
  }
}

# 20s trace, but can be stopped prematurely.
duration_ms: 20000```

ManiacLook avatar Apr 30 '25 09:04 ManiacLook

(1)For example, is there a tool that can split trace files by time?

Splitting traces is actually a very difficult problem, and there currently exists no such tool to do this.

(2)Or adjust the upper limit of the file size that the perfetto tool can open?

We are limited by the technology as wasm uses a 32 bit address space. (The error message you're seeing is actually out of date, it should read 4GB).

The reason why you're hitting this limit when the trace is only 1.8GB is because trace processor unpacks the trace into memory and may allocate even more memory in order to make the visualization tools more performant.

The canonical way to load larger traces is to use the native acceleration as documented in the error message you posted. This is widely used so I'm surprised it's not working for you. Can you provide more details about what went wrong when you tried to use it?

Edit: Remove assertion for clarity.

stevegolton avatar Apr 30 '25 13:04 stevegolton

Closing this for now, feel free to reopen if you think there is a bug with native acceleration.

stevegolton avatar May 02 '25 08:05 stevegolton

(1)For example, is there a tool that can split trace files by time?

Splitting traces is actually a very difficult problem, and there currently exists no such tool to do this.

(2)Or adjust the upper limit of the file size that the perfetto tool can open?

We are limited by the technology as wasm uses a 32 bit address space. (The error message you're seeing is actually out of date, it should read 4GB).

The reason why you're hitting this limit when the trace is only 1.8GB is because trace processor unpacks the trace into memory and may allocate even more memory in order to make the visualization tools more performant.

The canonical way to load larger traces is to use the native acceleration as documented in the error message you posted. This is widely used so I'm surprised it's not working for you. Can you provide more details about what went wrong when you tried to use it?

Edit: Remove assertion for clarity.

Thank you for your answer. I have 2 new questions: (1)Can native acceleration be used on Windows systems? (2)Is there a plan in the future to provide a tool for splitting trace files?

ManiacLook avatar May 07 '25 02:05 ManiacLook

  1. yes
  2. no plans at the moment but may be something we do some day.

LalitMaganti avatar May 07 '25 02:05 LalitMaganti

  1. yes

Do you have any instructions for using it on a Windows system, as I haven't found them yet. Thank you.

ManiacLook avatar May 07 '25 02:05 ManiacLook

It's the same instructions as on Linux. You just need to have python installed.

LalitMaganti avatar May 07 '25 02:05 LalitMaganti