Expand dump-functions for excluding user/unused memory (This is rebase commit for merging to development)
This commit is contained in:
committed by
Ken Sato
parent
325082a571
commit
a05b6e1ba8
6
test/dump/mcexec_test_proc/Makefile
Normal file
6
test/dump/mcexec_test_proc/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
OBJS = test_pt_1gb_10times test_pt_1gb_1time test_pt_1kb_1time test_pt_1mb_10times test_pt_20mb_1000times memtest_free_destroy memtest_used_destroy
|
||||
|
||||
all: $(OBJS)
|
||||
|
||||
clean:
|
||||
rm $(OBJS)
|
||||
14
test/dump/mcexec_test_proc/memtest_free_destroy.c
Normal file
14
test/dump/mcexec_test_proc/memtest_free_destroy.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#define _GNU_SOURCE
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
main() {
|
||||
|
||||
int rst = 0;
|
||||
|
||||
rst = syscall(902);
|
||||
printf("freemem_destroy result:%d\n",rst);
|
||||
|
||||
return;
|
||||
}
|
||||
14
test/dump/mcexec_test_proc/memtest_used_destroy.c
Normal file
14
test/dump/mcexec_test_proc/memtest_used_destroy.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#define _GNU_SOURCE
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
main() {
|
||||
|
||||
int rst = 0;
|
||||
|
||||
rst = syscall(901);
|
||||
printf("usedmem_destroy result:%d\n",rst);
|
||||
|
||||
return;
|
||||
}
|
||||
30
test/dump/mcexec_test_proc/test_pt_1gb_10times.c
Normal file
30
test/dump/mcexec_test_proc/test_pt_1gb_10times.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define MEM_SIZE (1024*1024*1024)
|
||||
#define LOOP_MAX 10
|
||||
#define SLEEP_TIME 30
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
int *buf,buf_size,index;
|
||||
|
||||
buf_size = MEM_SIZE;
|
||||
|
||||
for (index = 0; index < LOOP_MAX; index++) {
|
||||
buf = mmap(0, buf_size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (NULL != buf) {
|
||||
memset(buf, 1, buf_size);
|
||||
} else {
|
||||
printf("[%d] mmap error!!! buf_size:%d(0x%x)\n", index, buf_size, buf_size);
|
||||
}
|
||||
}
|
||||
printf("mmap is done\n");
|
||||
|
||||
sleep(SLEEP_TIME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
test/dump/mcexec_test_proc/test_pt_1gb_1time.c
Normal file
30
test/dump/mcexec_test_proc/test_pt_1gb_1time.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define MEM_SIZE (1024*1024*1024)
|
||||
#define LOOP_MAX 1
|
||||
#define SLEEP_TIME 30
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
int *buf,buf_size,index;
|
||||
|
||||
buf_size = MEM_SIZE;
|
||||
|
||||
for (index = 0; index < LOOP_MAX; index++) {
|
||||
buf = mmap(0, buf_size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (NULL != buf) {
|
||||
memset(buf, 1, buf_size);
|
||||
} else {
|
||||
printf("[%d] mmap error!!! buf_size:%d(0x%x)\n", index, buf_size, buf_size);
|
||||
}
|
||||
}
|
||||
printf("mmap is done\n");
|
||||
|
||||
sleep(SLEEP_TIME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
test/dump/mcexec_test_proc/test_pt_1kb_1time.c
Normal file
30
test/dump/mcexec_test_proc/test_pt_1kb_1time.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define MEM_SIZE (1024)
|
||||
#define LOOP_MAX 1
|
||||
#define SLEEP_TIME 30
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
int *buf,buf_size,index;
|
||||
|
||||
buf_size = MEM_SIZE;
|
||||
|
||||
for (index = 0; index < LOOP_MAX; index++) {
|
||||
buf = mmap(0, buf_size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (NULL != buf) {
|
||||
memset(buf, 1, buf_size);
|
||||
} else {
|
||||
printf("[%d] mmap error!!! buf_size:%d(0x%x)\n", index, buf_size, buf_size);
|
||||
}
|
||||
}
|
||||
printf("mmap is done\n");
|
||||
|
||||
sleep(SLEEP_TIME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
test/dump/mcexec_test_proc/test_pt_1mb_10times.c
Normal file
30
test/dump/mcexec_test_proc/test_pt_1mb_10times.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define MEM_SIZE (1024*1024)
|
||||
#define LOOP_MAX 10
|
||||
#define SLEEP_TIME 30
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
int *buf,buf_size,index;
|
||||
|
||||
buf_size = MEM_SIZE;
|
||||
|
||||
for (index = 0; index < LOOP_MAX; index++) {
|
||||
buf = mmap(0, buf_size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (NULL != buf) {
|
||||
memset(buf, 1, buf_size);
|
||||
} else {
|
||||
printf("[%d] mmap error!!! buf_size:%d(0x%x)\n", index, buf_size, buf_size);
|
||||
}
|
||||
}
|
||||
printf("mmap is done\n");
|
||||
|
||||
sleep(SLEEP_TIME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
test/dump/mcexec_test_proc/test_pt_20mb_1000times.c
Normal file
30
test/dump/mcexec_test_proc/test_pt_20mb_1000times.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define MEM_SIZE (1024*1024*20)
|
||||
#define LOOP_MAX 1024
|
||||
#define SLEEP_TIME 30
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
int *buf,buf_size,index;
|
||||
|
||||
buf_size = MEM_SIZE;
|
||||
|
||||
for (index = 0; index < LOOP_MAX; index++) {
|
||||
buf = mmap(0, buf_size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (NULL != buf) {
|
||||
memset(buf, 1, buf_size);
|
||||
} else {
|
||||
printf("[%d] mmap error!!! buf_size:%d(0x%x)\n", index, buf_size, buf_size);
|
||||
}
|
||||
}
|
||||
printf("mmap is done\n");
|
||||
|
||||
sleep(SLEEP_TIME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user