tools/tracing/rtla/src/cli.c
Source file repositories/reference/linux-study-clean/tools/tracing/rtla/src/cli.c
File Facts
- System
- Linux kernel
- Corpus path
tools/tracing/rtla/src/cli.c- Extension
.c- Size
- 13300 bytes
- Lines
- 540
- 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
stdlib.hstring.hstdio.hunistd.hsys/types.hlinux/compiler.hcli_p.h
Detected Declarations
function rtla_usagefunction exitfunction main
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2021 Red Hat Inc, Daniel Bristot de Oliveira <bristot@kernel.org>
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <linux/compiler.h>
#define RTLA_ALLOW_CLI_P_H
#include "cli_p.h"
static const char * const osnoise_top_usage[] = {
"rtla osnoise [top] [<options>] [-h|--help]",
NULL,
};
static const char * const osnoise_hist_usage[] = {
"rtla osnoise hist [<options>] [-h|--help]",
NULL,
};
static const char * const timerlat_top_usage[] = {
"rtla timerlat [top] [<options>] [-h|--help]",
NULL,
};
static const char * const timerlat_hist_usage[] = {
"rtla timerlat hist [<options>] [-h|--help]",
NULL,
};
static const char * const hwnoise_usage[] = {
"rtla hwnoise [<options>] [-h|--help]",
NULL,
};
static const int common_parse_options_flags = PARSE_OPT_OPTARG_ALLOW_NEXT;
bool in_unit_test;
/*
* osnoise_top_parse_args - allocs, parse and fill the cmd line parameters
*/
struct common_params *osnoise_top_parse_args(int argc, char **argv)
{
struct osnoise_params *params;
struct osnoise_cb_data cb_data;
const char * const *usage;
params = calloc_fatal(1, sizeof(*params));
cb_data.params = params;
cb_data.trace_output = NULL;
if (strcmp(argv[0], "hwnoise") == 0) {
params->mode = MODE_HWNOISE;
/*
* Reduce CPU usage for 75% to avoid killing the system.
*/
params->runtime = 750000;
params->period = 1000000;
usage = hwnoise_usage;
} else {
usage = osnoise_top_usage;
}
const struct option osnoise_top_options[] = {
OPT_GROUP("Tracing Options:"),
OSNOISE_OPT_PERIOD,
OSNOISE_OPT_RUNTIME,
RTLA_OPT_STOP('s', "stop", "single sample"),
RTLA_OPT_STOP_TOTAL('S', "stop-total", "total sample"),
OSNOISE_OPT_THRESHOLD,
RTLA_OPT_TRACE_OUTPUT("osnoise", opt_osnoise_trace_output_cb),
OPT_GROUP("Event Configuration:"),
RTLA_OPT_EVENT,
RTLA_OPT_FILTER,
RTLA_OPT_TRIGGER,
OPT_GROUP("CPU Configuration:"),
RTLA_OPT_CPUS,
RTLA_OPT_HOUSEKEEPING,
Annotation
- Immediate include surface: `stdlib.h`, `string.h`, `stdio.h`, `unistd.h`, `sys/types.h`, `linux/compiler.h`, `cli_p.h`.
- Detected declarations: `function rtla_usage`, `function exit`, `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.