use insert function instead of for loop
[LibreOffice.git] / slideshow / qa / debug / timings.pl
blobf41181e43d469446d80f059d438b9e06327f6aaa
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 # This file is part of the LibreOffice project.
7 # This Source Code Form is subject to the terms of the Mozilla Public
8 # License, v. 2.0. If a copy of the MPL was not distributed with this
9 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # This file incorporates work covered by the following license notice:
13 # Licensed to the Apache Software Foundation (ASF) under one or more
14 # contributor license agreements. See the NOTICE file distributed
15 # with this work for additional information regarding copyright
16 # ownership. The ASF licenses this file to you under the Apache
17 # License, Version 2.0 (the "License"); you may not use this file
18 # except in compliance with the License. You may obtain a copy of
19 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 # POD Documentation
23 =head1 PROGRAM NAME AND AUTHOR
25 Timings
27 =head1 WHAT IT IS
29 Extract move effect timings from a verbose trace log of the
30 presentation engine. Generated is a gnuplot data file, which can be
31 displayed issuing a 'gnuplot <filename>' or at a gnuplot prompt, via
32 'load <filename>'.
34 To generate such a verbose log file, rebuild module canvas and module
35 slideshow with VERBOSE=t defined in the environment, and debug=t at
36 the build tool command line. Then run the presentation, and redirect
37 stdout to your log file.
39 Call me like this: timings.pl < trace-file > gnuplot-target
41 The whole point in doing this is to detect jerks in shape movements,
42 which manifest themselves clearly in the graphed gnuplot output. Note
43 that there's some heuristic to recognize when one effect ends and
44 another has started: If the time difference between two subsequent
45 page flipping times is more than one second, a new effect is assumed
46 and a new gnuplot data record is generated.
48 =head1 REQUIREMENTS
50 Perl 5
52 =cut
54 ##############################################################################
57 print "# Autogenerated by timings.pl, do not change\n",
58 "set ylabel \"position\"\n",
59 "set xlabel \"time\"\n",
60 "plot '-' index 0 using (\$1):(\$2) title \"Move effect position\" with lp\n",
61 "#0\n";
63 $state = 0;
64 $last_time = 0;
65 $record = 1;
67 while( <> )
69 if( $state == 0 && m|next position will be| )
71 ($posX) = m|.*\(([0-9]+.[0-9]+),|;
72 ($posY) = m|.*,([0-9]+.[0-9]+)\)|;
73 $state = 1;
75 elsif( $state == 1 && m|output pos is| )
77 $state = 2;
79 elsif( $state == 2 && m|flip done at| )
81 $state = 0;
82 ($flippingTime) = m|.*at ([0-9]+.[0-9]+)|;
84 if( $last_time != 0 )
86 if( $last_time + 1.0 < $flippingTime )
88 # new record
89 print "\n\n#", $record, "\n";
90 $record++;
94 $last_time = $flippingTime;
95 print $flippingTime, " ", $posX, " ", $posY, "\n";