/[Sack]/trunk/lib/Sack/Node.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Sack/Node.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 92 by dpavlin, Sat Oct 3 21:09:51 2009 UTC revision 99 by dpavlin, Sun Oct 4 14:42:35 2009 UTC
# Line 8  use File::Slurp; Line 8  use File::Slurp;
8  use Carp qw(confess);  use Carp qw(confess);
9  use Data::Dump qw(dump);  use Data::Dump qw(dump);
10  use Storable;  use Storable;
11    use Time::HiRes qw(time);
12    
13    
14  sub new {  sub new {
# Line 39  sub new { Line 40  sub new {
40          while ( 1 ) {          while ( 1 ) {
41    
42                  my $data = Storable::fd_retrieve( $client );                  my $data = Storable::fd_retrieve( $client );
43                  warn "[$port] <<<< ", dump keys %$data;                  warn "[$port] <<<<\n";
44                    warn "[$port] data = ", dump( $data ) if $self->{debug};
45    
46                  my $result;                  my $result;
47    
# Line 62  sub new { Line 64  sub new {
64    
65  }  }
66    
67    
68  our $rec;  our $rec;
69  our $out;  our $out;
70    
# Line 71  sub view { Line 74  sub view {
74          undef $out;          undef $out;
75    
76          my $affected = 0;          my $affected = 0;
77          $self->report_start;          my $start_t = time;
78    
79          my $coderef = eval "sub { $code }";          my $coderef = eval "sub { $code }";
80          if ( $@ ) {          if ( $@ ) {
# Line 81  sub view { Line 84  sub view {
84    
85    
86          foreach my $pos ( 0 .. $#{ $self->{data} } ) {          foreach my $pos ( 0 .. $#{ $self->{data} } ) {
87                  $rec = $self->{data}->{$pos};                  $rec = $self->{data}->[$pos];
88                  if ( ! $rec ) {                  if ( ! $rec ) {
89                          print STDERR "END @ $pos";                          print STDERR "END @ $pos";
90                          last;                          last;
# Line 99  sub view { Line 102  sub view {
102                  $pos % 1000  == 0 ? print STDERR "."  : 0 ;                  $pos % 1000  == 0 ? print STDERR "."  : 0 ;
103          };          };
104    
105          $self->report( "$affected affected" );          my $dt = time - $start_t;
106            my $report = [ $self->{port}, $affected, $dt, scalar $self->{data} / $dt ];
107            warn sprintf "[%d] %d affected in %1.4fs %.2f/s\n", @$report;
108    
109    #       warn "# out ", dump( $out );
110    
111            return $out;
112  }  }
113    
114  1;  1;

Legend:
Removed from v.92  
changed lines
  Added in v.99

  ViewVC Help
Powered by ViewVC 1.1.26