summaryrefslogtreecommitdiffstats
path: root/slideshow/qa/debug/timings.pl
blob: f41181e43d469446d80f059d438b9e06327f6aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
:
eval 'exec perl -wS $0 ${1+"$@"}'
    if 0;
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
#   Licensed to the Apache Software Foundation (ASF) under one or more
#   contributor license agreements. See the NOTICE file distributed
#   with this work for additional information regarding copyright
#   ownership. The ASF licenses this file to you under the Apache
#   License, Version 2.0 (the "License"); you may not use this file
#   except in compliance with the License. You may obtain a copy of
#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
# POD Documentation

=head1 PROGRAM NAME AND AUTHOR

Timings

=head1 WHAT IT IS

Extract move effect timings from a verbose trace log of the
presentation engine. Generated is a gnuplot data file, which can be
displayed issuing a 'gnuplot <filename>' or at a gnuplot prompt, via
'load <filename>'.

To generate such a verbose log file, rebuild module canvas and module
slideshow with VERBOSE=t defined in the environment, and debug=t at
the build tool command line. Then run the presentation, and redirect
stdout to your log file.

Call me like this: timings.pl < trace-file > gnuplot-target

The whole point in doing this is to detect jerks in shape movements,
which manifest themselves clearly in the graphed gnuplot output. Note
that there's some heuristic to recognize when one effect ends and
another has started: If the time difference between two subsequent
page flipping times is more than one second, a new effect is assumed
and a new gnuplot data record is generated.

=head1 REQUIREMENTS

Perl 5

=cut

##############################################################################
#

print "# Autogenerated by timings.pl, do not change\n",
      "set ylabel \"position\"\n",
      "set xlabel \"time\"\n",
      "plot '-' index 0 using (\$1):(\$2) title \"Move effect position\" with lp\n",
      "#0\n";

$state = 0;
$last_time = 0;
$record = 1;

while( <> )
{
    if( $state == 0 && m|next position will be| )
    {
        ($posX) = m|.*\(([0-9]+.[0-9]+),|;
        ($posY) = m|.*,([0-9]+.[0-9]+)\)|;
        $state = 1;
    }
    elsif( $state == 1 && m|output pos is| )
    {
        $state = 2;
    }
    elsif( $state == 2 && m|flip done at| )
    {
        $state = 0;
        ($flippingTime) = m|.*at ([0-9]+.[0-9]+)|;

        if( $last_time != 0 )
        {
            if( $last_time + 1.0 < $flippingTime )
            {
                # new record
                print "\n\n#", $record, "\n";
                $record++;
            }
        }

        $last_time = $flippingTime;
        print $flippingTime, " ", $posX, " ", $posY, "\n";
    }
}