Skip to content

Commit

Permalink
修改cs_delay输出bug
Browse files Browse the repository at this point in the history
  • Loading branch information
albertxu216 committed Jan 17, 2025
1 parent 26b63ee commit f522a54
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions eBPF_Supermarket/CPU_Subsystem/cpu_watcher/cpu_watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ static int print_all()
return 0;
}

int count[25]={0};//定义一个count数组,用于汇总schedul()调度时间,以log2(时间间隔)为统计依据;
int count[25]={0} , cs_flag=0;//定义一个count数组,用于汇总schedul()调度时间,以log2(时间间隔)为统计依据;
static int handle_event(void *ctx, void *data,unsigned long data_sz)
{
const struct event *e = data;
Expand All @@ -449,6 +449,8 @@ static int handle_event(void *ctx, void *data,unsigned long data_sz)
i ++;
}
count[i]++;
if(!cs_flag)
cs_flag = 1;
return 0;
}
static int print_hstgram(int i,int max,int per_len)
Expand Down Expand Up @@ -1101,7 +1103,11 @@ int main(int argc, char **argv)
printf("Error polling perf buffer: %d\n", err);
break;
}
histogram();
struct cs_ctrl *cs_ctrl;
int ctrl_key = 0 ;
if(cs_flag){
histogram();
}
}
else if(env.SYSCALL_DELAY){
err = ring_buffer__poll(rb, 100 /* timeout, ms */); //ring_buffer__poll(),轮询打开ringbuf缓冲区。如果有事件,handle_event函数会执行
Expand Down

0 comments on commit f522a54

Please sign in to comment.