diff options
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index ab19a6ee4093..313c42423393 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -1489,6 +1489,7 @@ struct perf_script { | |||
1489 | bool show_switch_events; | 1489 | bool show_switch_events; |
1490 | bool show_namespace_events; | 1490 | bool show_namespace_events; |
1491 | bool show_lost_events; | 1491 | bool show_lost_events; |
1492 | bool show_round_events; | ||
1492 | bool allocated; | 1493 | bool allocated; |
1493 | bool per_event_dump; | 1494 | bool per_event_dump; |
1494 | struct cpu_map *cpus; | 1495 | struct cpu_map *cpus; |
@@ -2104,6 +2105,16 @@ process_lost_event(struct perf_tool *tool, | |||
2104 | return 0; | 2105 | return 0; |
2105 | } | 2106 | } |
2106 | 2107 | ||
2108 | static int | ||
2109 | process_finished_round_event(struct perf_tool *tool __maybe_unused, | ||
2110 | union perf_event *event, | ||
2111 | struct ordered_events *oe __maybe_unused) | ||
2112 | |||
2113 | { | ||
2114 | perf_event__fprintf(event, stdout); | ||
2115 | return 0; | ||
2116 | } | ||
2117 | |||
2107 | static void sig_handler(int sig __maybe_unused) | 2118 | static void sig_handler(int sig __maybe_unused) |
2108 | { | 2119 | { |
2109 | session_done = 1; | 2120 | session_done = 1; |
@@ -2200,6 +2211,10 @@ static int __cmd_script(struct perf_script *script) | |||
2200 | script->tool.namespaces = process_namespaces_event; | 2211 | script->tool.namespaces = process_namespaces_event; |
2201 | if (script->show_lost_events) | 2212 | if (script->show_lost_events) |
2202 | script->tool.lost = process_lost_event; | 2213 | script->tool.lost = process_lost_event; |
2214 | if (script->show_round_events) { | ||
2215 | script->tool.ordered_events = false; | ||
2216 | script->tool.finished_round = process_finished_round_event; | ||
2217 | } | ||
2203 | 2218 | ||
2204 | if (perf_script__setup_per_event_dump(script)) { | 2219 | if (perf_script__setup_per_event_dump(script)) { |
2205 | pr_err("Couldn't create the per event dump files\n"); | 2220 | pr_err("Couldn't create the per event dump files\n"); |
@@ -2659,8 +2674,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused, | |||
2659 | } | 2674 | } |
2660 | 2675 | ||
2661 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { | 2676 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
2662 | snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, | 2677 | scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, |
2663 | lang_dirent->d_name); | 2678 | lang_dirent->d_name); |
2664 | lang_dir = opendir(lang_path); | 2679 | lang_dir = opendir(lang_path); |
2665 | if (!lang_dir) | 2680 | if (!lang_dir) |
2666 | continue; | 2681 | continue; |
@@ -2669,8 +2684,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused, | |||
2669 | script_root = get_script_root(script_dirent, REPORT_SUFFIX); | 2684 | script_root = get_script_root(script_dirent, REPORT_SUFFIX); |
2670 | if (script_root) { | 2685 | if (script_root) { |
2671 | desc = script_desc__findnew(script_root); | 2686 | desc = script_desc__findnew(script_root); |
2672 | snprintf(script_path, MAXPATHLEN, "%s/%s", | 2687 | scnprintf(script_path, MAXPATHLEN, "%s/%s", |
2673 | lang_path, script_dirent->d_name); | 2688 | lang_path, script_dirent->d_name); |
2674 | read_script_info(desc, script_path); | 2689 | read_script_info(desc, script_path); |
2675 | free(script_root); | 2690 | free(script_root); |
2676 | } | 2691 | } |
@@ -2706,7 +2721,7 @@ static int check_ev_match(char *dir_name, char *scriptname, | |||
2706 | int match, len; | 2721 | int match, len; |
2707 | FILE *fp; | 2722 | FILE *fp; |
2708 | 2723 | ||
2709 | sprintf(filename, "%s/bin/%s-record", dir_name, scriptname); | 2724 | scnprintf(filename, MAXPATHLEN, "%s/bin/%s-record", dir_name, scriptname); |
2710 | 2725 | ||
2711 | fp = fopen(filename, "r"); | 2726 | fp = fopen(filename, "r"); |
2712 | if (!fp) | 2727 | if (!fp) |
@@ -2784,8 +2799,8 @@ int find_scripts(char **scripts_array, char **scripts_path_array) | |||
2784 | } | 2799 | } |
2785 | 2800 | ||
2786 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { | 2801 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
2787 | snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, | 2802 | scnprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, |
2788 | lang_dirent->d_name); | 2803 | lang_dirent->d_name); |
2789 | #ifdef NO_LIBPERL | 2804 | #ifdef NO_LIBPERL |
2790 | if (strstr(lang_path, "perl")) | 2805 | if (strstr(lang_path, "perl")) |
2791 | continue; | 2806 | continue; |
@@ -2840,8 +2855,8 @@ static char *get_script_path(const char *script_root, const char *suffix) | |||
2840 | return NULL; | 2855 | return NULL; |
2841 | 2856 | ||
2842 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { | 2857 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
2843 | snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, | 2858 | scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, |
2844 | lang_dirent->d_name); | 2859 | lang_dirent->d_name); |
2845 | lang_dir = opendir(lang_path); | 2860 | lang_dir = opendir(lang_path); |
2846 | if (!lang_dir) | 2861 | if (!lang_dir) |
2847 | continue; | 2862 | continue; |
@@ -2852,8 +2867,8 @@ static char *get_script_path(const char *script_root, const char *suffix) | |||
2852 | free(__script_root); | 2867 | free(__script_root); |
2853 | closedir(lang_dir); | 2868 | closedir(lang_dir); |
2854 | closedir(scripts_dir); | 2869 | closedir(scripts_dir); |
2855 | snprintf(script_path, MAXPATHLEN, "%s/%s", | 2870 | scnprintf(script_path, MAXPATHLEN, "%s/%s", |
2856 | lang_path, script_dirent->d_name); | 2871 | lang_path, script_dirent->d_name); |
2857 | return strdup(script_path); | 2872 | return strdup(script_path); |
2858 | } | 2873 | } |
2859 | free(__script_root); | 2874 | free(__script_root); |
@@ -3139,6 +3154,8 @@ int cmd_script(int argc, const char **argv) | |||
3139 | "Show namespace events (if recorded)"), | 3154 | "Show namespace events (if recorded)"), |
3140 | OPT_BOOLEAN('\0', "show-lost-events", &script.show_lost_events, | 3155 | OPT_BOOLEAN('\0', "show-lost-events", &script.show_lost_events, |
3141 | "Show lost events (if recorded)"), | 3156 | "Show lost events (if recorded)"), |
3157 | OPT_BOOLEAN('\0', "show-round-events", &script.show_round_events, | ||
3158 | "Show round events (if recorded)"), | ||
3142 | OPT_BOOLEAN('\0', "per-event-dump", &script.per_event_dump, | 3159 | OPT_BOOLEAN('\0', "per-event-dump", &script.per_event_dump, |
3143 | "Dump trace output to files named by the monitored events"), | 3160 | "Dump trace output to files named by the monitored events"), |
3144 | OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"), | 3161 | OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"), |