Created
May 12, 2011 17:49
-
-
Save umiyosh/969057 to your computer and use it in GitHub Desktop.
firefox memory checker for windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#must need cygwin enviroment and Win Growl | |
#install : | |
#$ cygrunsrv --install "firefox mem checker" --path /home/$(whoami)/bin/warnmem_firefox.pl --args 600000 | |
#uninstall : | |
#$ cygrunsrv --remove "firefox mem checker" | |
use strict; | |
use warnings; | |
use Growl::Any; | |
use constant INTERVAL => 60; #unit is sec | |
use constant THRESHOLD => $ARGV[0] || 600000 ; #unit is Kbyte | |
my $growl = Growl::Any->new; | |
$growl->register( "firefox Memory checker", ["perfcheck"] ); | |
while (1) { | |
my @ret = qx /tasklist/; | |
@ret = grep /firefox/, @ret; | |
if (@ret) { | |
my $ret = ${ [ split / +/, $ret[0] ] }[4]; | |
$ret =~ s/,//g; | |
if ( $ret > THRESHOLD ) { | |
chomp $ret; | |
my $msg = | |
sprintf | |
"WARN memory :current memory = %s Kbyte , THRESHOLD is %s Kbyte", | |
$ret, THRESHOLD; | |
$growl->notify( "perfcheck", 'WARN:Firefox Memory size too large',$msg ); | |
} | |
} | |
sleep INTERVAL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment