[PATCH 1/6] perf timechart: always try to print at least 15 tasks

From: Stanislav Fomichev
Date: Tue Oct 22 2013 - 06:57:26 EST


Always try to print at least 15 tasks no matter how long they run.
Add -n option to specify desired number of tasks to print.

Signed-off-by: Stanislav Fomichev <stfomichev@xxxxxxxxxxxxxx>
---
tools/perf/builtin-timechart.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index c2e02319347a..d965f26308ed 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -40,6 +40,8 @@
#define SUPPORT_OLD_POWER_EVENTS 1
#define PWR_EVENT_EXIT -1

+static int proc_num = 15;
+

static unsigned int numcpus;
static u64 min_freq; /* Lowest CPU frequency seen */
@@ -944,15 +946,17 @@ static void write_svg_file(const char *filename)
{
u64 i;
int count;
+ int thresh = TIME_THRESH;

numcpus++;


- count = determine_display_tasks(TIME_THRESH);
-
- /* We'd like to show at least 15 tasks; be less picky if we have fewer */
- if (count < 15)
- count = determine_display_tasks(TIME_THRESH / 10);
+ /* We'd like to show at least proc_num tasks;
+ * be less picky if we have fewer */
+ do {
+ count = determine_display_tasks(thresh);
+ thresh /= 10;
+ } while (thresh && count < proc_num);

open_svg(filename, numcpus, count, first_time, last_time);

@@ -963,9 +967,11 @@ static void write_svg_file(const char *filename)
svg_cpu_box(i, max_freq, turbo_frequency);

draw_cpu_usage();
- draw_process_bars();
+ if (proc_num)
+ draw_process_bars();
draw_c_p_states();
- draw_wakeups();
+ if (proc_num)
+ draw_wakeups();

svg_close();
}
@@ -1094,6 +1100,8 @@ int cmd_timechart(int argc, const char **argv,
parse_process),
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
"Look for files with symbols relative to this directory"),
+ OPT_INTEGER('n', "number", &proc_num,
+ "min. number of tasks to print"),
OPT_END()
};
const char * const timechart_usage[] = {
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/