Lines Matching full:record

3  * builtin-record.c
5 * Builtin record command: Record the profile of a workload
30 #include "util/record.h"
113 struct record *rec;
152 struct record { struct
214 static int record__threads_enabled(struct record *rec) in record__threads_enabled()
219 static bool switch_output_signal(struct record *rec) in switch_output_signal()
225 static bool switch_output_size(struct record *rec) in switch_output_size()
232 static bool switch_output_time(struct record *rec) in switch_output_time()
238 static u64 record__bytes_written(struct record *rec) in record__bytes_written()
243 static bool record__output_max_size_exceeded(struct record *rec) in record__output_max_size_exceeded()
249 static int record__write(struct record *rec, struct mmap *map __maybe_unused, in record__write()
270 fprintf(stderr, "[ perf record: perf size limit reached (%" PRIu64 " KB)," in record__write()
282 static int record__aio_enabled(struct record *rec);
283 static int record__comp_enabled(struct record *rec);
395 struct record *rec;
449 static int record__aio_push(struct record *rec, struct mmap *map, off_t *off) in record__aio_push()
496 static void record__aio_mmap_read_sync(struct record *rec) in record__aio_mmap_read_sync()
536 static int record__aio_push(struct record *rec __maybe_unused, struct mmap *map __maybe_unused, in record__aio_push()
551 static void record__aio_mmap_read_sync(struct record *rec __maybe_unused) in record__aio_mmap_read_sync()
556 static int record__aio_enabled(struct record *rec) in record__aio_enabled()
617 static int record__comp_enabled(struct record *rec) in record__comp_enabled()
627 struct record *rec = container_of(tool, struct record, tool); in process_synthesized_event()
648 struct record *rec = to; in record__pushfn()
723 struct record *rec = container_of(tool, struct record, tool); in record__process_auxtrace()
756 static int record__auxtrace_mmap_read(struct record *rec, in record__auxtrace_mmap_read()
772 static int record__auxtrace_mmap_read_snapshot(struct record *rec, in record__auxtrace_mmap_read_snapshot()
789 static int record__auxtrace_read_snapshot_all(struct record *rec) in record__auxtrace_read_snapshot_all()
809 static void record__read_auxtrace_snapshot(struct record *rec, bool on_exit) in record__read_auxtrace_snapshot()
822 static int record__auxtrace_snapshot_exit(struct record *rec) in record__auxtrace_snapshot_exit()
838 static int record__auxtrace_init(struct record *rec) in record__auxtrace_init()
874 int record__auxtrace_mmap_read(struct record *rec __maybe_unused, in record__auxtrace_mmap_read()
881 void record__read_auxtrace_snapshot(struct record *rec __maybe_unused, in record__read_auxtrace_snapshot()
893 int record__auxtrace_snapshot_exit(struct record *rec __maybe_unused) in record__auxtrace_snapshot_exit()
898 static int record__auxtrace_init(struct record *rec __maybe_unused) in record__auxtrace_init()
927 static int record__config_off_cpu(struct record *rec) in record__config_off_cpu()
932 static bool record__tracking_system_wide(struct record *rec) in record__tracking_system_wide()
951 static int record__config_tracking_events(struct record *rec) in record__config_tracking_events()
1152 static void record__free_thread_data(struct record *rec) in record__free_thread_data()
1170 static int record__map_thread_evlist_pollfd_indexes(struct record *rec, in record__map_thread_evlist_pollfd_indexes()
1184 static int record__update_evlist_pollfd_from_thread(struct record *rec, in record__update_evlist_pollfd_from_thread()
1208 static int record__dup_non_perf_events(struct record *rec, in record__dup_non_perf_events()
1234 static int record__alloc_thread_data(struct record *rec, struct evlist *evlist) in record__alloc_thread_data()
1298 static int record__mmap_evlist(struct record *rec, in record__mmap_evlist()
1357 static int record__mmap(struct record *rec) in record__mmap()
1362 static int record__open(struct record *rec) in record__open()
1423 static void set_timestamp_boundary(struct record *rec, u64 sample_time) in set_timestamp_boundary()
1438 struct record *rec = container_of(tool, struct record, tool); in process_sample_event()
1449 static int process_buildids(struct record *rec) in process_buildids()
1484 *As for guest kernel when processing subcommand record&report, in perf_event__synthesize_guest_os()
1494 pr_err("Couldn't record guest kernel [%d]'s reference" in perf_event__synthesize_guest_os()
1504 pr_err("Couldn't record guest kernel [%d]'s reference" in perf_event__synthesize_guest_os()
1518 static void record__adjust_affinity(struct record *rec, struct mmap *map) in record__adjust_affinity()
1535 static size_t process_comp_header(void *record, size_t increment) in process_comp_header() argument
1537 struct perf_record_compressed *event = record; in process_comp_header()
1577 static int record__mmap_read_evlist(struct record *rec, struct evlist *evlist, in record__mmap_read_evlist()
1661 static int record__mmap_read_all(struct record *rec, bool synch) in record__mmap_read_all()
1743 static void record__init_features(struct record *rec) in record__init_features()
1779 record__finish_output(struct record *rec) in record__finish_output()
1809 static int record__synthesize_workload(struct record *rec, bool tail) in record__synthesize_workload()
1831 static int write_finished_init(struct record *rec, bool tail) in write_finished_init()
1839 static int record__synthesize(struct record *rec, bool tail);
1842 record__switch_output(struct record *rec, bool at_exit) in record__switch_output()
1876 fprintf(stderr, "[ perf record: Dump %s.%s ]\n", in record__switch_output()
1900 * In 'perf record --switch-output' without -a, in record__switch_output()
1915 static void __record__save_lost_samples(struct record *rec, struct evsel *evsel, in __record__save_lost_samples()
1939 static void record__read_lost_samples(struct record *rec) in record__read_lost_samples()
2019 static const struct perf_event_mmap_page *record__pick_pc(struct record *rec) in record__pick_pc()
2027 static int record__synthesize(struct record *rec, bool tail) in record__synthesize()
2071 WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n" in record__synthesize()
2077 WARN_ONCE(err < 0, "Couldn't record kernel module information.\n" in record__synthesize()
2151 struct record *rec = data; in record__process_signal_event()
2156 static int record__setup_sb_evlist(struct record *rec) in record__setup_sb_evlist()
2194 static int record__init_clock(struct record *rec) in record__init_clock()
2231 static void hit_auxtrace_snapshot_trigger(struct record *rec) in hit_auxtrace_snapshot_trigger()
2259 static int record__start_threads(struct record *rec) in record__start_threads()
2322 static int record__stop_threads(struct record *rec) in record__stop_threads()
2348 static unsigned long record__waking(struct record *rec) in record__waking()
2360 static int __cmd_record(struct record *rec, int argc, const char **argv) in __cmd_record()
2491 pr_debug3("perf record opening and mmapping events\n"); in __cmd_record()
2497 pr_debug3("perf record done opening and mmapping events\n"); in __cmd_record()
2634 pr_debug3("perf record has started\n"); in __cmd_record()
2703 fprintf(stderr, "[ perf record: dump data: Woken up %ld times ]\n", in __cmd_record()
2799 fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", in __cmd_record()
2870 fprintf(stderr, "[ perf record: Captured and wrote %.3f MB %s%s%s", in __cmd_record()
2909 int record_opts__parse_callchain(struct record_opts *record, in record_opts__parse_callchain() argument
2927 record->sample_address = true; in record_opts__parse_callchain()
2958 struct record *rec = cb; in perf_record_config()
2960 if (!strcmp(var, "record.build-id")) { in perf_record_config()
2973 if (!strcmp(var, "record.call-graph")) { in perf_record_config()
2974 var = "call-graph.record-mode"; in perf_record_config()
2978 if (!strcmp(var, "record.aio")) { in perf_record_config()
2984 if (!strcmp(var, "record.debuginfod")) { in perf_record_config()
2996 struct record *rec = (struct record *)opt->value; in record__parse_event_enable_time()
3171 static void switch_output_size_warn(struct record *rec) in switch_output_size_warn()
3188 static int switch_output_setup(struct record *rec) in switch_output_setup()
3263 "perf record [<options>] [<command>]",
3264 "perf record [<options>] -- <command> [<options>]",
3299 struct record *rec = container_of(tool, struct record, tool); in process_timestamp_boundary()
3335 static struct record record = { variable
3360 .evlistp = &record.evlist,
3364 .evlistp = &record.sb_evlist,
3370 * from builtin-record.c, i.e. use record_opts,
3371 * evlist__prepare_workload, etc instead of fork+exec'in 'perf record',
3378 OPT_CALLBACK(0, "filter", &record.evlist, "filter",
3380 OPT_BOOLEAN(0, "latency", &record.latency,
3383 OPT_CALLBACK_NOOPT(0, "exclude-perf", &record.evlist,
3384 NULL, "don't record events from perf itself",
3386 OPT_STRING('p', "pid", &record.opts.target.pid, "pid",
3387 "record events on existing process id"),
3388 OPT_STRING('t', "tid", &record.opts.target.tid, "tid",
3389 "record events on existing thread id"),
3390 OPT_INTEGER('r', "realtime", &record.realtime_prio,
3392 OPT_BOOLEAN(0, "no-buffering", &record.opts.no_buffering,
3394 OPT_BOOLEAN('R', "raw-samples", &record.opts.raw_samples,
3396 OPT_BOOLEAN('a', "all-cpus", &record.opts.target.system_wide,
3398 OPT_STRING('C', "cpu", &record.opts.target.cpu_list, "cpu",
3400 OPT_U64('c', "count", &record.opts.user_interval, "event period to sample"),
3401 OPT_STRING('o', "output", &record.data.path, "file",
3403 OPT_BOOLEAN_SET('i', "no-inherit", &record.opts.no_inherit,
3404 &record.opts.no_inherit_set,
3406 OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize,
3408 OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"),
3409 OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "do not record bpf events"),
3410 OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq,
3412 OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'",
3415 OPT_CALLBACK('m', "mmap-pages", &record.opts, "pages[,pages]",
3418 OPT_CALLBACK(0, "mmap-flush", &record.opts, "number",
3424 OPT_CALLBACK(0, "call-graph", &record.opts,
3430 OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat,
3432 OPT_BOOLEAN('d', "data", &record.opts.sample_address, "Record the sample addresses"),
3433 OPT_BOOLEAN(0, "phys-data", &record.opts.sample_phys_addr,
3434 "Record the sample physical addresses"),
3435 OPT_BOOLEAN(0, "data-page-size", &record.opts.sample_data_page_size,
3436 "Record the sampled data address data page size"),
3437 OPT_BOOLEAN(0, "code-page-size", &record.opts.sample_code_page_size,
3438 "Record the sampled code address (ip) page size"),
3439 OPT_BOOLEAN(0, "sample-cpu", &record.opts.sample_cpu, "Record the sample cpu"),
3440 OPT_BOOLEAN(0, "sample-identifier", &record.opts.sample_identifier,
3441 "Record the sample identifier"),
3442 OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
3443 &record.opts.sample_time_set,
3444 "Record the sample timestamps"),
3445 OPT_BOOLEAN_SET('P', "period", &record.opts.period, &record.opts.period_set,
3446 "Record the sample period"),
3447 OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples,
3449 OPT_BOOLEAN_SET('N', "no-buildid-cache", &record.no_buildid_cache,
3450 &record.no_buildid_cache_set,
3452 OPT_BOOLEAN_SET('B', "no-buildid", &record.no_buildid,
3453 &record.no_buildid_set,
3455 OPT_CALLBACK('G', "cgroup", &record.evlist, "name",
3458 OPT_CALLBACK('D', "delay", &record, "ms",
3462 OPT_BOOLEAN(0, "kcore", &record.opts.kcore, "copy /proc/kcore"),
3463 OPT_STRING('u', "uid", &record.opts.target.uid_str, "user",
3466 OPT_CALLBACK_NOOPT('b', "branch-any", &record.opts.branch_stack,
3470 OPT_CALLBACK('j', "branch-filter", &record.opts.branch_stack,
3473 OPT_BOOLEAN('W', "weight", &record.opts.sample_weight,
3475 OPT_BOOLEAN(0, "transaction", &record.opts.sample_transaction,
3477 OPT_BOOLEAN(0, "per-thread", &record.opts.target.per_thread,
3479 OPT_CALLBACK_OPTARG('I', "intr-regs", &record.opts.sample_intr_regs, NULL, "any register",
3482 OPT_CALLBACK_OPTARG(0, "user-regs", &record.opts.sample_user_regs, NULL, "any register",
3485 OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
3486 "Record running/enabled time of read (:S) events"),
3487 OPT_CALLBACK('k', "clockid", &record.opts,
3490 OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts,
3492 OPT_STRING_OPTARG(0, "aux-sample", &record.opts.auxtrace_sample_opts,
3496 OPT_BOOLEAN(0, "namespaces", &record.opts.record_namespaces,
3497 "Record namespaces events"),
3498 OPT_BOOLEAN(0, "all-cgroups", &record.opts.record_cgroup,
3499 "Record cgroup events"),
3500 OPT_BOOLEAN_SET(0, "switch-events", &record.opts.record_switch_events,
3501 &record.opts.record_switch_events_set,
3502 "Record context switch events"),
3503 OPT_BOOLEAN_FLAG(0, "all-kernel", &record.opts.all_kernel,
3506 OPT_BOOLEAN_FLAG(0, "all-user", &record.opts.all_user,
3509 OPT_BOOLEAN(0, "kernel-callchains", &record.opts.kernel_callchains,
3511 OPT_BOOLEAN(0, "user-callchains", &record.opts.user_callchains,
3515 OPT_BOOLEAN(0, "buildid-all", &record.buildid_all,
3516 "Record build-id of all DSOs regardless of hits"),
3517 OPT_BOOLEAN(0, "buildid-mmap", &record.buildid_mmap,
3518 "Record build-id in map events"),
3519 OPT_BOOLEAN(0, "timestamp-filename", &record.timestamp_filename,
3521 OPT_BOOLEAN(0, "timestamp-boundary", &record.timestamp_boundary,
3522 "Record timestamp boundary (time of first/last samples)"),
3523 OPT_STRING_OPTARG_SET(0, "switch-output", &record.switch_output.str,
3524 &record.switch_output.set, "signal or size[BKMG] or time[smhd]",
3528 &record.switch_output_event_set, "switch output event",
3531 OPT_INTEGER(0, "switch-max-files", &record.switch_output.num_files,
3536 OPT_CALLBACK_OPTARG(0, "aio", &record.opts,
3540 OPT_CALLBACK(0, "affinity", &record.opts, "node|cpu",
3544 OPT_CALLBACK_OPTARG('z', "compression-level", &record.opts, &comp_level_default, "n",
3548 OPT_CALLBACK(0, "max-size", &record.output_max_size,
3551 &record.opts.nr_threads_synthesize,
3554 OPT_CALLBACK(0, "pfm-events", &record.evlist, "event",
3558 OPT_CALLBACK(0, "control", &record.opts, "fd:ctl-fd[,ack-fd] or fifo:ctl-fifo[,ack-fifo]",
3564 OPT_CALLBACK(0, "synth", &record.opts, "no|all|task|mmap|cgroup",
3566 OPT_STRING_OPTARG_SET(0, "debuginfod", &record.debuginfod.urls,
3567 &record.debuginfod.set, "debuginfod urls",
3570 OPT_CALLBACK_OPTARG(0, "threads", &record.opts, NULL, "spec",
3573 OPT_BOOLEAN(0, "off-cpu", &record.off_cpu, "Enable off-cpu analysis"),
3574 OPT_STRING(0, "setup-filter", &record.filter_action, "pin|unpin",
3616 static void record__free_thread_masks(struct record *rec, int nr_threads) in record__free_thread_masks()
3627 static int record__alloc_thread_masks(struct record *rec, int nr_threads, int nr_bits) in record__alloc_thread_masks()
3653 static int record__init_thread_cpu_masks(struct record *rec, struct perf_cpu_map *cpus) in record__init_thread_cpu_masks()
3678 static int record__init_thread_masks_spec(struct record *rec, struct perf_cpu_map *cpus, in record__init_thread_masks_spec()
3792 static int record__init_thread_core_masks(struct record *rec, struct perf_cpu_map *cpus) in record__init_thread_core_masks()
3810 static int record__init_thread_package_masks(struct record *rec, struct perf_cpu_map *cpus) in record__init_thread_package_masks()
3828 static int record__init_thread_numa_masks(struct record *rec, struct perf_cpu_map *cpus) in record__init_thread_numa_masks()
3860 static int record__init_thread_user_masks(struct record *rec, struct perf_cpu_map *cpus) in record__init_thread_user_masks()
3930 static int record__init_thread_default_masks(struct record *rec, struct perf_cpu_map *cpus) in record__init_thread_default_masks()
3946 static int record__init_thread_masks(struct record *rec) in record__init_thread_masks()
3985 struct record *rec = &record; in cmd_record()
3996 /* Disable eager loading of kernel symbols that adds overhead to perf record. */ in cmd_record()
4017 perf_debuginfod_setup(&record.debuginfod); in cmd_record()
4029 if (record.latency) { in cmd_record()
4037 if (record.opts.target.system_wide) { in cmd_record()
4042 record.opts.record_switch_events = true; in cmd_record()
4047 pr_err("Failed: no support to record build id in mmap events, update your kernel.\n"); in cmd_record()
4154 * In 'perf record --switch-output', disable buildid in cmd_record()
4159 * perf record --switch-output --no-no-buildid \ in cmd_record()
4181 if (record.opts.overwrite) in cmd_record()
4182 record.opts.tail_synthesize = true; in cmd_record()
4285 err = __cmd_record(&record, argc, argv); in cmd_record()
4299 struct record *rec = &record; in snapshot_sig_handler()
4309 struct record *rec = &record; in alarm_sig_handler()