Yes, do not cross-post please.
This was a hidden catch, just to see if you will get my example verbatim. Why I did that ? If you want to run such script, means you have root priviledges, means someone at your organization trust you, means you're not supposed to be a simple user.
I would also assume that the server you're running has only apache there, hence you want to switch it off when high load is determined. If not, how you can be sure that this is the application that causes the problem ?
In regards to the script - see "man test" for more information. Of course you can compare integer to integer, but bash doesn't have good handling of floating points generated from uptime. Therefore there are few solutions :
using awk in this manner :
or using the korn shell, as it has floating point arithmetic since 1993.
I won't write more code, please, try think to about it, and be a real admin, not a user.
Regards and no bad feelings.
we have an unix system which has
load average normally about 20.
but while i am running a particular unix batch which performs heavy
operations on filesystem and database average load
reduces to 15.
how can we explain this situation?
while running that batch idle cpu time is about %60-65... (0 Replies)
Hello all, I have a question about load averages.
I've read the man pages for the uptime and w command for two or three different flavors of Unix (Red Hat, Tru64, Solaris). All of them agree that in the output of the 2 aforementioned commands, you are given the load average for the box, but... (3 Replies)
Hello, Here is the output of top command. My understanding here is,
the load average 0.03 in last 1 min, 0.02 is in last 5 min, 0.00 is in last 15 min.
By seeing this load average, When can we say that, the system load averge is too high?
When can we say that, load average is medium/low??... (8 Replies)
Hi,
i have installed solaris 10 on t-5120 sparc enterprise.
I am little surprised to see load average of 2 or around on this OS.
when checked with ps command following process is using highest CPU. looks like it is running for long time and does not want to stop, but I do not know... (5 Replies)
Hello AlL,..
I want from experts to help me as my load average is increased and i dont know where is the problem !!
this is my top result :
root@a4s # top
top - 11:30:38 up 40 min, 1 user, load average: 3.06, 2.49, 4.66
Mem: 8168788k total, 2889596k used, 5279192k free, 47792k... (3 Replies)
Hi ,
I am using 48 CPU sunOS server at my work.
The application has facility to check the current load average before starting a new process to control the load.
Right now it is configured as 48. So it does mean that each CPU can take maximum one proces and no processe is waiting.
... (2 Replies)
Hi,
On load average graph, unit is 100m, 200m, 300...800m.
I don't understand what it means.
Thx for helping (3 Replies)
Discussion started by: Michenux
3 Replies
LEARN ABOUT SUSE
integer
integer(3pm) Perl Programmers Reference Guide integer(3pm)NAME
integer - Perl pragma to use integer arithmetic instead of floating point
SYNOPSIS
use integer;
$x = 10/3;
# $x is now 3, not 3.33333333333333333
DESCRIPTION
This tells the compiler to use integer operations from here to the end of the enclosing BLOCK. On many machines, this doesn't matter a
great deal for most computations, but on those without floating point hardware, it can make a big difference in performance.
Note that this only affects how most of the arithmetic and relational operators handle their operands and results, and not how all numbers
everywhere are treated. Specifically, "use integer;" has the effect that before computing the results of the arithmetic operators (+, -,
*, /, %, +=, -=, *=, /=, %=, and unary minus), the comparison operators (<, <=, >, >=, ==, !=, <=>), and the bitwise operators (|, &, ^,
<<, >>, |=, &=, ^=, <<=, >>=), the operands have their fractional portions truncated (or floored), and the result will have its fractional
portion truncated as well. In addition, the range of operands and results is restricted to that of familiar two's complement integers,
i.e., -(2**31) .. (2**31-1) on 32-bit architectures, and -(2**63) .. (2**63-1) on 64-bit architectures. For example, this code
use integer;
$x = 5.8;
$y = 2.5;
$z = 2.7;
$a = 2**31 - 1; # Largest positive integer on 32-bit machines
$, = ", ";
print $x, -$x, $x + $y, $x - $y, $x / $y, $x * $y, $y == $z, $a, $a + 1;
will print: 5.8, -5, 7, 3, 2, 10, 1, 2147483647, -2147483648
Note that $x is still printed as having its true non-integer value of 5.8 since it wasn't operated on. And note too the wrap-around from
the largest positive integer to the largest negative one. Also, arguments passed to functions and the values returned by them are not
affected by "use integer;". E.g.,
srand(1.5);
$, = ", ";
print sin(.5), cos(.5), atan2(1,2), sqrt(2), rand(10);
will give the same result with or without "use integer;" The power operator "**" is also not affected, so that 2 ** .5 is always the
square root of 2. Now, it so happens that the pre- and post- increment and decrement operators, ++ and --, are not affected by "use
integer;" either. Some may rightly consider this to be a bug -- but at least it's a long-standing one.
Finally, "use integer;" also has an additional affect on the bitwise operators. Normally, the operands and results are treated as unsigned
integers, but with "use integer;" the operands and results are signed. This means, among other things, that ~0 is -1, and -2 & -5 is -6.
Internally, native integer arithmetic (as provided by your C compiler) is used. This means that Perl's own semantics for arithmetic
operations may not be preserved. One common source of trouble is the modulus of negative numbers, which Perl does one way, but your
hardware may do another.
% perl -le 'print (4 % -3)'
-2
% perl -Minteger -le 'print (4 % -3)'
1
See "Pragmatic Modules" in perlmodlib, "Integer Arithmetic" in perlop
perl v5.12.1 2010-04-26 integer(3pm)