mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 16:25:27 +07:00
13790d1cc7
This new test captures stackmap with build_id with hardware event PERF_COUNT_HW_CPU_CYCLES. Because we only support one ips-to-build_id lookup per cpu in NMI context, stack_amap will not be able to do the lookup in this test. Therefore, we didn't do compare_stack_ips(), as it will alwasy fail. urandom_read.c is extended to run configurable cycles so that it can be caught by the perf event. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
29 lines
419 B
C
29 lines
419 B
C
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
|
|
#define BUF_SIZE 256
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int fd = open("/dev/urandom", O_RDONLY);
|
|
int i;
|
|
char buf[BUF_SIZE];
|
|
int count = 4;
|
|
|
|
if (fd < 0)
|
|
return 1;
|
|
|
|
if (argc == 2)
|
|
count = atoi(argv[1]);
|
|
|
|
for (i = 0; i < count; ++i)
|
|
read(fd, buf, BUF_SIZE);
|
|
|
|
close(fd);
|
|
return 0;
|
|
}
|