forked from linuxkerneltravel/lmp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'linuxkerneltravel:develop' into develop
- Loading branch information
Showing
432 changed files
with
376,269 additions
and
1,022 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../CPU_Subsystem/cpu_watcher/cs_delay.bpf.c → ..._Subsystem/cpu_watcher/bpf/cs_delay.bpf.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://github.com/linuxkerneltravel/lmp/blob/develop/LICENSE | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: [email protected] [email protected] [email protected] | ||
|
||
#include <vmlinux.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_core_read.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright 2024 The LMP Authors. | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
|
@@ -12,7 +12,7 @@ | |
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: [email protected] | ||
// author: [email protected] [email protected] [email protected] | ||
|
||
#include "vmlinux.h" | ||
#include <bpf/bpf_helpers.h> //包含了BPF 辅助函数 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://github.com/linuxkerneltravel/lmp/blob/develop/LICENSE | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: [email protected] [email protected] [email protected] | ||
|
||
#include <vmlinux.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_core_read.h> | ||
|
@@ -33,7 +49,8 @@ int BPF_PROG(sched_switch, bool preempt, struct task_struct *prev, struct task_s | |
return 0; | ||
} | ||
|
||
SEC("kprobe/finish_task_switch") | ||
// SEC("kprobe/finish_task_switch") | ||
SEC("kprobe/finish_task_switch.isra.0") | ||
int BPF_KPROBE(finish_task_switch, struct task_struct *prev) { | ||
u64 end_time = bpf_ktime_get_ns(); | ||
pid_t pid = BPF_CORE_READ(prev, pid); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://github.com/linuxkerneltravel/lmp/blob/develop/LICENSE | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: [email protected] [email protected] [email protected] | ||
|
||
#include <vmlinux.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_core_read.h> | ||
|
@@ -36,8 +52,8 @@ BPF_ARRAY(ut_LastTime,u32,u64,1); | |
BPF_ARRAY(tick_user,u32,u64,1); | ||
BPF_ARRAY(symAddr,u32,u64,1); | ||
// 统计fork数 | ||
//SEC("kprobe/finish_task_switch.isra.0") | ||
SEC("kprobe/finish_task_switch") | ||
SEC("kprobe/finish_task_switch.isra.0") | ||
// SEC("kprobe/finish_task_switch") | ||
int kprobe__finish_task_switch(struct pt_regs *ctx) | ||
{ | ||
u32 key = 0; | ||
|
@@ -75,8 +91,8 @@ int trace_sched_switch2(struct cswch_args *info) { | |
return 0; | ||
} | ||
|
||
SEC("kprobe/finish_task_switch") | ||
//SEC("kprobe/finish_task_switch.isra.0") | ||
// SEC("kprobe/finish_task_switch") | ||
SEC("kprobe/finish_task_switch.isra.0") | ||
int BPF_KPROBE(finish_task_switch,struct task_struct *prev){ | ||
pid_t pid=BPF_CORE_READ(prev,pid); | ||
u64 *val, time = bpf_ktime_get_ns(); | ||
|
16 changes: 16 additions & 0 deletions
16
.../CPU_Subsystem/cpu_watcher/sc_delay.bpf.c → ..._Subsystem/cpu_watcher/bpf/sc_delay.bpf.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://github.com/linuxkerneltravel/lmp/blob/develop/LICENSE | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: [email protected] [email protected] [email protected] | ||
|
||
#include "vmlinux.h" | ||
#include <bpf/bpf_helpers.h> //包含了BPF 辅助函数 | ||
#include <bpf/bpf_tracing.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://github.com/linuxkerneltravel/lmp/blob/develop/LICENSE | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: [email protected] [email protected] [email protected] | ||
|
||
#include <vmlinux.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_core_read.h> | ||
|
@@ -111,18 +127,30 @@ int BPF_PROG(sched_switch, bool preempt, struct task_struct *prev, struct task_s | |
struct sum_schedule sum_schedule= {}; | ||
sum_schedule.sum_count++; | ||
sum_schedule.sum_delay += delay; | ||
if (delay > sum_schedule.max_delay) | ||
if (delay > sum_schedule.max_delay){ | ||
sum_schedule.max_delay = delay; | ||
if (sum_schedule.min_delay == 0 || delay < sum_schedule.min_delay) | ||
if(next->pid!=0){ | ||
sum_schedule.pid_max = next->pid; | ||
} | ||
}else if (sum_schedule.min_delay == 0 || delay < sum_schedule.min_delay) | ||
sum_schedule.min_delay = delay; | ||
if(next->pid!=0){ | ||
sum_schedule.pid_min = next->pid; | ||
} | ||
bpf_map_update_elem(&sys_schedule, &key, &sum_schedule, BPF_ANY); | ||
} else { | ||
sum_schedule->sum_count++; | ||
sum_schedule->sum_delay += delay; | ||
if (delay > sum_schedule->max_delay) | ||
if (delay > sum_schedule->max_delay){ | ||
sum_schedule->max_delay = delay; | ||
if (sum_schedule->min_delay == 0 || delay < sum_schedule->min_delay) | ||
if(next->pid!=0){ | ||
sum_schedule->pid_max = next->pid; | ||
} | ||
}else if (sum_schedule->min_delay == 0 || delay < sum_schedule->min_delay) | ||
sum_schedule->min_delay = delay; | ||
if(next->pid!=0){ | ||
sum_schedule->pid_min = next->pid; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
Oops, something went wrong.