Re: [PATCH 06/12] trace-cmd analyze: Add tracing of tasks and their states

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 23, 2022 at 10:57:20PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
> 
> If sched_switch is found and has the prev_state field, then record them
> and keep track of the time the task was in the state, the number of times
> it was scheduled out of the state, and print the total time, average time,
> and number of times the task was scheduled out of that state. Also show
> the time stamp of where the longest time it went into that state.
> 
> Currently the only states that are supported are "preempted" (which was in
> state running), "blocked" (state uninterruptible), "sleeping" (state
> interruptible), and "other" (all other states).
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
> ---
> @@ -288,6 +337,24 @@ static void process_switch(struct analysis_data *data,
>  		task->start_ts = record->ts;
>  		cpu_data->current_pid = pid;
>  
> +		switch (task->last_state) {
> +		case -1:
> +			/* First time seen */
> +			break;
> +		case 0:
> +			update_sched_timings(&task->preempt, record->ts);
> +			break;
> +		case 0x1:
> +			update_sched_timings(&task->sleep, record->ts);
> +			break;
> +		case 0x2:
> +			update_sched_timings(&task->blocked, record->ts);
> +			break;
> +		default:
> +			update_sched_timings(&task->other, record->ts);
> +		}
> +		task->last_state = val & 0x1f;

val is next_pid here, does last_state even need to be updated for the
switched-to task?



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux