Skip to content

Commit

Permalink
Merge pull request #43 from fgm/wpc19-mem_requested-1-5-17
Browse files Browse the repository at this point in the history
Issue #19: fix mem_requested key change in Memcached 1.5.17
  • Loading branch information
cfoellmann authored Apr 7, 2020
2 parents ff73f5f + 44b154a commit 87c3060
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Library/Data/Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,17 @@ public static function slabs($slabs)
$slabs['used_slabs']++;
}
$slabs[$id]['request_rate'] = sprintf('%.1f', ($slab['get_hits'] + $slab['cmd_set'] + $slab['delete_hits'] + $slab['cas_hits'] + $slab['cas_badval'] + $slab['incr_hits'] + $slab['decr_hits']) / $slabs['uptime'], 1);
$slabs[$id]['mem_wasted'] = (($slab['total_chunks'] * $slab['chunk_size']) < $slab['mem_requested']) ?(($slab['total_chunks'] - $slab['used_chunks']) * $slab['chunk_size']):(($slab['total_chunks'] * $slab['chunk_size']) - $slab['mem_requested']);
$requested = isset($slab['items:mem_requested']) // Post Memcached 1.5.17
? $slab['items:mem_requested']
: (isset($slab['mem_requested']) ? $slab['mem_requested'] : 0);
$slabs[$id]['mem_wasted'] = (($slab['total_chunks'] * $slab['chunk_size']) < $requested)
? (($slab['total_chunks'] - $slab['used_chunks']) * $slab['chunk_size'])
: (($slab['total_chunks'] * $slab['chunk_size']) - $requested);
$slabs['total_wasted'] += $slabs[$id]['mem_wasted'];
}
}

# Cheking server total malloced > 0
# Checking server total malloced > 0
if(!isset($slabs['total_malloced']))
{
$slabs['total_malloced'] = 0;
Expand Down Expand Up @@ -348,4 +353,4 @@ public static function hitResize($value)
}
return sprintf('%.0f%s', $value, $unit);
}
}
}

0 comments on commit 87c3060

Please sign in to comment.