aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc21
-rw-r--r--scripts/tracing/power.pl108
2 files changed, 16 insertions, 113 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index b52d340d759d..ea9f8a58678f 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1995,6 +1995,7 @@ sub process_file($) {
1995 my $identifier; 1995 my $identifier;
1996 my $func; 1996 my $func;
1997 my $descr; 1997 my $descr;
1998 my $in_purpose = 0;
1998 my $initial_section_counter = $section_counter; 1999 my $initial_section_counter = $section_counter;
1999 2000
2000 if (defined($ENV{'SRCTREE'})) { 2001 if (defined($ENV{'SRCTREE'})) {
@@ -2044,6 +2045,7 @@ sub process_file($) {
2044 $descr =~ s/\s*$//; 2045 $descr =~ s/\s*$//;
2045 $descr =~ s/\s+/ /; 2046 $descr =~ s/\s+/ /;
2046 $declaration_purpose = xml_escape($descr); 2047 $declaration_purpose = xml_escape($descr);
2048 $in_purpose = 1;
2047 } else { 2049 } else {
2048 $declaration_purpose = ""; 2050 $declaration_purpose = "";
2049 } 2051 }
@@ -2090,6 +2092,7 @@ sub process_file($) {
2090 } 2092 }
2091 2093
2092 $in_doc_sect = 1; 2094 $in_doc_sect = 1;
2095 $in_purpose = 0;
2093 $contents = $newcontents; 2096 $contents = $newcontents;
2094 if ($contents ne "") { 2097 if ($contents ne "") {
2095 while ((substr($contents, 0, 1) eq " ") || 2098 while ((substr($contents, 0, 1) eq " ") ||
@@ -2119,11 +2122,19 @@ sub process_file($) {
2119 } elsif (/$doc_content/) { 2122 } elsif (/$doc_content/) {
2120 # miguel-style comment kludge, look for blank lines after 2123 # miguel-style comment kludge, look for blank lines after
2121 # @parameter line to signify start of description 2124 # @parameter line to signify start of description
2122 if ($1 eq "" && 2125 if ($1 eq "") {
2123 ($section =~ m/^@/ || $section eq $section_context)) { 2126 if ($section =~ m/^@/ || $section eq $section_context) {
2124 dump_section($file, $section, xml_escape($contents)); 2127 dump_section($file, $section, xml_escape($contents));
2125 $section = $section_default; 2128 $section = $section_default;
2126 $contents = ""; 2129 $contents = "";
2130 } else {
2131 $contents .= "\n";
2132 }
2133 $in_purpose = 0;
2134 } elsif ($in_purpose == 1) {
2135 # Continued declaration purpose
2136 chomp($declaration_purpose);
2137 $declaration_purpose .= " " . xml_escape($1);
2127 } else { 2138 } else {
2128 $contents .= $1 . "\n"; 2139 $contents .= $1 . "\n";
2129 } 2140 }
diff --git a/scripts/tracing/power.pl b/scripts/tracing/power.pl
deleted file mode 100644
index 4f729b3501e0..000000000000
--- a/scripts/tracing/power.pl
+++ /dev/null
@@ -1,108 +0,0 @@
1#!/usr/bin/perl
2
3# Copyright 2008, Intel Corporation
4#
5# This file is part of the Linux kernel
6#
7# This program file is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by the
9# Free Software Foundation; version 2 of the License.
10#
11# This program is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program in a file named COPYING; if not, write to the
18# Free Software Foundation, Inc.,
19# 51 Franklin Street, Fifth Floor,
20# Boston, MA 02110-1301 USA
21#
22# Authors:
23# Arjan van de Ven <arjan@linux.intel.com>
24
25
26#
27# This script turns a cstate ftrace output into a SVG graphic that shows
28# historic C-state information
29#
30#
31# cat /sys/kernel/debug/tracing/trace | perl power.pl > out.svg
32#
33
34my @styles;
35my $base = 0;
36
37my @pstate_last;
38my @pstate_level;
39
40$styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
41$styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
42$styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
43$styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
44$styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
45$styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
46$styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
47$styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
48$styles[8] = "fill:rgb(0,25,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
49
50
51print "<?xml version=\"1.0\" standalone=\"no\"?> \n";
52print "<svg width=\"10000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";
53
54my $scale = 30000.0;
55while (<>) {
56 my $line = $_;
57 if ($line =~ /([0-9\.]+)\] CSTATE: Going to C([0-9]) on cpu ([0-9]+) for ([0-9\.]+)/) {
58 if ($base == 0) {
59 $base = $1;
60 }
61 my $time = $1 - $base;
62 $time = $time * $scale;
63 my $C = $2;
64 my $cpu = $3;
65 my $y = 400 * $cpu;
66 my $duration = $4 * $scale;
67 my $msec = int($4 * 100000)/100.0;
68 my $height = $C * 20;
69 $style = $styles[$C];
70
71 $y = $y + 140 - $height;
72
73 $x2 = $time + 4;
74 $y2 = $y + 4;
75
76
77 print "<rect x=\"$time\" width=\"$duration\" y=\"$y\" height=\"$height\" style=\"$style\"/>\n";
78 print "<text transform=\"translate($x2,$y2) rotate(90)\">C$C $msec</text>\n";
79 }
80 if ($line =~ /([0-9\.]+)\] PSTATE: Going to P([0-9]) on cpu ([0-9]+)/) {
81 my $time = $1 - $base;
82 my $state = $2;
83 my $cpu = $3;
84
85 if (defined($pstate_last[$cpu])) {
86 my $from = $pstate_last[$cpu];
87 my $oldstate = $pstate_state[$cpu];
88 my $duration = ($time-$from) * $scale;
89
90 $from = $from * $scale;
91 my $to = $from + $duration;
92 my $height = 140 - ($oldstate * (140/8));
93
94 my $y = 400 * $cpu + 200 + $height;
95 my $y2 = $y+4;
96 my $style = $styles[8];
97
98 print "<rect x=\"$from\" y=\"$y\" width=\"$duration\" height=\"5\" style=\"$style\"/>\n";
99 print "<text transform=\"translate($from,$y2)\">P$oldstate (cpu $cpu)</text>\n";
100 };
101
102 $pstate_last[$cpu] = $time;
103 $pstate_state[$cpu] = $state;
104 }
105}
106
107
108print "</svg>\n";