| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
use Tk; |
| 4 |
use Devel::Leak; |
| 5 |
|
| 6 |
$count = 0; |
| 7 |
|
| 8 |
sub flash_widget |
| 9 |
{ |
| 10 |
my($w, $option, $val1, $val2, $interval) = @_; |
| 11 |
$w->configure($option => $val1); |
| 12 |
$w->after($interval, [\&flash_widget, $w, $option, $val2, $val1, $interval] ); |
| 13 |
$count++; |
| 14 |
} # end flash_widget |
| 15 |
|
| 16 |
$mw = MainWindow->new; |
| 17 |
$b = $mw->Button(-text => 'Flash', -bg => 'azure'); |
| 18 |
$b->pack; |
| 19 |
flash_widget $b, -background, 'azure', 'yellow', 40; |
| 20 |
$mw->update; |
| 21 |
print STDERR "Before ",$start = Devel::Leak::NoteSV($hook),"\n"; |
| 22 |
$count = 0; |
| 23 |
#MainLoop; |
| 24 |
while ($count < 100) |
| 25 |
{ |
| 26 |
Tk::DoOneEvent(0); |
| 27 |
} |
| 28 |
print STDERR "After ",$end = Devel::Leak::CheckSV($hook),"\n"; |
| 29 |
|
| 30 |
print "Average ",($end-$start)/$count,"\n"; |