swapout: Use random 1MB to avoid RAM compression.
This commit is contained in:
parent
1209cfbbb8
commit
b1bb72c63b
10
drac/drac
10
drac/drac
|
@ -17,7 +17,7 @@ B<drac> [[I<user>[:I<password>]@]I<host>]
|
|||
iDRAC6 uses a Java program to show the virtual console.
|
||||
|
||||
From the iDRAC6 B<drac> downloads the .jar file that is used to
|
||||
connect to the iDRAC6's virtual console. Then it runs it with Java.
|
||||
connect to the virtual console of iDRAC6. Then it runs it with Java.
|
||||
|
||||
|
||||
=head1 OPTIONS
|
||||
|
@ -92,12 +92,12 @@ B<drac> uses B<java>.
|
|||
|
||||
B<java>
|
||||
|
||||
'
|
||||
=cut
|
||||
|
||||
read host user passwd < <(echo "$1" |
|
||||
# parse [[user[:pass]@]host]
|
||||
perl -pe 's/^(?:(.*?)(?::(.*?))?@)?(.*?)$/$3 $1 $2/')
|
||||
|
||||
# Set default values
|
||||
if [ "$user" = "" ] ; then
|
||||
DRAC_USER=${DRAC_USER:-root}
|
||||
else
|
||||
|
@ -114,8 +114,9 @@ else
|
|||
DRAC_HOST="$host"
|
||||
fi
|
||||
|
||||
tmp=`tempfile`
|
||||
tmp=$(tempfile)
|
||||
|
||||
# Find a command line tool to download with
|
||||
get=$(
|
||||
(lynx -source /dev/null && echo lynx -source) ||
|
||||
(fetch -o /dev/null file:///bin/sh && echo fetch -o -) ||
|
||||
|
@ -124,6 +125,7 @@ get=$(
|
|||
echo 'No lynx, wget, curl, fetch: Please file a bug report with which tool you use for downloading URLs' >&2
|
||||
)
|
||||
|
||||
# Use http instead of https to avoid dealing with self signed cert
|
||||
$get http://"$DRAC_HOST"/software/avctKVM.jar > "$tmp"
|
||||
|
||||
(
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
$timeout = shift || 10;
|
||||
use strict;
|
||||
|
||||
my $timeout = shift || 10;
|
||||
|
||||
my $giga = 2**30;
|
||||
my $forks = 1;
|
||||
|
@ -11,10 +13,13 @@ my $memtotal = int(
|
|||
qx{ awk '/^(MemTotal):/ { sum += \$2} END { print sum }' /proc/meminfo }
|
||||
/ 1024);
|
||||
|
||||
$total = 1;
|
||||
$onemb = "x"x1048576;
|
||||
my $total = 1;
|
||||
|
||||
# 1 MB random data so it is not compressed
|
||||
my $onemb = pack("L*", map { rand(2**32) } 1..(2**18));
|
||||
my ($missing, $sofar,$timediff, %buf, $pid,$shift);
|
||||
do {
|
||||
$start = time;
|
||||
my $start = time;
|
||||
$free = int (
|
||||
qx{ awk '/^((Swap)?Cached|MemFree|Buffers):/ { sum += \$2} END { print sum }' /proc/meminfo }
|
||||
/ 1024);
|
||||
|
@ -26,7 +31,8 @@ do{
|
|||
$total += int($free/100);
|
||||
$missing = $total - $sofar;
|
||||
for(1..$missing) {
|
||||
$buf{$forks}{$total}{$_} = $onemb;
|
||||
# Shift every block 1 byte, so no blocks have the same content
|
||||
$buf{$forks}{$total}{$_} = "x"x(++$shift) . $onemb;
|
||||
}
|
||||
$sofar = $total;
|
||||
$timediff = time - $start;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/perl
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
=pod
|
||||
|
||||
|
@ -44,8 +44,8 @@ Instead of overwriting I<file>, append to I<file>.
|
|||
|
||||
=head1 EXAMPLES
|
||||
|
||||
(sleep 0.5; echo After 0.5s; sleep 1.5; echo After 2s) | teetime myfile
|
||||
(sleep 0.5; echo After 2.5s; sleep 1.5; echo After 4s) | teetime -a myfile
|
||||
(sleep 0.5; echo After 0.5s; sleep 1.5) | teetime myfile
|
||||
(sleep 0.5; echo After 2.5s; sleep 1.5) | teetime -a myfile
|
||||
teetime -i myfile
|
||||
|
||||
=head1 AUTHOR
|
||||
|
@ -84,6 +84,8 @@ B<tee>
|
|||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
sub now {
|
||||
|
@ -110,18 +112,19 @@ sub readstdin {
|
|||
my $rin = '';
|
||||
my $in;
|
||||
my $twogb = 2**31;
|
||||
my ($read, $time, $delta);
|
||||
open(my $fh, ($opt::append ? ">>" : ">"), $file) || die;
|
||||
|
||||
vec($rin, fileno(STDIN), 1) = 1;
|
||||
while(1) {
|
||||
select($rin,undef,undef,undef);
|
||||
if(sysread(STDIN,$in,$twogb)) {
|
||||
my $time = now();
|
||||
my $delta = $time - $last_time;
|
||||
$read = sysread(STDIN,$in,$twogb);
|
||||
$time = now();
|
||||
$delta = $time - $last_time;
|
||||
print $fh pack("L*",$delta,length $in),$in;
|
||||
print STDOUT $in;
|
||||
$last_time = $time;
|
||||
} else {
|
||||
if(not $read) {
|
||||
# Select says there is something to read,
|
||||
# but there is not => eof
|
||||
last;
|
||||
|
@ -136,7 +139,7 @@ sub readfile {
|
|||
while(1) {
|
||||
my $in;
|
||||
if(sysread($fh,$in,8)) {
|
||||
($delta,$length) = unpack("L*",$in);
|
||||
my ($delta,$length) = unpack("L*",$in);
|
||||
select(undef,undef,undef,$delta/1000);
|
||||
sysread($fh,$in,$length);
|
||||
print $in;
|
||||
|
@ -179,6 +182,15 @@ sub help() {
|
|||
"",);
|
||||
}
|
||||
|
||||
sub debug {
|
||||
$opt::D or return;
|
||||
@_ = grep { defined $_ ? $_ : "" } @_;
|
||||
if($opt::D eq "all" or $opt::D eq $_[0]) {
|
||||
print @_[1..$#_];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$|=1;
|
||||
$Global::progname = "teetime";
|
||||
$Global::version = "20200721";
|
||||
|
|
|
@ -32,7 +32,7 @@ Contact Ole Tange <ole@tange.dk>.
|
|||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2012 Ole Tange <ole@tange.dk>.
|
||||
Copyright (C) 2014-2020 Ole Tange <ole@tange.dk>.
|
||||
|
||||
|
||||
=head1 LICENSE
|
||||
|
@ -65,6 +65,7 @@ B<ssh>(1)
|
|||
=cut
|
||||
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure("bundling","require_order");
|
||||
|
||||
my @argv = @ARGV;
|
||||
get_options_from_array(\@ARGV,[]);
|
||||
|
|
Loading…
Reference in a new issue