aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-lock.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:20:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 21:20:11 -0400
commitade0899b298ba2c43bfd6abd8cbc2545944cde0c (patch)
treea448dfb440b3b958b6306bb43620cd5d76f504bf /tools/perf/builtin-lock.c
parent871a0596cb2f51b57dc583d1a7c4be0186582fe7 (diff)
parent95cf59ea72331d0093010543b8951bb43f262cac (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: "This tree includes some late late perf items that missed the first round: tools: - Bash auto completion improvements, now we can auto complete the tools long options, tracepoint event names, etc, from Namhyung Kim. - Look up thread using tid instead of pid in 'perf sched'. - Move global variables into a perf_kvm struct, from David Ahern. - Hists refactorings, preparatory for improved 'diff' command, from Jiri Olsa. - Hists refactorings, preparatory for event group viewieng work, from Namhyung Kim. - Remove double negation on optional feature macro definitions, from Namhyung Kim. - Remove several cases of needless global variables, on most builtins. - misc fixes kernel: - sysfs support for IBS on AMD CPUs, from Robert Richter. - Support for an upcoming Intel CPU, the Xeon-Phi / Knights Corner HPC blade PMU, from Vince Weaver. - misc fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) perf: Fix perf_cgroup_switch for sw-events perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu perf/AMD/IBS: Add sysfs support perf hists: Add more helpers for hist entry stat perf hists: Move he->stat.nr_events initialization to a template perf hists: Introduce struct he_stat perf diff: Removing the total_period argument from output code perf tool: Add hpp interface to enable/disable hpp column perf tools: Removing hists pair argument from output path perf hists: Separate overhead and baseline columns perf diff: Refactor diff displacement possition info perf hists: Add struct hists pointer to struct hist_entry perf tools: Complete tracepoint event names perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU perf evlist: Remove some unused methods perf evlist: Introduce add_newtp method perf kvm: Move global variables into a perf_kvm struct perf tools: Convert to BACKTRACE_SUPPORT perf tools: Long option completion support for each subcommands perf tools: Complete long option names of perf command ...
Diffstat (limited to 'tools/perf/builtin-lock.c')
-rw-r--r--tools/perf/builtin-lock.c90
1 files changed, 39 insertions, 51 deletions
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 7d6e09949880..6f5f328157aa 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -823,12 +823,6 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
823 return 0; 823 return 0;
824} 824}
825 825
826static struct perf_tool eops = {
827 .sample = process_sample_event,
828 .comm = perf_event__process_comm,
829 .ordered_samples = true,
830};
831
832static const struct perf_evsel_str_handler lock_tracepoints[] = { 826static const struct perf_evsel_str_handler lock_tracepoints[] = {
833 { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, /* CONFIG_LOCKDEP */ 827 { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, /* CONFIG_LOCKDEP */
834 { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */ 828 { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */
@@ -838,6 +832,11 @@ static const struct perf_evsel_str_handler lock_tracepoints[] = {
838 832
839static int read_events(void) 833static int read_events(void)
840{ 834{
835 struct perf_tool eops = {
836 .sample = process_sample_event,
837 .comm = perf_event__process_comm,
838 .ordered_samples = true,
839 };
841 session = perf_session__new(input_name, O_RDONLY, 0, false, &eops); 840 session = perf_session__new(input_name, O_RDONLY, 0, false, &eops);
842 if (!session) { 841 if (!session) {
843 pr_err("Initializing perf session failed\n"); 842 pr_err("Initializing perf session failed\n");
@@ -878,53 +877,11 @@ static int __cmd_report(void)
878 return 0; 877 return 0;
879} 878}
880 879
881static const char * const report_usage[] = {
882 "perf lock report [<options>]",
883 NULL
884};
885
886static const struct option report_options[] = {
887 OPT_STRING('k', "key", &sort_key, "acquired",
888 "key for sorting (acquired / contended / wait_total / wait_max / wait_min)"),
889 /* TODO: type */
890 OPT_END()
891};
892
893static const char * const info_usage[] = {
894 "perf lock info [<options>]",
895 NULL
896};
897
898static const struct option info_options[] = {
899 OPT_BOOLEAN('t', "threads", &info_threads,
900 "dump thread list in perf.data"),
901 OPT_BOOLEAN('m', "map", &info_map,
902 "map of lock instances (address:name table)"),
903 OPT_END()
904};
905
906static const char * const lock_usage[] = {
907 "perf lock [<options>] {record|report|script|info}",
908 NULL
909};
910
911static const struct option lock_options[] = {
912 OPT_STRING('i', "input", &input_name, "file", "input file name"),
913 OPT_INCR('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"),
914 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"),
915 OPT_END()
916};
917
918static const char *record_args[] = {
919 "record",
920 "-R",
921 "-f",
922 "-m", "1024",
923 "-c", "1",
924};
925
926static int __cmd_record(int argc, const char **argv) 880static int __cmd_record(int argc, const char **argv)
927{ 881{
882 const char *record_args[] = {
883 "record", "-R", "-f", "-m", "1024", "-c", "1",
884 };
928 unsigned int rec_argc, i, j; 885 unsigned int rec_argc, i, j;
929 const char **rec_argv; 886 const char **rec_argv;
930 887
@@ -963,6 +920,37 @@ static int __cmd_record(int argc, const char **argv)
963 920
964int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) 921int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
965{ 922{
923 const struct option info_options[] = {
924 OPT_BOOLEAN('t', "threads", &info_threads,
925 "dump thread list in perf.data"),
926 OPT_BOOLEAN('m', "map", &info_map,
927 "map of lock instances (address:name table)"),
928 OPT_END()
929 };
930 const struct option lock_options[] = {
931 OPT_STRING('i', "input", &input_name, "file", "input file name"),
932 OPT_INCR('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"),
933 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"),
934 OPT_END()
935 };
936 const struct option report_options[] = {
937 OPT_STRING('k', "key", &sort_key, "acquired",
938 "key for sorting (acquired / contended / wait_total / wait_max / wait_min)"),
939 /* TODO: type */
940 OPT_END()
941 };
942 const char * const info_usage[] = {
943 "perf lock info [<options>]",
944 NULL
945 };
946 const char * const lock_usage[] = {
947 "perf lock [<options>] {record|report|script|info}",
948 NULL
949 };
950 const char * const report_usage[] = {
951 "perf lock report [<options>]",
952 NULL
953 };
966 unsigned int i; 954 unsigned int i;
967 int rc = 0; 955 int rc = 0;
968 956