perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

query uninterruptible sleep state with python sql

Open wjj1928 opened this issue 2 years ago • 1 comments

I Attached trace thread 3492 has a ANR happen, so I check the status from perfetto UI and got below image: image

I would like to query "uninterruptible sleep" with python api. I try below statement but not find "uninterruptible sleep" slice: ` sql = 'select ts, dur, cpu, end_state, priority, process.name, thread.name from sched_slice left join thread using(utid) left join process using(upid)'

And what maybe the reason cause a 39 secs "uninterruptible sleep"? Uploading boottrace.perfetto-trace.zip… `

wjj1928 avatar Dec 11 '23 01:12 wjj1928

Hi. This issue is not related with python API, you are just not querying the right table. This query should give you good results:

SELECT 
ts, 
dur, 
cpu, 
utid, 
upid, 
thread.name AS thread_name,
process.name AS process_name, 
state 
FROM thread_state 
LEFT JOIN thread USING (utid) 
LEFT JOIN process USING (upid)

If you filter on state = 'D' you will get all uninterruptible sleep slices.

aMayzner avatar Dec 11 '23 13:12 aMayzner