query uninterruptible sleep state with python sql
I Attached trace thread 3492 has a ANR happen, so I check the status from perfetto UI and got below 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… `
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.