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