tools/testing/selftests/resctrl/resctrl.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/resctrl/resctrl.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/resctrl/resctrl.h- Extension
.h- Size
- 8841 bytes
- Lines
- 247
- 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
stdio.hmath.herrno.hsched.hstdlib.hunistd.hstring.hsignal.hdirent.hstdbool.hctype.hsys/stat.hsys/ioctl.hsys/mount.hsys/types.hsys/wait.hsys/select.hsys/time.hsys/eventfd.hasm/unistd.hlinux/perf_event.hlinux/compiler.hlinux/bits.hkselftest.h
Detected Declarations
struct fill_buf_paramstruct user_paramsstruct resctrl_teststruct resctrl_val_paramfunction cache_portion_size
Annotated Snippet
struct fill_buf_param {
size_t buf_size;
bool memflush;
};
/*
* user_params: User supplied parameters
* @cpu: CPU number to which the benchmark will be bound to
* @bits: Number of bits used for cache allocation size
* @benchmark_cmd: Benchmark command to run during (some of the) tests
* @fill_buf: Pointer to user provided parameters for "fill_buf",
* NULL if user did not provide parameters and test
* specific defaults should be used.
*/
struct user_params {
int cpu;
int bits;
const char *benchmark_cmd[BENCHMARK_ARGS];
const struct fill_buf_param *fill_buf;
};
/*
* resctrl_test: resctrl test definition
* @name: Test name
* @group: Test group - a common name for tests that share some characteristic
* (e.g., L3 CAT test belongs to the CAT group). Can be NULL
* @resource: Resource to test (e.g., MB, L3, L2, etc.)
* @vendor_specific: Bitmask for vendor-specific tests (can be 0 for universal tests)
* @disabled: Test is disabled
* @feature_check: Callback to check required resctrl features
* @run_test: Callback to run the test
* @cleanup: Callback to cleanup after the test
*/
struct resctrl_test {
const char *name;
const char *group;
const char *resource;
unsigned int vendor_specific;
bool disabled;
bool (*feature_check)(const struct resctrl_test *test);
int (*run_test)(const struct resctrl_test *test,
const struct user_params *uparams);
void (*cleanup)(void);
};
/*
* resctrl_val_param: resctrl test parameters
* @ctrlgrp: Name of the control monitor group (con_mon grp)
* @mongrp: Name of the monitor group (mon grp)
* @filename: Name of file to which the o/p should be written
* @init: Callback function to initialize test environment
* @setup: Callback function to setup per test run environment
* @measure: Callback that performs the measurement (a single test)
* @fill_buf: Parameters for default "fill_buf" benchmark.
* Initialized with user provided parameters, possibly
* adapted to be relevant to the test. If user does
* not provide parameters for "fill_buf" nor a
* replacement benchmark then initialized with defaults
* appropriate for test. NULL if user provided
* benchmark.
*/
struct resctrl_val_param {
const char *ctrlgrp;
const char *mongrp;
char filename[64];
unsigned long mask;
int num_of_runs;
int (*init)(const struct resctrl_test *test,
const struct user_params *uparams,
const struct resctrl_val_param *param,
int domain_id);
int (*setup)(const struct resctrl_test *test,
const struct user_params *uparams,
struct resctrl_val_param *param);
int (*measure)(const struct user_params *uparams,
struct resctrl_val_param *param,
pid_t bm_pid);
struct fill_buf_param *fill_buf;
};
/*
* Memory location that consumes values compiler must not optimize away.
* Volatile ensures writes to this location cannot be optimized away by
* compiler.
*/
extern volatile int *value_sink;
extern int snc_unreliable;
extern char llc_occup_path[1024];
Annotation
- Immediate include surface: `stdio.h`, `math.h`, `errno.h`, `sched.h`, `stdlib.h`, `unistd.h`, `string.h`, `signal.h`.
- Detected declarations: `struct fill_buf_param`, `struct user_params`, `struct resctrl_test`, `struct resctrl_val_param`, `function cache_portion_size`.
- 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.