]> git.karo-electronics.de Git - linux-beck.git/blobdiff - tools/perf/builtin-timechart.c
Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile...
[linux-beck.git] / tools / perf / builtin-timechart.c
index 58d737ec8f5ebdcedfa0b5c9fa6218b86d502239..702d8fe58fbcd43152f1083c3e171b46a1abd48f 100644 (file)
@@ -46,6 +46,8 @@ static u64            turbo_frequency;
 
 static u64             first_time, last_time;
 
+static int             power_only;
+
 
 static struct perf_header      *header;
 
@@ -547,7 +549,7 @@ static void end_sample_processing(void)
        u64 cpu;
        struct power_event *pwr;
 
-       for (cpu = 0; cpu < numcpus; cpu++) {
+       for (cpu = 0; cpu <= numcpus; cpu++) {
                pwr = malloc(sizeof(struct power_event));
                if (!pwr)
                        return;
@@ -752,6 +754,7 @@ static void draw_wakeups(void)
        we = wake_events;
        while (we) {
                int from = 0, to = 0;
+               char *task_from = NULL, *task_to = NULL;
 
                /* locate the column of the waker and wakee */
                p = all_data;
@@ -760,10 +763,14 @@ static void draw_wakeups(void)
                                c = p->all;
                                while (c) {
                                        if (c->Y && c->start_time <= we->time && c->end_time >= we->time) {
-                                               if (p->pid == we->waker)
+                                               if (p->pid == we->waker) {
                                                        from = c->Y;
-                                               if (p->pid == we->wakee)
+                                                       task_from = c->comm;
+                                               }
+                                               if (p->pid == we->wakee) {
                                                        to = c->Y;
+                                                       task_to = c->comm;
+                                               }
                                        }
                                        c = c->next;
                                }
@@ -776,7 +783,7 @@ static void draw_wakeups(void)
                else if (from && to && abs(from - to) == 1)
                        svg_wakeline(we->time, from, to);
                else
-                       svg_partial_wakeline(we->time, from, to);
+                       svg_partial_wakeline(we->time, from, task_from, to, task_to);
                we = we->next;
        }
 }
@@ -822,15 +829,15 @@ static void draw_process_bars(void)
                                continue;
                        }
 
-                       svg_box(Y, p->start_time, p->end_time, "process");
+                       svg_box(Y, c->start_time, c->end_time, "process");
                        sample = c->samples;
                        while (sample) {
                                if (sample->type == TYPE_RUNNING)
-                                       svg_sample(Y, sample->cpu, sample->start_time, sample->end_time, "sample");
+                                       svg_sample(Y, sample->cpu, sample->start_time, sample->end_time);
                                if (sample->type == TYPE_BLOCKED)
                                        svg_box(Y, sample->start_time, sample->end_time, "blocked");
                                if (sample->type == TYPE_WAITING)
-                                       svg_box(Y, sample->start_time, sample->end_time, "waiting");
+                                       svg_waiting(Y, sample->start_time, sample->end_time);
                                sample = sample->next;
                        }
 
@@ -866,7 +873,7 @@ static int determine_display_tasks(u64 threshold)
                /* no exit marker, task kept running to the end */
                if (p->end_time == 0)
                        p->end_time = last_time;
-               if (p->total_time >= threshold)
+               if (p->total_time >= threshold && !power_only)
                        p->display = 1;
 
                c = p->all;
@@ -877,7 +884,7 @@ static int determine_display_tasks(u64 threshold)
                        if (c->start_time == 1)
                                c->start_time = first_time;
 
-                       if (c->total_time >= threshold) {
+                       if (c->total_time >= threshold && !power_only) {
                                c->display = 1;
                                count++;
                        }
@@ -910,9 +917,9 @@ static void write_svg_file(const char *filename)
        if (count < 15)
                count = determine_display_tasks(TIME_THRESH / 10);
 
-       open_svg(filename, numcpus, count);
+       open_svg(filename, numcpus, count, first_time, last_time);
 
-       svg_time_grid(first_time, last_time);
+       svg_time_grid();
        svg_legenda();
 
        for (i = 0; i < numcpus; i++)
@@ -932,21 +939,21 @@ process_event(event_t *event)
 
        switch (event->header.type) {
 
-       case PERF_EVENT_COMM:
+       case PERF_RECORD_COMM:
                return process_comm_event(event);
-       case PERF_EVENT_FORK:
+       case PERF_RECORD_FORK:
                return process_fork_event(event);
-       case PERF_EVENT_EXIT:
+       case PERF_RECORD_EXIT:
                return process_exit_event(event);
-       case PERF_EVENT_SAMPLE:
+       case PERF_RECORD_SAMPLE:
                return queue_sample_event(event);
 
        /*
         * We dont process them right now but they are fine:
         */
-       case PERF_EVENT_MMAP:
-       case PERF_EVENT_THROTTLE:
-       case PERF_EVENT_UNTHROTTLE:
+       case PERF_RECORD_MMAP:
+       case PERF_RECORD_THROTTLE:
+       case PERF_RECORD_UNTHROTTLE:
                return 0;
 
        default:
@@ -1127,6 +1134,10 @@ static const struct option options[] = {
                    "input file name"),
        OPT_STRING('o', "output", &output_name, "file",
                    "output file name"),
+       OPT_INTEGER('w', "width", &svg_page_width,
+                   "page width"),
+       OPT_BOOLEAN('p', "power-only", &power_only,
+                   "output power data only"),
        OPT_END()
 };