skmezanul / memcache-top

Automatically exported from code.google.com/p/memcache-top
0 stars 0 forks source link

Illegal division by zero using cumulativeand a flushed memcached instance #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start memcache and start memcached-top with --cumulative
2. Flush memcached
3. You get the error

What is the expected output? What do you see instead?

Not to fail.

Received this: Illegal division by zero at ./memcache-top line 285.

What version of the product are you using? On what operating system?

v0.6

Please provide any additional information below.

This happens with single or multiple instances monitoring.

Original issue reported on code.google.com by luislavena on 8 Jul 2010 at 11:37

GoogleCodeExporter commented 8 years ago
Yup, I really need to fix this.  I haven't had much time recently w/ the way 
work has gone, but if I get the chance I'd like to do some major cleanups - 
including fixing this.  Let's see how the next few weeks go.

Original comment by nicholas...@gmail.com on 7 Nov 2010 at 1:34

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This hasn't been touched in a long while, I see. 
This could fix it at line 285.

It's a useful tool!

WAS:
        $outstats{cache_hit} = ( $stats{get_hits} / $stats{cmd_get} ) * 100;

FIXED WITH:
      if ( $stats{cmd_get} == 0 ) { 
        $outstats{cache_hit} = 100;
      } else {
        $outstats{cache_hit} = ( $stats{get_hits} / $stats{cmd_get} ) * 100;
      }

Original comment by Duranlea...@gmail.com on 28 May 2015 at 5:36