I want to track memory usage when starting a program in perl, so if the memory used by the current program is more than a threshold, I use approach A, otherwise I use approach B.
Does anyone have any ideas?
I found this script from http://www.perlmonks.org/?node_id=235757 :
#!/usr/bin/perl use Proc::ProcessTable; sub memory_usage { my $t = new Proc::ProcessTable; foreach my $got ( @{$t->table} ) { next if not $got->pid eq $$; return $got->size; } } print 'memory: '. memory_usage()/1024/1024 ."\n";
. Linux CPAN Sys::Statistics::Linux, /proc . , Solaris, Solaris::Procfs. Windows.
Sys::Statistics::Linux
/proc
Solaris::Procfs
. Solaris, Solaris::Procfs.
GTop, - . mod_perl .
GTop
mod_perl
Source: https://habr.com/ru/post/1759400/More articles:Android Swipe left or right? - androidChecking a palindrome string in c - cPerl: error installing CPAN module - installationImplementing the IM platform in Java - javagrid in mathematics - wolfram-mathematicaRunning lists in project management - project-managementProblems sending large files through Ruby TCPServer - ruby | fooobar.comBest place to hide private keys? - securityHow to change file resolution for all files in an S3 bucket using aws-s3 or right_aws gem - ruby | fooobar.comIncreased download speed of large files - performanceAll Articles