tools/perf/util/data-convert-bt.c
Source file repositories/reference/linux-study-clean/tools/perf/util/data-convert-bt.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/data-convert-bt.c- Extension
.c- Size
- 45087 bytes
- Lines
- 1834
- 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.hlinux/compiler.hlinux/kernel.hlinux/zalloc.hbabeltrace/ctf-writer/writer.hbabeltrace/ctf-writer/clock.hbabeltrace/ctf-writer/stream.hbabeltrace/ctf-writer/event.hbabeltrace/ctf-writer/event-types.hbabeltrace/ctf-writer/event-fields.hbabeltrace/ctf-ir/utils.hbabeltrace/ctf/events.hasm/bug.hdata-convert.hsession.hdebug.htool.hevlist.hevsel.hmachine.hconfig.hlinux/ctype.hlinux/err.hlinux/time64.hutil.hclockid.hutil/sample.hutil/time-utils.hheader.hevent-parse.h
Detected Declarations
struct evsel_privstruct ctf_streamstruct ctf_writerstruct convertenum setup_events_typefunction value_setfunction value_set_stringfunction get_tracepoint_field_typefunction adjust_signednessfunction string_set_valuefunction add_tracepoint_field_valuefunction add_tracepoint_fields_valuesfunction add_tracepoint_valuesfunction add_bpf_output_valuesfunction add_callchain_output_valuesfunction add_generic_valuesfunction ctf_stream__flushfunction ctf_stream__deletefunction get_sample_cpufunction is_flush_neededfunction process_sample_eventfunction event_class_add_fieldfunction add_tracepoint_fields_typesfunction add_tracepoint_typesfunction add_bpf_output_typesfunction add_generic_typesfunction add_eventfunction setup_eventsfunction evlist__for_each_entryfunction setup_non_sample_eventsfunction cleanup_eventsfunction evlist__for_each_entryfunction setup_streamsfunction free_streamsfunction ctf_writer__setup_envfunction process_feature_eventfunction process_tracing_datafunction ctf_writer__setup_clockfunction ctf_writer__cleanup_datafunction ctf_writer__init_datafunction ctf_writer__cleanupfunction ctf_writer__initfunction ctf_writer__flush_streamsfunction convert__configfunction bt_convert__perf2ctf
Annotated Snippet
struct evsel_priv {
struct bt_ctf_event_class *event_class;
};
#define MAX_CPUS 4096
struct ctf_stream {
struct bt_ctf_stream *stream;
int cpu;
u32 count;
};
struct ctf_writer {
/* writer primitives */
struct bt_ctf_writer *writer;
struct ctf_stream **stream;
int stream_cnt;
struct bt_ctf_stream_class *stream_class;
struct bt_ctf_clock *clock;
/* data types */
union {
struct {
struct bt_ctf_field_type *s64;
struct bt_ctf_field_type *u64;
struct bt_ctf_field_type *s32;
struct bt_ctf_field_type *u32;
struct bt_ctf_field_type *string;
struct bt_ctf_field_type *u32_hex;
struct bt_ctf_field_type *u64_hex;
};
struct bt_ctf_field_type *array[6];
} data;
struct bt_ctf_event_class *comm_class;
struct bt_ctf_event_class *exit_class;
struct bt_ctf_event_class *fork_class;
struct bt_ctf_event_class *mmap_class;
struct bt_ctf_event_class *mmap2_class;
};
struct convert {
struct perf_tool tool;
struct ctf_writer writer;
struct perf_time_interval *ptime_range;
int range_size;
int range_num;
u64 events_size;
u64 events_count;
u64 non_sample_count;
u64 skipped;
/* Ordered events configured queue size. */
u64 queue_size;
};
static int value_set(struct bt_ctf_field_type *type,
struct bt_ctf_event *event,
const char *name, u64 val)
{
struct bt_ctf_field *field;
bool sign = bt_ctf_field_type_integer_get_signed(type);
int ret;
field = bt_ctf_field_create(type);
if (!field) {
pr_err("failed to create a field %s\n", name);
return -1;
}
if (sign) {
ret = bt_ctf_field_signed_integer_set_value(field, val);
if (ret) {
pr_err("failed to set field value %s\n", name);
goto err;
}
} else {
ret = bt_ctf_field_unsigned_integer_set_value(field, val);
if (ret) {
pr_err("failed to set field value %s\n", name);
goto err;
}
}
ret = bt_ctf_event_set_payload(event, name, field);
if (ret) {
pr_err("failed to set payload %s\n", name);
goto err;
}
Annotation
- Immediate include surface: `errno.h`, `inttypes.h`, `linux/compiler.h`, `linux/kernel.h`, `linux/zalloc.h`, `babeltrace/ctf-writer/writer.h`, `babeltrace/ctf-writer/clock.h`, `babeltrace/ctf-writer/stream.h`.
- Detected declarations: `struct evsel_priv`, `struct ctf_stream`, `struct ctf_writer`, `struct convert`, `enum setup_events_type`, `function value_set`, `function value_set_string`, `function get_tracepoint_field_type`, `function adjust_signedness`, `function string_set_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.