- or download this
use Proc::Governor();
...
} );
...
}
- or download this
my $gov = Proc::Governor->new( {
working => 0,
...
maxPercent => 100,
unsafe => 0,
} );
- or download this
H Q Total
50% 0% 50%
40% 10% 50%
30% 20% 50%
25% 25% 50%
- or download this
$gov->beginWork( $breathe );
- or download this
$gov->endWork( $breathe );
- or download this
$gov->work( sub {
... # Consume resources
}, $which );
- or download this
$gov->beginWork( $before );
... # Consume resources
$gov->endWork( $after );
- 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.
- or download this
my @a = $gov->work( sub { ...; get_list() }, $which );
my $s = $gov->work( sub { ...; get_item() }, $which );
- or download this
$gov->breathe( $begin );
- or download this
$gov->breathe();
# or
$gov->breathe( 1 );
- or download this
$gov->beginWork( 1 );
- or download this
$gov->breathe( 0 );
- or download this
$gov->pulse( $count, $begin );
- or download this
my $gov = Proc::Governor->new( {
maxPercent => 70,
...
$gov->pulse( 20 );
$redis->...;
}
- or download this
...
my $count = 0;
...
$count = 0;
}
...
- 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
} );
}
- or download this
sub handle_request {
my( $req ) = @_;
...
give_response( $res );
$Gov->breathe( 0 ); # Pause here; still idle.
}