'Per-TID top CPU usage', [
('process', 'Process', mi.Process),
('migrations', 'Migration count', mi.Integer, 'migrations'),
+ ('priority', 'Priority', mi.Integer),
('usage', 'CPU usage', mi.Ratio),
]
),
result_table.append_row(
process=mi.Process(tid.comm, tid=tid.tid),
migrations=mi.Integer(tid.migrate_count),
+ priority=mi.Integer(tid.prio),
usage=mi.Ratio.from_percentage(tid.usage_percent)
)
count += 1
for row in result_table.rows:
process_do = row.process
migration_count = row.migrations.value
- output_str = '%s (%d)' % (process_do.name, process_do.tid)
+ if row.priority.value is not None:
+ prio_str = 'prio: %d' % row.priority.value
+ else:
+ prio_str = 'prio: ?'
+ output_str = '%s (%d) (%s)' % (process_do.name, process_do.tid,
+ prio_str)
if migration_count > 0:
output_str += ', %d migrations' % (migration_count)
prev_tid = kwargs['prev_tid']
next_tid = kwargs['next_tid']
next_comm = kwargs['next_comm']
+ next_prio = kwargs['next_prio']
if not self._filter_cpu(cpu_id):
return
next_proc = self.tids[next_tid]
next_proc.last_sched_ts = timestamp
+ next_proc.prio = next_prio
def _process_sched_migrate_task(self, **kwargs):
cpu_id = kwargs['cpu_id']
def __init__(self, tid, comm):
self.tid = tid
self.comm = comm
+ # Currently only the latest prio is tracked
+ self.prio = None
# CPU Time and timestamp in nanoseconds (ns)
self.total_cpu_time = 0
self.last_sched_ts = None