|
|
@@ -98,9 +98,10 @@ int handle_sched_switch(struct trace_event_raw_sched_switch *ctx)
|
|
|
if (!tidCpuTime) {
|
|
|
return 0;
|
|
|
}
|
|
|
- cw_bpf_debug("sched_switch function find the trace_tid_cpu_time\n");
|
|
|
+ cw_bpf_debug("sched_switch next_pid is %d, prev_pid is %d, tid is %d\n",ctx->next_pid, ctx->prev_pid, tid);
|
|
|
if(ctx->next_pid == tid){
|
|
|
//切入 CPU
|
|
|
+ cw_bpf_debug("enter the cpu in \n");
|
|
|
__u64 currentTime = bpf_ktime_get_ns();
|
|
|
//runqtime
|
|
|
duration = currentTime - tidCpuTime->runq_start;
|
|
|
@@ -133,6 +134,7 @@ int handle_sched_switch(struct trace_event_raw_sched_switch *ctx)
|
|
|
|
|
|
}else if(ctx->prev_pid == tid){
|
|
|
//切出 CPU
|
|
|
+ cw_bpf_debug("enter the cpu out \n");
|
|
|
//记录CPU切出时间,方便后续记录总时间。
|
|
|
tidCpuTime->cpu_out_start = bpf_ktime_get_ns();
|
|
|
if(tidCpuTime->cpu_in_start > 0){
|