Lines Matching refs:script

728 tod_scnprintf(struct perf_script *script, char *buf, int buflen,  in tod_scnprintf()  argument
739 if (buflen < 64 || !script) in tod_scnprintf()
742 env = &script->session->header.env; in tod_scnprintf()
789 static int perf_sample__fprintf_start(struct perf_script *script, in perf_sample__fprintf_start() argument
891 tod_scnprintf(script, tstr, sizeof(tstr), sample->time); in perf_sample__fprintf_start()
2167 static void perf_sample__fprint_metric(struct perf_script *script, in perf_sample__fprint_metric() argument
2189 evlist__alloc_stats(&stat_config, script->session->evlist, /*alloc_raw=*/false); in perf_sample__fprint_metric()
2248 static void process_event(struct perf_script *script, in process_event() argument
2267 perf_sample__fprintf_start(script, sample, thread, evsel, in process_event()
2276 if (!script->name_width) in process_event()
2277 script->name_width = evlist__max_name_len(script->session->evlist); in process_event()
2279 fprintf(fp, "%*s: ", script->name_width, evname ?: "[unknown]"); in process_event()
2327 if (script->stitch_lbr) in process_event()
2379 perf_sample__fprint_metric(script, thread, evsel, sample, fp); in process_event()
2618 struct perf_script *script = container_of(tool, struct perf_script, tool); in print_event_with_time() local
2619 struct perf_session *session = script->session; in print_event_with_time()
2637 perf_sample__fprintf_start(script, sample, thread, evsel, in print_event_with_time()
2745 struct perf_script *script = container_of(tool, struct perf_script, tool); in process_switch_event() local
2753 if (!script->show_switch_events) in process_switch_event()
2832 static void perf_script__fclose_per_event_dump(struct perf_script *script) in perf_script__fclose_per_event_dump() argument
2834 struct evlist *evlist = script->session->evlist; in perf_script__fclose_per_event_dump()
2845 static int perf_script__fopen_per_event_dump(struct perf_script *script) in perf_script__fopen_per_event_dump() argument
2849 evlist__for_each_entry(script->session->evlist, evsel) { in perf_script__fopen_per_event_dump()
2860 evsel->priv = evsel_script__new(evsel, script->session->data); in perf_script__fopen_per_event_dump()
2868 perf_script__fclose_per_event_dump(script); in perf_script__fopen_per_event_dump()
2872 static int perf_script__setup_per_event_dump(struct perf_script *script) in perf_script__setup_per_event_dump() argument
2876 if (script->per_event_dump) in perf_script__setup_per_event_dump()
2877 return perf_script__fopen_per_event_dump(script); in perf_script__setup_per_event_dump()
2881 evlist__for_each_entry(script->session->evlist, evsel) in perf_script__setup_per_event_dump()
2887 static void perf_script__exit_per_event_dump_stats(struct perf_script *script) in perf_script__exit_per_event_dump_stats() argument
2891 evlist__for_each_entry(script->session->evlist, evsel) { in perf_script__exit_per_event_dump_stats()
2900 static void perf_script__exit(struct perf_script *script) in perf_script__exit() argument
2902 perf_thread_map__put(script->threads); in perf_script__exit()
2903 perf_cpu_map__put(script->cpus); in perf_script__exit()
2906 static int __cmd_script(struct perf_script *script) in __cmd_script() argument
2913 if (script->show_task_events) { in __cmd_script()
2914 script->tool.comm = process_comm_event; in __cmd_script()
2915 script->tool.fork = process_fork_event; in __cmd_script()
2916 script->tool.exit = process_exit_event; in __cmd_script()
2918 if (script->show_mmap_events) { in __cmd_script()
2919 script->tool.mmap = process_mmap_event; in __cmd_script()
2920 script->tool.mmap2 = process_mmap2_event; in __cmd_script()
2922 if (script->show_switch_events || (scripting_ops && scripting_ops->process_switch)) in __cmd_script()
2923 script->tool.context_switch = process_switch_event; in __cmd_script()
2925 script->tool.auxtrace_error = process_auxtrace_error; in __cmd_script()
2926 if (script->show_namespace_events) in __cmd_script()
2927 script->tool.namespaces = process_namespaces_event; in __cmd_script()
2928 if (script->show_cgroup_events) in __cmd_script()
2929 script->tool.cgroup = process_cgroup_event; in __cmd_script()
2930 if (script->show_lost_events) in __cmd_script()
2931 script->tool.lost = process_lost_event; in __cmd_script()
2932 if (script->show_round_events) { in __cmd_script()
2933 script->tool.ordered_events = false; in __cmd_script()
2934 script->tool.finished_round = process_finished_round_event; in __cmd_script()
2936 if (script->show_bpf_events) { in __cmd_script()
2937 script->tool.ksymbol = process_bpf_events; in __cmd_script()
2938 script->tool.bpf = process_bpf_events; in __cmd_script()
2940 if (script->show_text_poke_events) { in __cmd_script()
2941 script->tool.ksymbol = process_bpf_events; in __cmd_script()
2942 script->tool.text_poke = process_text_poke_events; in __cmd_script()
2945 if (perf_script__setup_per_event_dump(script)) { in __cmd_script()
2950 ret = perf_session__process_events(script->session); in __cmd_script()
2952 if (script->per_event_dump) in __cmd_script()
2953 perf_script__exit_per_event_dump_stats(script); in __cmd_script()
3038 static char *find_script(const char *script) in find_script() argument
3043 const char *ext = strrchr(script, '.'); in find_script()
3053 if (access(script, R_OK)) { in find_script()
3059 exec_path, scripting_ops->dirname, script); in find_script()
3061 script = path; in find_script()
3062 if (access(script, R_OK)) in find_script()
3065 return strdup(script); in find_script()
3072 const char *script, *ext; in parse_scriptname() local
3080 script = strchr(str, ':'); in parse_scriptname()
3081 if (script) { in parse_scriptname()
3082 len = script - str; in parse_scriptname()
3094 script++; in parse_scriptname()
3096 script = str; in parse_scriptname()
3097 ext = strrchr(script, '.'); in parse_scriptname()
3109 script_name = find_script(script); in parse_scriptname()
3111 script_name = strdup(script); in parse_scriptname()
3751 static void script__setup_sample_type(struct perf_script *script) in script__setup_sample_type() argument
3753 struct perf_session *session = script->session; in script__setup_sample_type()
3758 if (script->stitch_lbr && (callchain_param.record_mode != CALLCHAIN_LBR)) { in script__setup_sample_type()
3761 script->stitch_lbr = false; in script__setup_sample_type()
3794 static int set_maps(struct perf_script *script) in set_maps() argument
3796 struct evlist *evlist = script->session->evlist; in set_maps()
3798 if (!script->cpus || !script->threads) in set_maps()
3801 if (WARN_ONCE(script->allocated, "stats double allocation\n")) in set_maps()
3804 perf_evlist__set_maps(&evlist->core, script->cpus, script->threads); in set_maps()
3809 script->allocated = true; in set_maps()
3818 struct perf_script *script = container_of(tool, struct perf_script, tool); in process_thread_map_event() local
3823 if (script->threads) { in process_thread_map_event()
3828 script->threads = thread_map__new_event(&event->thread_map); in process_thread_map_event()
3829 if (!script->threads) in process_thread_map_event()
3832 return set_maps(script); in process_thread_map_event()
3840 struct perf_script *script = container_of(tool, struct perf_script, tool); in process_cpu_map_event() local
3845 if (script->cpus) { in process_cpu_map_event()
3850 script->cpus = cpu_map__new_data(&event->cpu_map.data); in process_cpu_map_event()
3851 if (!script->cpus) in process_cpu_map_event()
3854 return set_maps(script); in process_cpu_map_event()
3873 struct perf_script *script = container_of(tool, struct perf_script, tool); in perf_script__process_auxtrace_info() local
3875 ret = perf_script__setup_per_event_dump(script); in perf_script__process_auxtrace_info()
3959 struct perf_script script = {}; in cmd_script() local
4047 OPT_BOOLEAN('\0', "show-task-events", &script.show_task_events, in cmd_script()
4049 OPT_BOOLEAN('\0', "show-mmap-events", &script.show_mmap_events, in cmd_script()
4051 OPT_BOOLEAN('\0', "show-switch-events", &script.show_switch_events, in cmd_script()
4053 OPT_BOOLEAN('\0', "show-namespace-events", &script.show_namespace_events, in cmd_script()
4055 OPT_BOOLEAN('\0', "show-cgroup-events", &script.show_cgroup_events, in cmd_script()
4057 OPT_BOOLEAN('\0', "show-lost-events", &script.show_lost_events, in cmd_script()
4059 OPT_BOOLEAN('\0', "show-round-events", &script.show_round_events, in cmd_script()
4061 OPT_BOOLEAN('\0', "show-bpf-events", &script.show_bpf_events, in cmd_script()
4063 OPT_BOOLEAN('\0', "show-text-poke-events", &script.show_text_poke_events, in cmd_script()
4065 OPT_BOOLEAN('\0', "per-event-dump", &script.per_event_dump, in cmd_script()
4083 OPT_STRING(0, "time", &script.time_str, "str", in cmd_script()
4098 OPT_BOOLEAN('\0', "stitch-lbr", &script.stitch_lbr, in cmd_script()
4100 OPTS_EVSWITCH(&script.evswitch), in cmd_script()
4326 perf_tool__init(&script.tool, !unsorted_dump); in cmd_script()
4327 script.tool.sample = process_sample_event; in cmd_script()
4328 script.tool.mmap = perf_event__process_mmap; in cmd_script()
4329 script.tool.mmap2 = perf_event__process_mmap2; in cmd_script()
4330 script.tool.comm = perf_event__process_comm; in cmd_script()
4331 script.tool.namespaces = perf_event__process_namespaces; in cmd_script()
4332 script.tool.cgroup = perf_event__process_cgroup; in cmd_script()
4333 script.tool.exit = perf_event__process_exit; in cmd_script()
4334 script.tool.fork = perf_event__process_fork; in cmd_script()
4335 script.tool.attr = process_attr; in cmd_script()
4336 script.tool.event_update = perf_event__process_event_update; in cmd_script()
4338 script.tool.tracing_data = perf_event__process_tracing_data; in cmd_script()
4340 script.tool.feature = process_feature_event; in cmd_script()
4341 script.tool.build_id = perf_event__process_build_id; in cmd_script()
4342 script.tool.id_index = perf_event__process_id_index; in cmd_script()
4343 script.tool.auxtrace_info = perf_script__process_auxtrace_info; in cmd_script()
4344 script.tool.auxtrace = perf_event__process_auxtrace; in cmd_script()
4345 script.tool.auxtrace_error = perf_event__process_auxtrace_error; in cmd_script()
4346 script.tool.stat = perf_event__process_stat_event; in cmd_script()
4347 script.tool.stat_round = process_stat_round_event; in cmd_script()
4348 script.tool.stat_config = process_stat_config_event; in cmd_script()
4349 script.tool.thread_map = process_thread_map_event; in cmd_script()
4350 script.tool.cpu_map = process_cpu_map_event; in cmd_script()
4351 script.tool.throttle = process_throttle_event; in cmd_script()
4352 script.tool.unthrottle = process_throttle_event; in cmd_script()
4353 script.tool.ordering_requires_timestamps = true; in cmd_script()
4354 session = perf_session__new(&data, &script.tool); in cmd_script()
4359 script.tool.show_feat_hdr = SHOW_FEAT_HEADER; in cmd_script()
4365 script.tool.show_feat_hdr = SHOW_FEAT_HEADER_FULL_INFO; in cmd_script()
4381 script.session = session; in cmd_script()
4382 script__setup_sample_type(&script); in cmd_script()
4473 if (script.time_str) { in cmd_script()
4474 err = perf_time__parse_for_ranges_reltime(script.time_str, session, in cmd_script()
4475 &script.ptime_range, in cmd_script()
4476 &script.range_size, in cmd_script()
4477 &script.range_num, in cmd_script()
4483 script.ptime_range, in cmd_script()
4484 script.range_num); in cmd_script()
4487 err = evswitch__init(&script.evswitch, session->evlist, stderr); in cmd_script()
4494 err = __cmd_script(&script); in cmd_script()
4502 if (script.ptime_range) { in cmd_script()
4504 zfree(&script.ptime_range); in cmd_script()
4510 perf_script__exit(&script); in cmd_script()