Skip to content

Commit

Permalink
docs: improve CPU time query
Browse files Browse the repository at this point in the history
Fix the issue of the missing WHEN by instead switching to IIF which
makes the query clearer.

Fixes: #655
Change-Id: Id8c42e77033c1c01abac33f807932d1926389243
  • Loading branch information
LalitMaganti committed Dec 4, 2023
1 parent 4c92469 commit 1151d88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/analysis/common-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ For example to get the time spent "runnable" and in "uninterruptible sleep":
SELECT
slice_id,
slice_name,
SUM(CASE state = 'R' THEN dur ELSE 0 END) AS runnable_time,
SUM(CASE state = 'D' THEN dur ELSE 0 END) AS uninterruptible_time
SUM(IIF(state = 'R', dur, 0)) AS runnable_time,
SUM(IIF(state = 'D', dur, 0)) AS uninterruptible_time
FROM slice_thread_state_breakdown
GROUP BY slice_id;
```
Expand Down

0 comments on commit 1151d88

Please sign in to comment.