if (min_latency > 0) { if (val > min_latency)
val -= min_latency; else goto do_lookup;
}
// Less than 1 unit (ms or ns), or, in the future, // than the min latency desired. if (val > 0) { // 1st entry: [ 1 unit .. bucket_range units )
key = val / bucket_range + 1; if (key >= bucket_num)
key = bucket_num - 1;
}
goto do_lookup;
} // calculate index using delta for (key = 0; key < (bucket_num - 1); key++) { if (delta < (cmp_base << key)) break;
}
do_lookup:
hist = bpf_map_lookup_elem(&latency, &key); if (!hist) return;
__sync_fetch_and_add(hist, 1);
__sync_fetch_and_add(&total, delta); // always in nsec
__sync_fetch_and_add(&count, 1);
if (delta > max)
max = delta; if (delta < min)
min = delta;
}
SEC("kprobe/func") int BPF_PROG(func_begin)
{
__u64 key, now;
if (!enabled || !can_record()) return 0;
key = bpf_get_current_pid_tgid();
now = bpf_ktime_get_ns();
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.