tools/tracing/rtla/src/timerlat_hist.c
Source file repositories/reference/linux-study-clean/tools/tracing/rtla/src/timerlat_hist.c
File Facts
- System
- Linux kernel
- Corpus path
tools/tracing/rtla/src/timerlat_hist.c- Extension
.c- Size
- 19464 bytes
- Lines
- 790
- 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.hsignal.hunistd.hstdio.htime.hsched.hpthread.htimerlat.htimerlat_aa.htimerlat_bpf.hcli.hcommon.h
Detected Declarations
struct timerlat_hist_cpustruct timerlat_hist_datafunction timerlat_free_histogramfunction timerlat_free_histogram_toolfunction timerlat_hist_updatefunction timerlat_hist_handlerfunction timerlat_hist_bpf_pull_datafunction timerlat_hist_headerfunction for_each_monitored_cpufunction format_summary_valuefunction timerlat_print_summaryfunction for_each_monitored_cpufunction for_each_monitored_cpufunction for_each_monitored_cpufunction for_each_monitored_cpufunction timerlat_print_stats_allfunction for_each_monitored_cpufunction timerlat_print_statsfunction for_each_monitored_cpufunction for_each_monitored_cpufunction timerlat_hist_apply_configfunction timerlat_hist_bpf_main_loopfunction timerlat_hist_main
Annotated Snippet
struct timerlat_hist_cpu {
int *irq;
int *thread;
int *user;
unsigned long long irq_count;
unsigned long long thread_count;
unsigned long long user_count;
unsigned long long min_irq;
unsigned long long sum_irq;
unsigned long long max_irq;
unsigned long long min_thread;
unsigned long long sum_thread;
unsigned long long max_thread;
unsigned long long min_user;
unsigned long long sum_user;
unsigned long long max_user;
};
struct timerlat_hist_data {
struct timerlat_hist_cpu *hist;
int entries;
int bucket_size;
};
/*
* timerlat_free_histogram - free runtime data
*/
static void
timerlat_free_histogram(struct timerlat_hist_data *data)
{
int cpu;
/* one histogram for IRQ and one for thread, per CPU */
for (cpu = 0; cpu < nr_cpus; cpu++) {
if (data->hist[cpu].irq)
free(data->hist[cpu].irq);
if (data->hist[cpu].thread)
free(data->hist[cpu].thread);
if (data->hist[cpu].user)
free(data->hist[cpu].user);
}
/* one set of histograms per CPU */
if (data->hist)
free(data->hist);
}
static void timerlat_free_histogram_tool(struct osnoise_tool *tool)
{
timerlat_free_histogram(tool->data);
timerlat_free(tool);
}
/*
* timerlat_alloc_histogram - alloc runtime data
*/
static struct timerlat_hist_data
*timerlat_alloc_histogram(int entries, int bucket_size)
{
struct timerlat_hist_data *data;
int cpu;
data = calloc(1, sizeof(*data));
if (!data)
return NULL;
data->entries = entries;
data->bucket_size = bucket_size;
/* one set of histograms per CPU */
data->hist = calloc(1, sizeof(*data->hist) * nr_cpus);
if (!data->hist)
goto cleanup;
/* one histogram for IRQ and one for thread, per cpu */
for (cpu = 0; cpu < nr_cpus; cpu++) {
data->hist[cpu].irq = calloc(1, sizeof(*data->hist->irq) * (entries + 1));
if (!data->hist[cpu].irq)
goto cleanup;
data->hist[cpu].thread = calloc(1, sizeof(*data->hist->thread) * (entries + 1));
if (!data->hist[cpu].thread)
goto cleanup;
Annotation
- Immediate include surface: `stdlib.h`, `string.h`, `signal.h`, `unistd.h`, `stdio.h`, `time.h`, `sched.h`, `pthread.h`.
- Detected declarations: `struct timerlat_hist_cpu`, `struct timerlat_hist_data`, `function timerlat_free_histogram`, `function timerlat_free_histogram_tool`, `function timerlat_hist_update`, `function timerlat_hist_handler`, `function timerlat_hist_bpf_pull_data`, `function timerlat_hist_header`, `function for_each_monitored_cpu`, `function format_summary_value`.
- 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.