tools/tracing/rtla/src/timerlat_top.c
Source file repositories/reference/linux-study-clean/tools/tracing/rtla/src/timerlat_top.c
File Facts
- System
- Linux kernel
- Corpus path
tools/tracing/rtla/src/timerlat_top.c- Extension
.c- Size
- 15358 bytes
- Lines
- 593
- 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_top_cpustruct timerlat_top_datafunction timerlat_free_topfunction timerlat_free_top_toolfunction timerlat_top_reset_sumfunction timerlat_top_update_sumfunction timerlat_top_updatefunction timerlat_top_handlerfunction timerlat_top_bpf_pull_datafunction timerlat_top_headerfunction timerlat_top_printfunction timerlat_top_print_sumfunction clear_terminalfunction timerlat_print_statsfunction for_each_monitored_cpufunction timerlat_top_apply_configfunction timerlat_top_bpf_main_loopfunction timerlat_top_main_loop
Annotated Snippet
struct timerlat_top_cpu {
unsigned long long irq_count;
unsigned long long thread_count;
unsigned long long user_count;
unsigned long long cur_irq;
unsigned long long min_irq;
unsigned long long sum_irq;
unsigned long long max_irq;
unsigned long long cur_thread;
unsigned long long min_thread;
unsigned long long sum_thread;
unsigned long long max_thread;
unsigned long long cur_user;
unsigned long long min_user;
unsigned long long sum_user;
unsigned long long max_user;
};
struct timerlat_top_data {
struct timerlat_top_cpu *cpu_data;
};
/*
* timerlat_free_top - free runtime data
*/
static void timerlat_free_top(struct timerlat_top_data *data)
{
free(data->cpu_data);
free(data);
}
static void timerlat_free_top_tool(struct osnoise_tool *tool)
{
timerlat_free_top(tool->data);
timerlat_free(tool);
}
/*
* timerlat_alloc_histogram - alloc runtime data
*/
static struct timerlat_top_data *timerlat_alloc_top(void)
{
struct timerlat_top_data *data;
int cpu;
data = calloc(1, sizeof(*data));
if (!data)
return NULL;
/* one set of histograms per CPU */
data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus);
if (!data->cpu_data)
goto cleanup;
/* set the min to max */
for (cpu = 0; cpu < nr_cpus; cpu++) {
data->cpu_data[cpu].min_irq = ~0;
data->cpu_data[cpu].min_thread = ~0;
data->cpu_data[cpu].min_user = ~0;
}
return data;
cleanup:
timerlat_free_top(data);
return NULL;
}
static void
timerlat_top_reset_sum(struct timerlat_top_cpu *summary)
{
memset(summary, 0, sizeof(*summary));
summary->min_irq = ~0;
summary->min_thread = ~0;
summary->min_user = ~0;
}
static void
timerlat_top_update_sum(struct osnoise_tool *tool, int cpu, struct timerlat_top_cpu *sum)
{
struct timerlat_top_data *data = tool->data;
struct timerlat_top_cpu *cpu_data = &data->cpu_data[cpu];
sum->irq_count += cpu_data->irq_count;
update_min(&sum->min_irq, &cpu_data->min_irq);
update_sum(&sum->sum_irq, &cpu_data->sum_irq);
update_max(&sum->max_irq, &cpu_data->max_irq);
Annotation
- Immediate include surface: `stdlib.h`, `string.h`, `signal.h`, `unistd.h`, `stdio.h`, `time.h`, `sched.h`, `pthread.h`.
- Detected declarations: `struct timerlat_top_cpu`, `struct timerlat_top_data`, `function timerlat_free_top`, `function timerlat_free_top_tool`, `function timerlat_top_reset_sum`, `function timerlat_top_update_sum`, `function timerlat_top_update`, `function timerlat_top_handler`, `function timerlat_top_bpf_pull_data`, `function timerlat_top_header`.
- 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.