| 1 |
// stress test for big eBPF maps |
| 2 |
|
| 3 |
probe begin { |
| 4 |
println("BEGIN") |
| 5 |
} |
| 6 |
|
| 7 |
global bigmap_int |
| 8 |
//global bigmap_str |
| 9 |
global counter = 0 |
| 10 |
|
| 11 |
probe kernel.function("vfs_read") { |
| 12 |
if (counter >= 256) exit() |
| 13 |
//if (counter >= 2048) exit() |
| 14 |
//if (counter >= 4096) exit() // XXX: will silently fail to add entries |
| 15 |
// TODO: would like an unrolled loop adding entries in chunks |
| 16 |
key1 = counter |
| 17 |
//key2 = sprintf("%d", counter) // TODO: sprintf() in kernel-space not supported |
| 18 |
bigmap_int[key1] = 1 |
| 19 |
//bigmap_str[key2] = 1 |
| 20 |
counter++ |
| 21 |
// these cause a timeout: |
| 22 |
//if (counter % 64 == 0) printf("reached %d\n", counter) |
| 23 |
//if (counter % 256 == 0) printf("reached %d\n", counter) |
| 24 |
} |
| 25 |
|
| 26 |
probe timer.s(30) { |
| 27 |
printf("XXX finishing early!\n") |
| 28 |
// TODO: later, make this scenario a fail |
| 29 |
exit() |
| 30 |
} |
| 31 |
|
| 32 |
probe end { |
| 33 |
total1 = 0 |
| 34 |
//total2 = 0 |
| 35 |
foreach (key1 in bigmap_int) total1 += bigmap_int[key1] |
| 36 |
//foreach (key2 in bigmap_str) total2 += bigmap_str[key2] |
| 37 |
//printf("%d %d\n", total1, total2) |
| 38 |
printf("added %d entries\n", total1) |
| 39 |
println("END PASS") |
| 40 |
} |