/[Sack]/trunk/lib/Sack/View.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/View.pm

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

revision 102 by dpavlin, Mon Oct 5 20:31:28 2009 UTC revision 116 by dpavlin, Tue Oct 6 00:07:05 2009 UTC
# Line 13  use Time::HiRes qw(time); Line 13  use Time::HiRes qw(time);
13  use lib 'lib';  use lib 'lib';
14  use Sack::Color;  use Sack::Color;
15    
16    our $VERSION = '0.07';
17    
18  sub new {  sub new {
19          my $class = shift;          my $class = shift;
20          my $port = shift;          my $port = shift;
# Line 33  sub new { Line 35  sub new {
35                  Reuse     => 1,                  Reuse     => 1,
36          ) or die "[$port] die $!";          ) or die "[$port] die $!";
37    
38          warn "[$port] accept\n";          warn "[$port] accept $VERSION\n";
39    
40          my $client = $sock->accept();          my $client = $sock->accept();
41    
# Line 48  sub new { Line 50  sub new {
50                  my $result;                  my $result;
51    
52                  if ( $data->{view} ) {                  if ( $data->{view} ) {
53                          $result = { view => $self->view( $data->{view} ) };                          $result = $self->view( $data->{view} );
54                  } elsif ( $data->{data} ) {                  } elsif ( $data->{data} ) {
55                          $self->{data} = delete $data->{data};                          $self->{data} = delete $data->{data};
56                          $result = { data => 'loaded' };                          $result = { data => 'loaded', version => $VERSION };
57                  } elsif ( $data->{exit} ) {                  } elsif ( $data->{exit} ) {
58                          warn "[$port] exit";                          warn "[$port] exit";
59                          exit;                          exit;
# Line 105  sub view { Line 107  sub view {
107          };          };
108    
109          my $dt = time - $start_t;          my $dt = time - $start_t;
110          my $report = [ $self->{port}, $affected, $dt, scalar $self->{data} / $dt ];          my $report = [ $self->{port}, $affected, $dt, $affected / $dt ];
111          warn sprintf "[%d] %d affected in %1.4fs %.2f/s\n", @$report;          warn sprintf "[%d] %d affected in %1.4fs %.2f/s\n", @$report;
112    
113  #       warn "# out ", dump( $out );  #       warn "# out ", dump( $out );
114    
115          return $out;          return {
116                    out => $out,
117                    report => $report,
118                    version => $VERSION,
119            };
120  }  }
121    
122  1;  1;

Legend:
Removed from v.102  
changed lines
  Added in v.116

  ViewVC Help
Powered by ViewVC 1.1.26