#!/usr/bin/perl use strict; use warnings; use HTML::Entities; my $min_pixel_spacing = 3; my $textheight = 10; my %timings; while (<>) { $timings{$1} = $2 if /(\d+\.\d+) access\("MARK: (.*)", F_OK\) = -1 ENOENT/; } my $lowest = 0; my $min_gap = 0; my $prev = 0; for (sort keys %timings) { $lowest = $_ unless $lowest; $min_gap = $_-$prev if $prev && (($_-$prev)<$min_gap || !$min_gap); $prev = $_; } my $highest = $prev; my $seconds_per_pixel = $min_gap/$min_pixel_spacing; my $wordsheight = $textheight * scalar(keys %timings); my $height; if ($wordsheight > ($highest-$lowest)/$seconds_per_pixel) { $height = $wordsheight; $seconds_per_pixel = ($highest-$lowest) / $wordsheight; } else { $height = ($highest-$lowest)/$seconds_per_pixel; } my $wy = 0; sub guess_width { my ($text) = $_; return length($text)*($textheight*0.66); } my $width = 0; for (values %timings) { my $textwidth = guess_width($_); $width = $textwidth if $textwidth > $width; } $width += 300; # text starts at 300 my $seconds = int($highest - $lowest)+1; print ""; print "\n"; print "\n"; if ($seconds>1) { print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; } for (sort keys %timings) { $wy += $textheight; my $py = ($_-$lowest) / $seconds_per_pixel; print "\n"; print "\n"; print "".decode_entities($timings{$_})."\n"; print "\n"; } if ($seconds > 1) { my $second_height = 1/$seconds_per_pixel; for (my $i=0; $i<$seconds; $i++) { print "\n"; print " \n"; print " ".$i+1."s\n"; print "\n"; } } print "\n";