Help for this page

Select Code to Download


  1. or download this
        use Proc::Governor();
    
    ...
            } );
            ...
        }
    
  2. or download this
        my $gov = Proc::Governor->new( {
            working     => 0,
    ...
            maxPercent  => 100,
            unsafe      => 0,
        } );
    
  3. or download this
         H   Q   Total
        50%  0%   50%
        40% 10%   50%
        30% 20%   50%
        25% 25%   50%
    
  4. or download this
        $gov->beginWork( $breathe );
    
  5. or download this
        $gov->endWork( $breathe );
    
  6. or download this
        $gov->work( sub {
            ... # Consume resources
        }, $which );
    
  7. or download this
        $gov->beginWork( $before );
        ... # Consume resources
        $gov->endWork( $after );
    
  8. or download this
        0   No pause will happen.
        1   A pause may happen before the sub reference is called.
        2   A pause may happen after the sub reference is called.
        3   A pause may happen before and/or after the sub is called.
    
  9. or download this
        my @a = $gov->work( sub { ...; get_list() }, $which );
        my $s = $gov->work( sub { ...; get_item() }, $which );
    
  10. or download this
        $gov->breathe( $begin );
    
  11. or download this
        $gov->breathe();
        # or
        $gov->breathe( 1 );
    
  12. or download this
        $gov->beginWork( 1 );
    
  13. or download this
        $gov->breathe( 0 );
    
  14. or download this
        $gov->pulse( $count, $begin );
    
  15. or download this
        my $gov = Proc::Governor->new( {
            maxPercent  => 70,
    ...
            $gov->pulse( 20 );
            $redis->...;
        }
    
  16. or download this
        ...
        my $count = 0;
    ...
                $count = 0;
            }
            ...
    
  17. or download this
        my $g_cpu = Proc::Governor->new( { maxPercent => 80 } );
        my $g_db =  Proc::Governor->new( { maxPercent => 30 } );
    ...
                $db->update_row( $upd );    # DB work
            } );
        }
    
  18. or download this
        sub handle_request {
            my( $req ) = @_;
    ...
            give_response( $res );
            $Gov->breathe( 0 );     # Pause here; still idle.
        }