xref: /trunk/main/slideshow/qa/debug/timings.pl (revision bb113e63)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3    if 0;
4# *************************************************************
5#
6#  Licensed to the Apache Software Foundation (ASF) under one
7#  or more contributor license agreements.  See the NOTICE file
8#  distributed with this work for additional information
9#  regarding copyright ownership.  The ASF licenses this file
10#  to you under the Apache License, Version 2.0 (the
11#  "License"); you may not use this file except in compliance
12#  with the License.  You may obtain a copy of the License at
13#
14#    http://www.apache.org/licenses/LICENSE-2.0
15#
16#  Unless required by applicable law or agreed to in writing,
17#  software distributed under the License is distributed on an
18#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19#  KIND, either express or implied.  See the License for the
20#  specific language governing permissions and limitations
21#  under the License.
22#
23# *************************************************************
24# POD Documentation
25
26=head1 PROGRAM NAME AND AUTHOR
27
28Timings - $Revision: 1.2 $
29Last changes: $Author: rt $ $Date: 2004-11-26 18:43:32 $
30
31=head1 WHAT IT IS
32
33Extract move effect timings from a verbose trace log of the
34presentation engine. Generated is a gnuplot data file, which can be
35displayed issuing a 'gnuplot <filename>' or at a gnuplot prompt, via
36'load <filename>'.
37
38To generate such a verbose log file, rebuild module canvas and module
39slideshow with VERBOSE=t defined in the environment, and debug=t at
40the build tool command line. Then run the presentation, and redirect
41stdout to your log file.
42
43Call me like this: timings.pl < trace-file > gnuplot-target
44
45The whole point in doing this is to detect jerks in shape movements,
46which manifest themselves clearly in the graphed gnuplot output. Note
47that there's some heuristic to recognize when one effect ends and
48another has started: If the time difference between two subsequent
49page flipping times is more than one second, a new effect is assumed
50and a new gnuplot data record is generated.
51
52=head1 REQUIREMENTS
53
54Perl 5
55
56=cut
57
58##############################################################################
59#
60
61print "# Autogenerated by timings.pl, do not change\n",
62      "set ylabel \"position\"\n",
63	  "set xlabel \"time\"\n",
64      "plot '-' index 0 using (\$1):(\$2) title \"Move effect position\" with lp\n",
65	  "#0\n";
66
67$state = 0;
68$last_time = 0;
69$record = 1;
70
71while( <> )
72{
73	if( $state == 0 && m|next position will be| )
74	{
75		($posX) = m|.*\(([0-9]+.[0-9]+),|;
76		($posY) = m|.*,([0-9]+.[0-9]+)\)|;
77		$state = 1;
78	}
79	elsif( $state == 1 && m|output pos is| )
80	{
81		$state = 2;
82	}
83	elsif( $state == 2 && m|flip done at| )
84	{
85		$state = 0;
86		($flippingTime) = m|.*at ([0-9]+.[0-9]+)|;
87
88		if( $last_time != 0 )
89		{
90			if( $last_time + 1.0 < $flippingTime )
91			{
92				# new record
93				print "\n\n#", $record, "\n";
94				$record++;
95			}
96		}
97
98		$last_time = $flippingTime;
99		print $flippingTime, " ", $posX, " ", $posY, "\n";
100	}
101}
102