mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-11-27 09:01:33 +00:00
清理codex告警
Signed-off-by:wenlong12 <wenlong12@huawei.com> Signed-off-by: wenlong12 <wenlong12@huawei.com>
This commit is contained in:
parent
37d2be2a9b
commit
ce0395478c
@ -250,13 +250,15 @@ static void* HhreadFuncCpp(void* param)
|
||||
|
||||
static void TestMemoryMap()
|
||||
{
|
||||
constexpr int smartSize = 4096;
|
||||
constexpr int bigSize = 8192;
|
||||
int fd = open("/bin/hiebpf", O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (fd < 0) {
|
||||
printf("open %s failed\n", "/bin/hiebpf");
|
||||
return;
|
||||
}
|
||||
|
||||
void* mapAddr1 = mmap(nullptr, 4096, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_POPULATE, fd, 0);
|
||||
void* mapAddr1 = mmap(nullptr, smartSize, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_POPULATE, fd, 0);
|
||||
if (mapAddr1 == MAP_FAILED) {
|
||||
printf("named mmap failed\n");
|
||||
close(fd);
|
||||
@ -264,11 +266,11 @@ static void TestMemoryMap()
|
||||
}
|
||||
printf("named mmap size: 4096, fd: %d\n", fd);
|
||||
|
||||
void* mapAddr2 = mmap(nullptr, 8192, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
void* mapAddr2 = mmap(nullptr, bigSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (mapAddr2 == MAP_FAILED) {
|
||||
printf("anonymous mmap failed\n");
|
||||
close(fd);
|
||||
munmap(mapAddr1, 4096);
|
||||
munmap(mapAddr1, smartSize);
|
||||
return;
|
||||
}
|
||||
printf("anonymous mmap size: 8192\n");
|
||||
@ -279,8 +281,8 @@ static void TestMemoryMap()
|
||||
memtrace(reinterpret_cast<void*>(0x123456), 3333, "memtrace_test", false); // 3333 num
|
||||
printf("memtrace(0x123456, 3333, \"memtrace_test\", false)\n");
|
||||
close(fd);
|
||||
munmap(mapAddr1, 4096);
|
||||
munmap(mapAddr2, 8192);
|
||||
munmap(mapAddr1, smartSize);
|
||||
munmap(mapAddr2, bigSize);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
Loading…
Reference in New Issue
Block a user