#!/usr/bin/perl use strict; use warnings; use FindBin qw/$Bin/; use Benchmark (qw/timediff timestr/); use Image::BMP; my $t0 = Benchmark->new(); my $img = new Image::BMP; my $t1 = Benchmark->new(); $img->open_file($Bin . '/a.bmp'); my $t2 = Benchmark->new(); my ($r1,$g1,$b1) = $img->xy_rgb(10,10); my $t3 = Benchmark->new(); my ($r2,$g2,$b2) = $img->xy_rgb(20,20); my $t4 = Benchmark->new(); my ($r3,$g3,$b3) = $img->xy_rgb(10,10); my $t5 = Benchmark->new(); my $td1 = timediff($t1, $t0); my $td2 = timediff($t2, $t1); my $td3 = timediff($t3, $t2); my $td4 = timediff($t4, $t3); my $td5 = timediff($t5, $t4); my $td10 = timediff($t5, $t0); print "the code 1 took:", timestr($td1),"\n"; print "the code 2 took:", timestr($td2),"\n"; print "the code 3 took:", timestr($td3),"\n"; print "the code 4 took:", timestr($td4),"\n"; print "the code 5 took:", timestr($td5),"\n"; print "the complete code took:", timestr($td10),"\n";