samples/bpf/lwt_len_hist_user.c
Source file repositories/reference/linux-study-clean/samples/bpf/lwt_len_hist_user.c
File Facts
- System
- Linux kernel
- Corpus path
samples/bpf/lwt_len_hist_user.c- Extension
.c- Size
- 1653 bytes
- Lines
- 78
- Domain
- Support Tooling And Documentation
- Bucket
- samples
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
linux/unistd.hlinux/bpf.hstdlib.hstdio.hunistd.hstring.herrno.harpa/inet.hbpf/bpf.hbpf_util.h
Detected Declarations
function starsfunction main
Annotated Snippet
if (next_key >= MAX_INDEX) {
fprintf(stderr, "Key %lu out of bounds\n", next_key);
continue;
}
bpf_map_lookup_elem(map_fd, &next_key, values);
sum = 0;
for (i = 0; i < nr_cpus; i++)
sum += values[i];
data[next_key] = sum;
if (sum && next_key > max_key)
max_key = next_key;
if (sum > max_value)
max_value = sum;
key = next_key;
}
for (i = 1; i <= max_key + 1; i++) {
stars(starstr, data[i - 1], max_value, MAX_STARS);
printf("%8ld -> %-8ld : %-8ld |%-*s|\n",
(1l << i) >> 1, (1l << i) - 1, data[i - 1],
MAX_STARS, starstr);
}
close(map_fd);
return 0;
}
Annotation
- Immediate include surface: `linux/unistd.h`, `linux/bpf.h`, `stdlib.h`, `stdio.h`, `unistd.h`, `string.h`, `errno.h`, `arpa/inet.h`.
- Detected declarations: `function stars`, `function main`.
- Atlas domain: Support Tooling And Documentation / samples.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.