ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/checkrusage.ext
(Generate patch)

Comparing deliantra/server/ext/checkrusage.ext (file contents):
Revision 1.6 by root, Tue May 4 21:45:42 2010 UTC vs.
Revision 1.7 by root, Fri May 14 22:56:47 2010 UTC

8 8
9our $STAT_FH; 9our $STAT_FH;
10our $TIMER; 10our $TIMER;
11 11
12cf::post_init { 12cf::post_init {
13 cf::async_ext {
13 $STAT_FH = Coro::AIO::aio_open "/proc/self/stat", IO::AIO::O_RDONLY, 0 14 $STAT_FH = Coro::AIO::aio_open "/proc/self/stat", IO::AIO::O_RDONLY, 0
14 or return; 15 or return;
15 16
16 $TIMER = cf::periodic 10, sub { 17 $TIMER = cf::periodic 10, sub {
17 sysseek $STAT_FH, 0, 0; 18 sysseek $STAT_FH, 0, 0;
18 sysread $STAT_FH, my $stat, 4096; # only a single line 19 sysread $STAT_FH, my $stat, 4096; # only a single line
19 my $vmsize = (split / /, $stat)[22]; 20 my $vmsize = (split / /, $stat)[22];
20 21
21 cf::cleanup "memory usage growing high, server would run out of memory soon", 0 22 cf::cleanup "memory usage growing high, server would run out of memory soon", 0
22 if $vmsize >= $MAX_VMSIZE; 23 if $vmsize >= $MAX_VMSIZE;
24 };
23 }; 25 };
24}; 26};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines