File: after_leak

package info (click to toggle)
perl-tk 1%3A800.025-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,444 kB
  • ctags: 19,081
  • sloc: ansic: 206,740; perl: 40,187; makefile: 4,371; sh: 2,373; yacc: 762
file content (30 lines) | stat: -rwxr-xr-x 678 bytes parent folder | download | duplicates (2)
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
#!/usr/local/bin/perl -w

use Tk;
use Devel::Leak;

$count = 0;

sub flash_widget 
{
 my($w, $option, $val1, $val2, $interval) = @_;
 $w->configure($option => $val1);
 $w->after($interval, [\&flash_widget, $w, $option, $val2, $val1, $interval] );
 $count++;
} # end flash_widget

$mw = MainWindow->new;
$b = $mw->Button(-text => 'Flash', -bg => 'azure');
$b->pack;
flash_widget $b, -background, 'azure', 'yellow', 1000;
$mw->update;
print STDERR "Before ",$start = Devel::Leak::NoteSV($hook),"\n";
$count = 0;
#MainLoop;
while ($count < 100)
 {
  Tk::DoOneEvent(0);
 }
print STDERR "After  ",$end = Devel::Leak::CheckSV($hook),"\n";

print "Average ",($end-$start)/$count,"\n";