diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
commit | 4d7b4ac22fbec1a03206c6cde353f2fd6942f828 (patch) | |
tree | 2d96a9e9c28cf6fa628a278decc00ad55a8b043b /tools/perf/builtin-sched.c | |
parent | 3aaf51ace5975050ab43c7d4d7e439e0ae7d13d7 (diff) | |
parent | 94f3ca95787ada3d64339a4ecb2754236ab563f6 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (311 commits)
perf tools: Add mode to build without newt support
perf symbols: symbol inconsistency message should be done only at verbose=1
perf tui: Add explicit -lslang option
perf options: Type check all the remaining OPT_ variants
perf options: Type check OPT_BOOLEAN and fix the offenders
perf options: Check v type in OPT_U?INTEGER
perf options: Introduce OPT_UINTEGER
perf tui: Add workaround for slang < 2.1.4
perf record: Fix bug mismatch with -c option definition
perf options: Introduce OPT_U64
perf tui: Add help window to show key associations
perf tui: Make <- exit menus too
perf newt: Add single key shortcuts for zoom into DSO and threads
perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
perf newt: Fix the 'A'/'a' shortcut for annotate
perf newt: Make <- exit the ui_browser
x86, perf: P4 PMU - fix counters management logic
perf newt: Make <- zoom out filters
perf report: Report number of events, not samples
perf hist: Clarify events_stats fields usage
...
Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 4f5a03e43444..f67bce2a83b4 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -22,7 +22,7 @@ | |||
22 | static char const *input_name = "perf.data"; | 22 | static char const *input_name = "perf.data"; |
23 | 23 | ||
24 | static char default_sort_order[] = "avg, max, switch, runtime"; | 24 | static char default_sort_order[] = "avg, max, switch, runtime"; |
25 | static char *sort_order = default_sort_order; | 25 | static const char *sort_order = default_sort_order; |
26 | 26 | ||
27 | static int profile_cpu = -1; | 27 | static int profile_cpu = -1; |
28 | 28 | ||
@@ -68,10 +68,10 @@ enum sched_event_type { | |||
68 | 68 | ||
69 | struct sched_atom { | 69 | struct sched_atom { |
70 | enum sched_event_type type; | 70 | enum sched_event_type type; |
71 | int specific_wait; | ||
71 | u64 timestamp; | 72 | u64 timestamp; |
72 | u64 duration; | 73 | u64 duration; |
73 | unsigned long nr; | 74 | unsigned long nr; |
74 | int specific_wait; | ||
75 | sem_t *wait_sem; | 75 | sem_t *wait_sem; |
76 | struct task_desc *wakee; | 76 | struct task_desc *wakee; |
77 | }; | 77 | }; |
@@ -105,7 +105,7 @@ static u64 sum_runtime; | |||
105 | static u64 sum_fluct; | 105 | static u64 sum_fluct; |
106 | static u64 run_avg; | 106 | static u64 run_avg; |
107 | 107 | ||
108 | static unsigned long replay_repeat = 10; | 108 | static unsigned int replay_repeat = 10; |
109 | static unsigned long nr_timestamps; | 109 | static unsigned long nr_timestamps; |
110 | static unsigned long nr_unordered_timestamps; | 110 | static unsigned long nr_unordered_timestamps; |
111 | static unsigned long nr_state_machine_bugs; | 111 | static unsigned long nr_state_machine_bugs; |
@@ -1641,30 +1641,26 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
1641 | return 0; | 1641 | return 0; |
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | static int process_lost_event(event_t *event __used, | ||
1645 | struct perf_session *session __used) | ||
1646 | { | ||
1647 | nr_lost_chunks++; | ||
1648 | nr_lost_events += event->lost.lost; | ||
1649 | |||
1650 | return 0; | ||
1651 | } | ||
1652 | |||
1653 | static struct perf_event_ops event_ops = { | 1644 | static struct perf_event_ops event_ops = { |
1654 | .sample = process_sample_event, | 1645 | .sample = process_sample_event, |
1655 | .comm = event__process_comm, | 1646 | .comm = event__process_comm, |
1656 | .lost = process_lost_event, | 1647 | .lost = event__process_lost, |
1648 | .ordered_samples = true, | ||
1657 | }; | 1649 | }; |
1658 | 1650 | ||
1659 | static int read_events(void) | 1651 | static int read_events(void) |
1660 | { | 1652 | { |
1661 | int err = -EINVAL; | 1653 | int err = -EINVAL; |
1662 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); | 1654 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0, false); |
1663 | if (session == NULL) | 1655 | if (session == NULL) |
1664 | return -ENOMEM; | 1656 | return -ENOMEM; |
1665 | 1657 | ||
1666 | if (perf_session__has_traces(session, "record -R")) | 1658 | if (perf_session__has_traces(session, "record -R")) { |
1667 | err = perf_session__process_events(session, &event_ops); | 1659 | err = perf_session__process_events(session, &event_ops); |
1660 | nr_events = session->hists.stats.nr_events[0]; | ||
1661 | nr_lost_events = session->hists.stats.total_lost; | ||
1662 | nr_lost_chunks = session->hists.stats.nr_events[PERF_RECORD_LOST]; | ||
1663 | } | ||
1668 | 1664 | ||
1669 | perf_session__delete(session); | 1665 | perf_session__delete(session); |
1670 | return err; | 1666 | return err; |
@@ -1790,7 +1786,7 @@ static const char * const sched_usage[] = { | |||
1790 | static const struct option sched_options[] = { | 1786 | static const struct option sched_options[] = { |
1791 | OPT_STRING('i', "input", &input_name, "file", | 1787 | OPT_STRING('i', "input", &input_name, "file", |
1792 | "input file name"), | 1788 | "input file name"), |
1793 | OPT_BOOLEAN('v', "verbose", &verbose, | 1789 | OPT_INCR('v', "verbose", &verbose, |
1794 | "be more verbose (show symbol address, etc)"), | 1790 | "be more verbose (show symbol address, etc)"), |
1795 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1791 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1796 | "dump raw trace in ASCII"), | 1792 | "dump raw trace in ASCII"), |
@@ -1805,7 +1801,7 @@ static const char * const latency_usage[] = { | |||
1805 | static const struct option latency_options[] = { | 1801 | static const struct option latency_options[] = { |
1806 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 1802 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
1807 | "sort by key(s): runtime, switch, avg, max"), | 1803 | "sort by key(s): runtime, switch, avg, max"), |
1808 | OPT_BOOLEAN('v', "verbose", &verbose, | 1804 | OPT_INCR('v', "verbose", &verbose, |
1809 | "be more verbose (show symbol address, etc)"), | 1805 | "be more verbose (show symbol address, etc)"), |
1810 | OPT_INTEGER('C', "CPU", &profile_cpu, | 1806 | OPT_INTEGER('C', "CPU", &profile_cpu, |
1811 | "CPU to profile on"), | 1807 | "CPU to profile on"), |
@@ -1820,9 +1816,9 @@ static const char * const replay_usage[] = { | |||
1820 | }; | 1816 | }; |
1821 | 1817 | ||
1822 | static const struct option replay_options[] = { | 1818 | static const struct option replay_options[] = { |
1823 | OPT_INTEGER('r', "repeat", &replay_repeat, | 1819 | OPT_UINTEGER('r', "repeat", &replay_repeat, |
1824 | "repeat the workload replay N times (-1: infinite)"), | 1820 | "repeat the workload replay N times (-1: infinite)"), |
1825 | OPT_BOOLEAN('v', "verbose", &verbose, | 1821 | OPT_INCR('v', "verbose", &verbose, |
1826 | "be more verbose (show symbol address, etc)"), | 1822 | "be more verbose (show symbol address, etc)"), |
1827 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1823 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1828 | "dump raw trace in ASCII"), | 1824 | "dump raw trace in ASCII"), |
@@ -1850,7 +1846,6 @@ static const char *record_args[] = { | |||
1850 | "record", | 1846 | "record", |
1851 | "-a", | 1847 | "-a", |
1852 | "-R", | 1848 | "-R", |
1853 | "-M", | ||
1854 | "-f", | 1849 | "-f", |
1855 | "-m", "1024", | 1850 | "-m", "1024", |
1856 | "-c", "1", | 1851 | "-c", "1", |