mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
workqueue: Track and monitor per-workqueue CPU time usage
Now that wq_worker_tick() is there, we can easily track the rough CPU time consumption of each workqueue by charging the whole tick whenever a tick hits an active workqueue. While not super accurate, it provides reasonable visibility into the workqueues that consume a lot of CPU cycles. wq_monitor.py is updated to report the per-workqueue CPU times. v2: wq_monitor.py was using "cputime" as the key when outputting in json format. Use "cpu_time" instead for consistency with other fields. Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -212,6 +212,7 @@ struct worker_pool {
|
||||
enum pool_workqueue_stats {
|
||||
PWQ_STAT_STARTED, /* work items started execution */
|
||||
PWQ_STAT_COMPLETED, /* work items completed execution */
|
||||
PWQ_STAT_CPU_TIME, /* total CPU time consumed */
|
||||
PWQ_STAT_CPU_INTENSIVE, /* wq_cpu_intensive_thresh_us violations */
|
||||
PWQ_STAT_CM_WAKEUP, /* concurrency-management worker wakeups */
|
||||
PWQ_STAT_MAYDAY, /* maydays to rescuer */
|
||||
@@ -1136,6 +1137,8 @@ void wq_worker_tick(struct task_struct *task)
|
||||
if (!pwq)
|
||||
return;
|
||||
|
||||
pwq->stats[PWQ_STAT_CPU_TIME] += TICK_USEC;
|
||||
|
||||
/*
|
||||
* If the current worker is concurrency managed and hogged the CPU for
|
||||
* longer than wq_cpu_intensive_thresh_us, it's automatically marked
|
||||
|
Reference in New Issue
Block a user