Lines Matching +full:p +full:- +full:256

1 // SPDX-License-Identifier: GPL-2.0
15 #include <subcmd/exec-cmd.h>
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.
26 #define SCRIPT_FULLPATH_LEN 256
33 char extra_format[256];
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()
110 char *p = skip_spaces(line); in check_ev_match() local
112 if (*p == '#') in check_ev_match()
115 while (strlen(p)) { in check_ev_match()
120 p = strstr(p, "-e"); in check_ev_match()
121 if (!p) in check_ev_match()
124 p += 2; in check_ev_match()
125 p = skip_spaces(p); in check_ev_match()
126 len = strcspn(p, " \t"); in check_ev_match()
130 snprintf(evname, len + 1, "%s", p); 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()
226 /* Skip those real time scripts: xxxtop.p[yl] */ 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()
256 * Return -1 on failure.
265 char pbuf[256]; in list_scripts()
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()
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()
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()