parallel: --memfree now uses /proc/meminfo for GNU/Linux.

This commit is contained in:
Ole Tange 2015-08-13 21:41:35 +02:00
parent 2e6a701f96
commit eebaad1731
2 changed files with 17 additions and 6 deletions

View file

@ -224,6 +224,8 @@ Haiku of the month:
New in this release: New in this release:
* @arg can now be used in {= =}: parallel echo '{= $arg[2] < 5 and $_="j" =}' ::: 1 2 3 ::: 4 5 6
* Version of GNU Parallel that uses PostgreSQL as backend https://github.com/stephen-fralich/parallel-sql/ * Version of GNU Parallel that uses PostgreSQL as backend https://github.com/stephen-fralich/parallel-sql/
* <<Har angiveligt submittet ny version - afventer opdatering>> GNU Parallel was used (unfortunately without citation) in: MUGBAS: a species free gene-based programme suite for post-GWAS analysis http://www.ncbi.nlm.nih.gov/pubmed/25765345 * <<Har angiveligt submittet ny version - afventer opdatering>> GNU Parallel was used (unfortunately without citation) in: MUGBAS: a species free gene-based programme suite for post-GWAS analysis http://www.ncbi.nlm.nih.gov/pubmed/25765345
@ -238,6 +240,12 @@ New in this release:
* Who actually reads the code? http://www.fsf.org/blogs/community/who-actually-reads-the-code * Who actually reads the code? http://www.fsf.org/blogs/community/who-actually-reads-the-code
* Introduction to GNU Parallel http://erictleung.com/2015/08/06/intro-to-gnu-parallel/
* ¿Alguien se lee el código? http://www.taringa.net/post/linux/18854759/Alguien-se-lee-el-codigo.html
* ¿Quién se lee el código fuente? https://victorhckinthefreeworld.wordpress.com/2015/08/12/quien-se-lee-el-codigo-fuente/
* Distribution des traitements avec GNU Parallel http://blog.inovia-conseil.fr/?p=226#4 * Distribution des traitements avec GNU Parallel http://blog.inovia-conseil.fr/?p=226#4
* Эксперимент по проверке, читают ли код открытых проектов http://www.opennet.ru/opennews/art.shtml?num=42718 * Эксперимент по проверке, читают ли код открытых проектов http://www.opennet.ru/opennews/art.shtml?num=42718

View file

@ -4172,6 +4172,9 @@ sub memfree_recompute {
# TODO add sshlogin and backgrounding # TODO add sshlogin and backgrounding
$self->{'memfree'} = qx{ $script }; $self->{'memfree'} = qx{ $script };
if(not $self->{'memfree'}) {
::die_bug("Less than 1 byte free");
}
#::debug("mem","New free:",$self->{'memfree'}," "); #::debug("mem","New free:",$self->{'memfree'}," ");
} }
@ -4183,12 +4186,12 @@ sub memfree_recompute {
# shellscript for giving available memory in bytes # shellscript for giving available memory in bytes
if(not $script) { if(not $script) {
my %script_of = ( my %script_of = (
# $ free # /proc/meminfo
# total used free shared buffers cached # MemFree: 7012 kB
# Mem: 8075152 4922780 3152372 338856 233356 1658604 # Buffers: 19876 kB
# -/+ buffers/cache: 3030820 5044332 # Cached: 431192 kB
# Swap: 8286204 116924 8169280 # SwapCached: 0 kB
"linux" => q{ print (1024*((grep /buffers.cache/, `free`)[0] =~ /buffers.cache:\s+\S+\s+(\S+)/)[0]) }, "linux" => q{ print 1024 * qx{ awk '/^((Swap)?Cached|MemFree|Buffers):/ { sum += \$2} END { print sum }' /proc/meminfo } },
# $ vmstat 1 1 # $ vmstat 1 1
# procs memory page faults cpu # procs memory page faults cpu
# r b w avm free re at pi po fr de sr in sy cs us sy id # r b w avm free re at pi po fr de sr in sy cs us sy id