tools/perf/builtin-timechart.c
Source file repositories/reference/linux-study-clean/tools/perf/builtin-timechart.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/builtin-timechart.c- Extension
.c- Size
- 48704 bytes
- Lines
- 2046
- 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
errno.hinttypes.hbuiltin.hutil/color.hlinux/list.hutil/evlist.hutil/evsel.hlinux/kernel.hlinux/rbtree.hlinux/time64.hlinux/zalloc.hutil/symbol.hutil/thread.hutil/callchain.hutil/header.hsubcmd/pager.hsubcmd/parse-options.hutil/parse-events.hutil/event.hutil/session.hutil/svghelper.hutil/tool.hutil/data.hutil/debug.hutil/string2.hutil/tracepoint.hutil/util.hlinux/err.hevent-parse.h
Detected Declarations
struct per_pidstruct power_eventstruct wake_eventstruct timechartstruct per_pidcommstruct cpu_samplestruct io_samplestruct per_pidstruct per_pidcommstruct sample_wrapperstruct cpu_samplestruct io_samplestruct power_eventstruct wake_eventstruct process_filterfunction pid_set_commfunction pid_forkfunction pid_exitfunction pid_put_samplefunction process_comm_eventfunction process_fork_eventfunction process_exit_eventfunction c_state_startfunction c_state_endfunction p_state_changefunction sched_wakeupfunction sched_switchfunction process_sample_eventfunction process_sample_cpu_idlefunction process_sample_cpu_frequencyfunction process_sample_sched_wakeupfunction process_sample_sched_switchfunction process_sample_power_startfunction process_sample_power_endfunction process_sample_power_frequencyfunction end_sample_processingfunction pid_begin_io_samplefunction pid_end_io_samplefunction process_enter_readfunction process_exit_readfunction process_enter_writefunction process_exit_writefunction process_enter_syncfunction process_exit_syncfunction process_enter_txfunction process_exit_txfunction process_enter_rxfunction process_exit_rx
Annotated Snippet
struct timechart {
struct perf_tool tool;
struct per_pid *all_data;
struct power_event *power_events;
struct wake_event *wake_events;
int proc_num;
unsigned int numcpus;
u64 min_freq, /* Lowest CPU frequency seen */
max_freq, /* Highest CPU frequency seen */
turbo_frequency,
first_time, last_time;
bool power_only,
tasks_only,
with_backtrace,
topology;
bool force;
/* IO related settings */
bool io_only,
skip_eagain;
u64 io_events;
u64 min_time,
merge_dist;
};
struct per_pidcomm;
struct cpu_sample;
struct io_sample;
/*
* Datastructure layout:
* We keep an list of "pid"s, matching the kernels notion of a task struct.
* Each "pid" entry, has a list of "comm"s.
* this is because we want to track different programs different, while
* exec will reuse the original pid (by design).
* Each comm has a list of samples that will be used to draw
* final graph.
*/
struct per_pid {
struct per_pid *next;
int pid;
int ppid;
u64 start_time;
u64 end_time;
u64 total_time;
u64 total_bytes;
int display;
struct per_pidcomm *all;
struct per_pidcomm *current;
};
struct per_pidcomm {
struct per_pidcomm *next;
u64 start_time;
u64 end_time;
u64 total_time;
u64 max_bytes;
u64 total_bytes;
int Y;
int display;
long state;
u64 state_since;
char *comm;
struct cpu_sample *samples;
struct io_sample *io_samples;
};
struct sample_wrapper {
struct sample_wrapper *next;
u64 timestamp;
unsigned char data[];
};
#define TYPE_NONE 0
#define TYPE_RUNNING 1
#define TYPE_WAITING 2
#define TYPE_BLOCKED 3
struct cpu_sample {
struct cpu_sample *next;
Annotation
- Immediate include surface: `errno.h`, `inttypes.h`, `builtin.h`, `util/color.h`, `linux/list.h`, `util/evlist.h`, `util/evsel.h`, `linux/kernel.h`.
- Detected declarations: `struct per_pid`, `struct power_event`, `struct wake_event`, `struct timechart`, `struct per_pidcomm`, `struct cpu_sample`, `struct io_sample`, `struct per_pid`, `struct per_pidcomm`, `struct sample_wrapper`.
- 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.