← Index
NYTProf Performance Profile   « line view »
For webmerge/scripts/webmerge.pl
  Run on Mon Oct 7 02:42:42 2013
Reported on Mon Oct 7 03:03:19 2013

Filename/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/OCBNET/Spritesets/Fit.pm
StatementsExecuted 12943 statements in 114ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1211307ms91.2sOCBNET::Spritesets::Fit::::layoutOCBNET::Spritesets::Fit::layout
11183µs185µsOCBNET::Spritesets::Fit::::BEGIN@11OCBNET::Spritesets::Fit::BEGIN@11
11158µs92µsOCBNET::Spritesets::Fit::::BEGIN@12OCBNET::Spritesets::Fit::BEGIN@12
11152µs489µsOCBNET::Spritesets::Fit::::BEGIN@17OCBNET::Spritesets::Fit::BEGIN@17
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1###################################################################################################
2# Copyright 2013 by Marcel Greter
3# This file is part of Webmerge (GPL3)
4###################################################################################################
5# this is a block where all sprites get fitted in
6# the smallest available space (see packing module)
7####################################################################################################
8package OCBNET::Spritesets::Fit;
9####################################################################################################
10
112178µs2287µs
# spent 185µs (83+102) within OCBNET::Spritesets::Fit::BEGIN@11 which was called: # once (83µs+102µs) by OCBNET::Spritesets::BEGIN@30 at line 11
use strict;
# spent 185µs making 1 call to OCBNET::Spritesets::Fit::BEGIN@11 # spent 102µs making 1 call to strict::import
122166µs2126µs
# spent 92µs (58+34) within OCBNET::Spritesets::Fit::BEGIN@12 which was called: # once (58µs+34µs) by OCBNET::Spritesets::BEGIN@30 at line 12
use warnings;
# spent 92µs making 1 call to OCBNET::Spritesets::Fit::BEGIN@12 # spent 34µs making 1 call to warnings::import
13
14####################################################################################################
15
16# a container is also a block
172933µs2926µs
# spent 489µs (52+437) within OCBNET::Spritesets::Fit::BEGIN@17 which was called: # once (52µs+437µs) by OCBNET::Spritesets::BEGIN@30 at line 17
use base 'OCBNET::Spritesets::Container';
# spent 489µs making 1 call to OCBNET::Spritesets::Fit::BEGIN@17 # spent 437µs making 1 call to base::import
18
19####################################################################################################
20
21# calculate positions and dimensions
22# ******************************************************************************
23sub layout
24
# spent 91.2s (307ms+90.9) within OCBNET::Spritesets::Fit::layout which was called 12 times, avg 7.60s/call: # 12 times (307ms+90.9s) by OCBNET::Spritesets::Canvas::Layout::layout at line 108 of webmerge/scripts/modules/OCBNET/Spritesets/Canvas/Layout.pm, avg 7.60s/call
{
25
26 # get our object
271237µs my ($self) = @_;
28
29 # do nothing if empty
3012138µs12154µs return if $self->empty;
# spent 154µs making 12 calls to OCBNET::Spritesets::Container::empty, avg 13µs/call
31
3212381µs123.57s $self->SUPER::layout;
# spent 3.57s making 12 calls to OCBNET::Spritesets::Container::layout, avg 297ms/call
33
34 # create the packer object for composition
3512346µs12218µs my $packer = new OCBNET::Packer::2D;
# spent 218µs making 12 calls to OCBNET::Packer::2D::new, avg 18µs/call
36
37 # fit the rectangles/images
3812164µs1287.3s $packer->fit($self->{'children'});
# spent 87.3s making 12 calls to OCBNET::Packer::2D::fit, avg 7.27s/call
39
40 # get the dimensions for the image and store on block
4112259µs12187µs $self->width = $packer->{'root'}->{'width'};
# spent 187µs making 12 calls to OCBNET::Spritesets::Block::width, avg 16µs/call
4212176µs12144µs $self->height = $packer->{'root'}->{'height'};
# spent 144µs making 12 calls to OCBNET::Spritesets::Block::height, avg 12µs/call
43
44 # process and update rectangles/images
4512118µs foreach my $sprite (@{$self->{'children'}})
46 {
47
48 # this should never happen, but catch anyway
49 # we optimize the input so this should be impossible
50427610.4ms die "fatal: sprite could not be fitted" unless $sprite->{'fit'};
51
52 # update the positions for the sprites
53427644.0ms427642.2ms $sprite->top = $sprite->{'fit'}->{'y'};
# spent 42.2ms making 4276 calls to OCBNET::Spritesets::Block::top, avg 10µs/call
54427655.5ms427640.0ms $sprite->left = $sprite->{'fit'}->{'x'};
# spent 40.0ms making 4276 calls to OCBNET::Spritesets::Block::left, avg 9µs/call
55
56 }
57 # EO each sprite
58
59 # return instance
60121.30ms return $self;
61
62}
63# EO sub layout
64
65####################################################################################################
66####################################################################################################
67112µs1;