diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-05-21 03:50:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-05-21 03:50:09 -0400 |
commit | 1c34bde13a3cdcd4c7c6322f8052e67c2c91caf1 (patch) | |
tree | 3be33fd17c7b3101acb638771075cf6681334c36 /tools | |
parent | 915e555822629421d97f851c6b87bf4c314ed8c9 (diff) | |
parent | 5d06e6915b1b76653e6fe3369b0b18fdbf75f0a5 (diff) |
Merge branch 'perf' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 17 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 8 | ||||
-rw-r--r-- | tools/perf/perf.c | 25 | ||||
-rw-r--r-- | tools/perf/util/cache.h | 2 | ||||
-rw-r--r-- | tools/perf/util/newt.c | 9 |
5 files changed, 35 insertions, 26 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 66b8ecd22cfe..e67226981834 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -65,9 +65,6 @@ static bool multiplex = false; | |||
65 | static int multiplex_fd = -1; | 65 | static int multiplex_fd = -1; |
66 | 66 | ||
67 | static long samples = 0; | 67 | static long samples = 0; |
68 | static struct timeval last_read; | ||
69 | static struct timeval this_read; | ||
70 | |||
71 | static u64 bytes_written = 0; | 68 | static u64 bytes_written = 0; |
72 | 69 | ||
73 | static struct pollfd *event_array; | 70 | static struct pollfd *event_array; |
@@ -147,8 +144,6 @@ static void mmap_read(struct mmap_data *md) | |||
147 | void *buf; | 144 | void *buf; |
148 | int diff; | 145 | int diff; |
149 | 146 | ||
150 | gettimeofday(&this_read, NULL); | ||
151 | |||
152 | /* | 147 | /* |
153 | * If we're further behind than half the buffer, there's a chance | 148 | * If we're further behind than half the buffer, there's a chance |
154 | * the writer will bite our tail and mess up the samples under us. | 149 | * the writer will bite our tail and mess up the samples under us. |
@@ -159,23 +154,13 @@ static void mmap_read(struct mmap_data *md) | |||
159 | */ | 154 | */ |
160 | diff = head - old; | 155 | diff = head - old; |
161 | if (diff < 0) { | 156 | if (diff < 0) { |
162 | struct timeval iv; | 157 | fprintf(stderr, "WARNING: failed to keep up with mmap data\n"); |
163 | unsigned long msecs; | ||
164 | |||
165 | timersub(&this_read, &last_read, &iv); | ||
166 | msecs = iv.tv_sec*1000 + iv.tv_usec/1000; | ||
167 | |||
168 | fprintf(stderr, "WARNING: failed to keep up with mmap data." | ||
169 | " Last read %lu msecs ago.\n", msecs); | ||
170 | |||
171 | /* | 158 | /* |
172 | * head points to a known good entry, start there. | 159 | * head points to a known good entry, start there. |
173 | */ | 160 | */ |
174 | old = head; | 161 | old = head; |
175 | } | 162 | } |
176 | 163 | ||
177 | last_read = this_read; | ||
178 | |||
179 | if (old != head) | 164 | if (old != head) |
180 | samples++; | 165 | samples++; |
181 | 166 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 1d3c1003b43a..a7b8760e401c 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -116,7 +116,7 @@ static int perf_session__add_hist_entry(struct perf_session *self, | |||
116 | * so we don't allocated the extra space needed because the stdio | 116 | * so we don't allocated the extra space needed because the stdio |
117 | * code will not use it. | 117 | * code will not use it. |
118 | */ | 118 | */ |
119 | if (use_browser) | 119 | if (use_browser > 0) |
120 | err = hist_entry__inc_addr_samples(he, al->addr); | 120 | err = hist_entry__inc_addr_samples(he, al->addr); |
121 | out_free_syms: | 121 | out_free_syms: |
122 | free(syms); | 122 | free(syms); |
@@ -330,7 +330,7 @@ static int __cmd_report(void) | |||
330 | hists = rb_entry(next, struct hists, rb_node); | 330 | hists = rb_entry(next, struct hists, rb_node); |
331 | hists__collapse_resort(hists); | 331 | hists__collapse_resort(hists); |
332 | hists__output_resort(hists); | 332 | hists__output_resort(hists); |
333 | if (use_browser) | 333 | if (use_browser > 0) |
334 | hists__browse(hists, help, input_name); | 334 | hists__browse(hists, help, input_name); |
335 | else { | 335 | else { |
336 | const char *evname = NULL; | 336 | const char *evname = NULL; |
@@ -347,7 +347,7 @@ static int __cmd_report(void) | |||
347 | next = rb_next(&hists->rb_node); | 347 | next = rb_next(&hists->rb_node); |
348 | } | 348 | } |
349 | 349 | ||
350 | if (!use_browser && sort_order == default_sort_order && | 350 | if (use_browser <= 0 && sort_order == default_sort_order && |
351 | parent_pattern == default_parent_pattern) { | 351 | parent_pattern == default_parent_pattern) { |
352 | fprintf(stdout, "#\n# (%s)\n#\n", help); | 352 | fprintf(stdout, "#\n# (%s)\n#\n", help); |
353 | 353 | ||
@@ -491,7 +491,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) | |||
491 | * so don't allocate extra space that won't be used in the stdio | 491 | * so don't allocate extra space that won't be used in the stdio |
492 | * implementation. | 492 | * implementation. |
493 | */ | 493 | */ |
494 | if (use_browser) | 494 | if (use_browser > 0) |
495 | symbol_conf.priv_size = sizeof(struct sym_priv); | 495 | symbol_conf.priv_size = sizeof(struct sym_priv); |
496 | 496 | ||
497 | if (symbol__init() < 0) | 497 | if (symbol__init() < 0) |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 08e0e5d2b50e..6e4871191138 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -15,15 +15,15 @@ | |||
15 | #include "util/parse-events.h" | 15 | #include "util/parse-events.h" |
16 | #include "util/debugfs.h" | 16 | #include "util/debugfs.h" |
17 | 17 | ||
18 | bool use_browser; | ||
19 | |||
20 | const char perf_usage_string[] = | 18 | const char perf_usage_string[] = |
21 | "perf [--version] [--help] COMMAND [ARGS]"; | 19 | "perf [--version] [--help] COMMAND [ARGS]"; |
22 | 20 | ||
23 | const char perf_more_info_string[] = | 21 | const char perf_more_info_string[] = |
24 | "See 'perf help COMMAND' for more information on a specific command."; | 22 | "See 'perf help COMMAND' for more information on a specific command."; |
25 | 23 | ||
24 | int use_browser = -1; | ||
26 | static int use_pager = -1; | 25 | static int use_pager = -1; |
26 | |||
27 | struct pager_config { | 27 | struct pager_config { |
28 | const char *cmd; | 28 | const char *cmd; |
29 | int val; | 29 | int val; |
@@ -49,6 +49,24 @@ int check_pager_config(const char *cmd) | |||
49 | return c.val; | 49 | return c.val; |
50 | } | 50 | } |
51 | 51 | ||
52 | static int tui_command_config(const char *var, const char *value, void *data) | ||
53 | { | ||
54 | struct pager_config *c = data; | ||
55 | if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd)) | ||
56 | c->val = perf_config_bool(var, value); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | /* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */ | ||
61 | static int check_tui_config(const char *cmd) | ||
62 | { | ||
63 | struct pager_config c; | ||
64 | c.cmd = cmd; | ||
65 | c.val = -1; | ||
66 | perf_config(tui_command_config, &c); | ||
67 | return c.val; | ||
68 | } | ||
69 | |||
52 | static void commit_pager_choice(void) | 70 | static void commit_pager_choice(void) |
53 | { | 71 | { |
54 | switch (use_pager) { | 72 | switch (use_pager) { |
@@ -255,6 +273,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) | |||
255 | if (p->option & RUN_SETUP) | 273 | if (p->option & RUN_SETUP) |
256 | prefix = NULL; /* setup_perf_directory(); */ | 274 | prefix = NULL; /* setup_perf_directory(); */ |
257 | 275 | ||
276 | if (use_browser == -1) | ||
277 | use_browser = check_tui_config(p->cmd); | ||
278 | |||
258 | if (use_pager == -1 && p->option & RUN_SETUP) | 279 | if (use_pager == -1 && p->option & RUN_SETUP) |
259 | use_pager = check_pager_config(p->cmd); | 280 | use_pager = check_pager_config(p->cmd); |
260 | if (use_pager == -1 && p->option & USE_PAGER) | 281 | if (use_pager == -1 && p->option & USE_PAGER) |
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index 5eca52595b62..65fe664fddf6 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h | |||
@@ -30,7 +30,7 @@ extern const char *pager_program; | |||
30 | extern int pager_in_use(void); | 30 | extern int pager_in_use(void); |
31 | extern int pager_use_color; | 31 | extern int pager_use_color; |
32 | 32 | ||
33 | extern bool use_browser; | 33 | extern int use_browser; |
34 | 34 | ||
35 | #ifdef NO_NEWT_SUPPORT | 35 | #ifdef NO_NEWT_SUPPORT |
36 | static inline void setup_browser(void) | 36 | static inline void setup_browser(void) |
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index 051022eb5f43..0b45658f7497 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c | |||
@@ -1068,10 +1068,13 @@ static struct newtPercentTreeColors { | |||
1068 | void setup_browser(void) | 1068 | void setup_browser(void) |
1069 | { | 1069 | { |
1070 | struct newtPercentTreeColors *c = &defaultPercentTreeColors; | 1070 | struct newtPercentTreeColors *c = &defaultPercentTreeColors; |
1071 | if (!isatty(1)) | 1071 | |
1072 | if (!isatty(1) || !use_browser) { | ||
1073 | setup_pager(); | ||
1072 | return; | 1074 | return; |
1075 | } | ||
1073 | 1076 | ||
1074 | use_browser = true; | 1077 | use_browser = 1; |
1075 | newtInit(); | 1078 | newtInit(); |
1076 | newtCls(); | 1079 | newtCls(); |
1077 | ui_helpline__puts(" "); | 1080 | ui_helpline__puts(" "); |
@@ -1084,7 +1087,7 @@ void setup_browser(void) | |||
1084 | 1087 | ||
1085 | void exit_browser(bool wait_for_ok) | 1088 | void exit_browser(bool wait_for_ok) |
1086 | { | 1089 | { |
1087 | if (use_browser) { | 1090 | if (use_browser > 0) { |
1088 | if (wait_for_ok) { | 1091 | if (wait_for_ok) { |
1089 | char title[] = "Fatal Error", ok[] = "Ok"; | 1092 | char title[] = "Fatal Error", ok[] = "Ok"; |
1090 | newtWinMessage(title, ok, browser__last_msg); | 1093 | newtWinMessage(title, ok, browser__last_msg); |