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