tools/testing/selftests/seccomp/seccomp_benchmark.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/seccomp/seccomp_benchmark.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/seccomp/seccomp_benchmark.c- Extension
.c- Size
- 8510 bytes
- Lines
- 307
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
assert.herr.hlimits.hsched.hstdbool.hstddef.hstdio.hstdlib.htime.hunistd.hlinux/filter.hlinux/seccomp.hsys/param.hsys/prctl.hsys/syscall.hsys/types.hkselftest.h
Detected Declarations
function timingfunction calibratefunction approxfunction lefunction comparefunction affinityfunction main
Annotated Snippet
if (var > INT_MAX) { \
skip = true; \
ret |= 1; \
} \
} while (0)
ESTIMATE("total seccomp overhead for 1 bitmapped filter", calc,
bitmap1 - native);
ESTIMATE("total seccomp overhead for 2 bitmapped filters", calc,
bitmap2 - native);
ESTIMATE("total seccomp overhead for 3 full filters", calc,
filter1 - native);
ESTIMATE("total seccomp overhead for 4 full filters", calc,
filter2 - native);
ESTIMATE("seccomp entry overhead", entry,
bitmap1 - native - (bitmap2 - bitmap1));
ESTIMATE("seccomp per-filter overhead (last 2 diff)", per_filter1,
filter2 - filter1);
ESTIMATE("seccomp per-filter overhead (filters / 4)", per_filter2,
(filter2 - native - entry) / 4);
ksft_print_msg("Expectations:\n");
ret |= compare("native", "≤", "1 bitmap", native, le, bitmap1,
skip);
bits = compare("native", "≤", "1 filter", native, le, filter1,
skip);
if (bits)
skip = true;
ret |= compare("per-filter (last 2 diff)", "≈", "per-filter (filters / 4)",
per_filter1, approx, per_filter2, skip);
bits = compare("1 bitmapped", "≈", "2 bitmapped",
bitmap1 - native, approx, bitmap2 - native, skip);
if (bits) {
ksft_print_msg("Skipping constant action bitmap expectations: they appear unsupported.\n");
skip = true;
}
ret |= compare("entry", "≈", "1 bitmapped", entry, approx,
bitmap1 - native, skip);
ret |= compare("entry", "≈", "2 bitmapped", entry, approx,
bitmap2 - native, skip);
ret |= compare("native + entry + (per filter * 4)", "≈", "4 filters total",
entry + (per_filter1 * 4) + native, approx, filter2,
skip);
if (ret)
ksft_print_msg("Saw unexpected benchmark result. Try running again with more samples?\n");
ksft_finished();
}
Annotation
- Immediate include surface: `assert.h`, `err.h`, `limits.h`, `sched.h`, `stdbool.h`, `stddef.h`, `stdio.h`, `stdlib.h`.
- Detected declarations: `function timing`, `function calibrate`, `function approx`, `function le`, `function compare`, `function affinity`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.