blob: 80b5c7da395a47589a7793c0e68530120f0beb2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env bash
. $(dirname $(readlink -e "${BASH_SOURCE[0]}"))/test-libs.sh
config-timeout $(stress_timeout)
#require-kernel-append nomem_profiling
test_bench()
{
cat > /root/bench.c <<-ZZ
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
int madvise_test(long in1, long in2)
{
return madvise((void*)in1, (size_t)in2, 25);
}
int main(int argc, char *argv[])
{
long in1 = 0, in2 = 0;
int res;
if (argc > 1) {
in1 = atol(argv[1]);
if (argc > 2) {
in2 = atol(argv[2]);
}
}
res = madvise_test(in1, in2);
printf("madvise_test(%ld, %ld) returned %d\n", in1, in2, res);
return res;
}
ZZ
gcc -o /root/bench /root/bench.c
time /root/bench 2
perf record -- /root/bench 2
perf report --sort=symbol|head -n60|cut -b1-50 || true
}
main "$@"
|