Skip to content

perfetto.common.exceptions.PerfettoException: Trace processor failed to start. Unable to run a simple query in python #5433

@hijaz-siemens

Description

@hijaz-siemens

I have this simple code in python:

from perfetto.trace_processor import TraceProcessor
tp = TraceProcessor(trace='out.perfetto-trace')

query_text = """
SELECT
  id,
  ts,
  dur,
  CASE WHEN state IN ('S', 'I') THEN 0 ELSE 1 END AS layer,
  ucpu,
  utid,
  sched_state_io_to_human_readable_string(state, io_wait) AS state,
  0 AS depth
FROM (thread_state)
WHERE utid = 38'
"""
qr_it = tp.query(query_text)
qr_df = qr_it.as_pandas_dataframe()
print(qr_df.to_string())

I keep getting:

python3 test.py 
Traceback (most recent call last):
  File "/home/hassanijaz/Downloads/test.py", line 2, in <module>
    tp = TraceProcessor(trace='out.perfetto-trace')
  File "/usr/local/lib/python3.10/dist-packages/perfetto/trace_processor/api.py", line 159, in __init__
    self.http = self._create_tp_http(addr)
  File "/usr/local/lib/python3.10/dist-packages/perfetto/trace_processor/api.py", line 280, in _create_tp_http
    url, self.subprocess = load_shell(
  File "/usr/local/lib/python3.10/dist-packages/perfetto/trace_processor/shell.py", line 104, in load_shell
    raise PerfettoException("Trace processor failed to start.\n"
perfetto.common.exceptions.PerfettoException: Trace processor failed to start.
stdout: 
############################################                              62.4%   

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions