aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-timechart.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-timechart.c')
-rw-r--r--tools/perf/builtin-timechart.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 4405681b3134..e8a510d935e5 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -46,6 +46,8 @@ static u64 turbo_frequency;
46 46
47static u64 first_time, last_time; 47static u64 first_time, last_time;
48 48
49static int power_only;
50
49 51
50static struct perf_header *header; 52static struct perf_header *header;
51 53
@@ -547,7 +549,7 @@ static void end_sample_processing(void)
547 u64 cpu; 549 u64 cpu;
548 struct power_event *pwr; 550 struct power_event *pwr;
549 551
550 for (cpu = 0; cpu < numcpus; cpu++) { 552 for (cpu = 0; cpu <= numcpus; cpu++) {
551 pwr = malloc(sizeof(struct power_event)); 553 pwr = malloc(sizeof(struct power_event));
552 if (!pwr) 554 if (!pwr)
553 return; 555 return;
@@ -763,19 +765,40 @@ static void draw_wakeups(void)
763 if (c->Y && c->start_time <= we->time && c->end_time >= we->time) { 765 if (c->Y && c->start_time <= we->time && c->end_time >= we->time) {
764 if (p->pid == we->waker) { 766 if (p->pid == we->waker) {
765 from = c->Y; 767 from = c->Y;
766 task_from = c->comm; 768 task_from = strdup(c->comm);
767 } 769 }
768 if (p->pid == we->wakee) { 770 if (p->pid == we->wakee) {
769 to = c->Y; 771 to = c->Y;
770 task_to = c->comm; 772 task_to = strdup(c->comm);
771 } 773 }
772 } 774 }
773 c = c->next; 775 c = c->next;
774 } 776 }
777 c = p->all;
778 while (c) {
779 if (p->pid == we->waker && !from) {
780 from = c->Y;
781 task_from = strdup(c->comm);
782 }
783 if (p->pid == we->wakee && !to) {
784 to = c->Y;
785 task_to = strdup(c->comm);
786 }
787 c = c->next;
788 }
775 } 789 }
776 p = p->next; 790 p = p->next;
777 } 791 }
778 792
793 if (!task_from) {
794 task_from = malloc(40);
795 sprintf(task_from, "[%i]", we->waker);
796 }
797 if (!task_to) {
798 task_to = malloc(40);
799 sprintf(task_to, "[%i]", we->wakee);
800 }
801
779 if (we->waker == -1) 802 if (we->waker == -1)
780 svg_interrupt(we->time, to); 803 svg_interrupt(we->time, to);
781 else if (from && to && abs(from - to) == 1) 804 else if (from && to && abs(from - to) == 1)
@@ -783,6 +806,9 @@ static void draw_wakeups(void)
783 else 806 else
784 svg_partial_wakeline(we->time, from, task_from, to, task_to); 807 svg_partial_wakeline(we->time, from, task_from, to, task_to);
785 we = we->next; 808 we = we->next;
809
810 free(task_from);
811 free(task_to);
786 } 812 }
787} 813}
788 814
@@ -871,7 +897,7 @@ static int determine_display_tasks(u64 threshold)
871 /* no exit marker, task kept running to the end */ 897 /* no exit marker, task kept running to the end */
872 if (p->end_time == 0) 898 if (p->end_time == 0)
873 p->end_time = last_time; 899 p->end_time = last_time;
874 if (p->total_time >= threshold) 900 if (p->total_time >= threshold && !power_only)
875 p->display = 1; 901 p->display = 1;
876 902
877 c = p->all; 903 c = p->all;
@@ -882,7 +908,7 @@ static int determine_display_tasks(u64 threshold)
882 if (c->start_time == 1) 908 if (c->start_time == 1)
883 c->start_time = first_time; 909 c->start_time = first_time;
884 910
885 if (c->total_time >= threshold) { 911 if (c->total_time >= threshold && !power_only) {
886 c->display = 1; 912 c->display = 1;
887 count++; 913 count++;
888 } 914 }
@@ -1134,6 +1160,8 @@ static const struct option options[] = {
1134 "output file name"), 1160 "output file name"),
1135 OPT_INTEGER('w', "width", &svg_page_width, 1161 OPT_INTEGER('w', "width", &svg_page_width,
1136 "page width"), 1162 "page width"),
1163 OPT_BOOLEAN('p', "power-only", &power_only,
1164 "output power data only"),
1137 OPT_END() 1165 OPT_END()
1138}; 1166};
1139 1167