# # calculate the average, avoiding any division by zero traps # my $avg_cpu_load = $total_cpu_load ? $total_cpu_load / $active_pid_num + : 0 ;
I'd think if you want to avoid division by zero, you'd need to check the denominator for zero-ness rather than the numerator. That is:
my $avg_cpu_load = $active_pid_num ? $total_cpu_load / $active_pid_num + : 0;
Or am I misunderstanding something here?
In reply to Re: Measuring MySQL resources consumption on Linux
by kyle
in thread Measuring MySQL resources consumption on Linux
by gmax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |