Lines Matching +full:full +full:- +full:custom
1 // SPDX-License-Identifier: GPL-2.0
15 #include <subcmd/exec-cmd.h>
21 * Usually the full path for a script is:
22 * /home/username/libexec/perf-core/scripts/python/xxx.py
23 * /home/username/libexec/perf-core/scripts/perl/xxx.pl
24 * So 256 should be long enough to contain the full path.
39 if (attr->read_format & PERF_FORMAT_GROUP) in attr_to_script()
40 strcat(extra_format, " -F +metric"); in attr_to_script()
41 if (attr->sample_type & PERF_SAMPLE_BRANCH_STACK) in attr_to_script()
42 strcat(extra_format, " -F +brstackinsn --xed"); in attr_to_script()
43 if (attr->sample_type & PERF_SAMPLE_REGS_INTR) in attr_to_script()
44 strcat(extra_format, " -F +iregs"); in attr_to_script()
45 if (attr->sample_type & PERF_SAMPLE_REGS_USER) in attr_to_script()
46 strcat(extra_format, " -F +uregs"); in attr_to_script()
47 if (attr->sample_type & PERF_SAMPLE_PHYS_ADDR) in attr_to_script()
48 strcat(extra_format, " -F +phys_addr"); in attr_to_script()
54 c->names[c->index] = name; in add_script_option()
55 if (asprintf(&c->paths[c->index], in add_script_option()
56 "%s script %s -F +metric %s %s", in add_script_option()
57 c->perf, opt, symbol_conf.inline_name ? " --inline" : "", in add_script_option()
58 c->extra_format) < 0) in add_script_option()
59 return -1; in add_script_option()
60 c->index++; in add_script_option()
69 return -1; in scripts_config()
70 if (c->index >= SCRIPT_MAX_NO) in scripts_config()
71 return -1; in scripts_config()
72 c->names[c->index] = strdup(var + 7); in scripts_config()
73 if (!c->names[c->index]) in scripts_config()
74 return -1; in scripts_config()
75 if (asprintf(&c->paths[c->index], "%s %s", value, in scripts_config()
76 c->extra_format) < 0) in scripts_config()
77 return -1; in scripts_config()
78 c->index++; in scripts_config()
83 * Some scripts specify the required events in their "xxx-record" file,
85 * mentioned in the "xxx-record".
87 * Fixme: All existing "xxx-record" are all in good formats "-e event ",
100 scnprintf(filename, sizeof(filename), "bin/%s-record", scriptname); in check_ev_match()
102 if (fd == -1) in check_ev_match()
103 return -1; in check_ev_match()
106 return -1; in check_ev_match()
120 p = strstr(p, "-e"); in check_ev_match()
133 evlist__for_each_entry(session->evlist, pos) { in check_ev_match()
142 return -1; in check_ev_match()
152 * Return -1 if none is found, otherwise the actual scripts number.
183 if (scripts_dir_fd == -1) { in find_scripts()
185 return -1; in find_scripts()
192 return -1; in find_scripts()
196 if (lang_dirent->d_type != DT_DIR && in find_scripts()
197 (lang_dirent->d_type == DT_UNKNOWN && in find_scripts()
198 !is_directory_at(scripts_dir_fd, lang_dirent->d_name))) in find_scripts()
200 if (!strcmp(lang_dirent->d_name, ".") || !strcmp(lang_dirent->d_name, "..")) in find_scripts()
204 if (strstr(lang_dirent->d_name, "perl")) in find_scripts()
208 if (strstr(lang_dirent->d_name, "python")) in find_scripts()
212 lang_dir_fd = openat(scripts_dir_fd, lang_dirent->d_name, O_DIRECTORY); in find_scripts()
213 if (lang_dir_fd == -1) in find_scripts()
221 if (script_dirent->d_type == DT_DIR) in find_scripts()
223 if (script_dirent->d_type == DT_UNKNOWN && in find_scripts()
224 is_directory_at(lang_dir_fd, script_dirent->d_name)) in find_scripts()
227 if (strstr(script_dirent->d_name, "top.")) in find_scripts()
233 lang_dirent->d_name, in find_scripts()
234 script_dirent->d_name); in find_scripts()
235 temp = strchr(script_dirent->d_name, '.'); in find_scripts()
237 (temp - script_dirent->d_name) + 1, in find_scripts()
238 "%s", script_dirent->d_name); in find_scripts()
254 * When success, will copy the full path of the selected script
256 * Return -1 on failure.
258 static int list_scripts(char *script_name, bool *custom, in list_scripts() argument
278 return -1; in list_scripts()
281 attr_to_script(scriptc.extra_format, &evsel->core.attr); in list_scripts()
283 add_script_option("Show individual samples with assembler", "-F +disasm", in list_scripts()
285 add_script_option("Show individual samples with source", "-F +srcline,+srccode", in list_scripts()
289 add_script_option("Show samples with custom perf script arguments", "", &scriptc); in list_scripts()
294 names[i] = buf + (i - max_std) * (SCRIPT_NAMELEN + SCRIPT_FULLPATH_LEN); in list_scripts()
298 num = find_scripts(names + max_std, paths + max_std, SCRIPT_MAX_NO - max_std, in list_scripts()
304 ret = -1; in list_scripts()
313 ret = -1; in list_scripts()
320 *custom = choice >= max_std; in list_scripts()
349 bool custom = false; in script_browse() local
352 if (list_scripts(script_name, &custom, evsel)) in script_browse()
353 return -1; in script_browse()
356 custom ? "perf script -s " : "", in script_browse()
359 input_name ? "-i " : "", in script_browse()
361 return -1; in script_browse()