tools/perf/util/db-export.c
Source file repositories/reference/linux-study-clean/tools/perf/util/db-export.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/db-export.c- Extension
.c- Size
- 15119 bytes
- Lines
- 619
- 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.hstdlib.hdso.hevsel.hmachine.hthread.hcomm.hsymbol.hmap.hevent.hthread-stack.hcallchain.hcall-path.hdb-export.h
Detected Declarations
function Copyrightfunction db_export__exitfunction db_export__evselfunction db_export__machinefunction db_export__threadfunction __db_export__commfunction db_export__commfunction db_export__exec_commfunction db_export__comm_threadfunction db_export__dsofunction db_export__symbolfunction db_ids_from_alfunction db_export__branch_typefunction db_export__threadsfunction db_export__samplefunction db_export__branch_typesfunction db_export__call_pathfunction db_export__call_returnfunction db_export__pid_tidfunction db_export__switch
Annotated Snippet
pid_t pid = event->context_switch.next_prev_pid;
pid_t tid = event->context_switch.next_prev_tid;
err = db_export__pid_tid(dbe, machine, pid, tid, &th_b_id,
&comm_b, &is_idle_b);
if (err)
return err;
}
/*
* Do not export if both threads are unknown (i.e. not being traced),
* or one is unknown and the other is the idle task.
*/
if ((!th_a_id || is_idle_a) && (!th_b_id || is_idle_b))
return 0;
db_id = ++dbe->context_switch_last_db_id;
if (out) {
th_out_id = th_a_id;
th_in_id = th_b_id;
comm_out_id = comm_a ? comm_a->db_id : 0;
comm_in_id = comm_b ? comm_b->db_id : 0;
} else {
th_out_id = th_b_id;
th_in_id = th_a_id;
comm_out_id = comm_b ? comm_b->db_id : 0;
comm_in_id = comm_a ? comm_a->db_id : 0;
}
if (dbe->export_context_switch)
return dbe->export_context_switch(dbe, db_id, machine, sample,
th_out_id, comm_out_id,
th_in_id, comm_in_id, flags);
return 0;
}
Annotation
- Immediate include surface: `errno.h`, `stdlib.h`, `dso.h`, `evsel.h`, `machine.h`, `thread.h`, `comm.h`, `symbol.h`.
- Detected declarations: `function Copyright`, `function db_export__exit`, `function db_export__evsel`, `function db_export__machine`, `function db_export__thread`, `function __db_export__comm`, `function db_export__comm`, `function db_export__exec_comm`, `function db_export__comm_thread`, `function db_export__dso`.
- 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.