-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #844 from Super-Lzzx/develop
Mem_watcher:修改mem_watcher结构,增加测试代码
- Loading branch information
Showing
29 changed files
with
97 additions
and
132 deletions.
There are no files selected for viewing
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
eBPF_Supermarket/Memory_Subsystem/mem_watcher/test/pr_test/Makefile
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Compiler and flags | ||
CC = gcc | ||
CFLAGS = -Wall | ||
|
||
# Source files | ||
C_SRC = pr_test.c | ||
|
||
# Output binary | ||
C_OUT = pr_test | ||
|
||
.PHONY: all clean run | ||
|
||
all: $(C_OUT) | ||
|
||
$(C_OUT): $(C_SRC) | ||
$(CC) $(CFLAGS) $< -o $@ | ||
|
||
clean: | ||
rm -f $(C_OUT) | ||
|
||
run: $(C_OUT) | ||
sudo ./$(C_OUT) |
36 changes: 36 additions & 0 deletions
36
eBPF_Supermarket/Memory_Subsystem/mem_watcher/test/pr_test/pr_test.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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
|
||
#define ALLOC_SIZE 1024*1024*1024 // 分配 512 MB 内存 | ||
|
||
int main() { | ||
void *memory; | ||
printf("Allocating memory...\n"); | ||
memory = malloc(ALLOC_SIZE); | ||
if (!memory) { | ||
perror("Failed to allocate memory"); | ||
return -1; | ||
} | ||
|
||
// 填充内存以确保页面被分配 | ||
printf("Filling memory...\n"); | ||
for (size_t i = 0; i < ALLOC_SIZE; ++i) { | ||
((char*)memory)[i] = (char)i; | ||
} | ||
|
||
printf("Freeing memory...\n"); | ||
free(memory); | ||
|
||
// 给内核更多时间处理回收 | ||
printf("Sleeping for 10 seconds...\n"); | ||
sleep(10); // 增加等待时间到 10 秒 | ||
|
||
printf("Memory management demo finished.\n"); | ||
return 0; | ||
} | ||
|
||
// 分配大量内存。 | ||
//填充内存以确保页面分配。 | ||
//释放内存。 | ||
//等待一段时间以允许内核处理任何可能的内存回收。 |
4 changes: 2 additions & 2 deletions
4
eBPF_Supermarket/Memory_Subsystem/old_project/mem_watcher/cma/Makefile
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
4 changes: 2 additions & 2 deletions
4
eBPF_Supermarket/Memory_Subsystem/old_project/mem_watcher/ion/Makefile
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
4 changes: 2 additions & 2 deletions
4
...emory_Subsystem/old_project/time/Makefile → ...Subsystem/old_project/page_fault/Makefile
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
4 changes: 2 additions & 2 deletions
4
eBPF_Supermarket/Memory_Subsystem/old_project/procstat/Makefile
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
4 changes: 2 additions & 2 deletions
4
eBPF_Supermarket/Memory_Subsystem/old_project/sysstat/Makefile
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