staticint timer_cb1(void *map, int *key, struct hmap_elem *val);
staticint timer_cb2(void *map, int *key, struct hmap_elem *val)
{
cnt++;
bpf_timer_set_callback(&val->timer, timer_cb1); if (bpf_timer_start(&val->timer, 1000, 0))
err |= 1;
ok |= 1; return 0;
}
/* callback for inner hash map */ staticint timer_cb1(void *map, int *key, struct hmap_elem *val)
{
cnt++;
bpf_timer_set_callback(&val->timer, timer_cb2); if (bpf_timer_start(&val->timer, 1000, 0))
err |= 2; /* Do a lookup to make sure 'map' and 'key' pointers are correct */
bpf_map_lookup_elem(map, key);
ok |= 2; return 0;
}
SEC("fentry/bpf_fentry_test1") int BPF_PROG(test1, int a)
{ struct hmap_elem init = {}; struct bpf_map *inner_map; struct hmap_elem *val; int array_key = ARRAY_KEY; int hash_key = HASH_KEY;
inner_map = bpf_map_lookup_elem(&outer_arr, &array_key); if (!inner_map) return 0;
bpf_map_update_elem(inner_map, &hash_key, &init, 0);
val = bpf_map_lookup_elem(inner_map, &hash_key); if (!val) return 0;
bpf_timer_init(&val->timer, inner_map, CLOCK_MONOTONIC); if (bpf_timer_set_callback(&val->timer, timer_cb1))
err |= 4; if (bpf_timer_start(&val->timer, 0, 0))
err |= 8; return 0;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.