You are here

function _memcache_admin_stats_gets in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/memcache_admin/memcache_admin.module \_memcache_admin_stats_gets()

Statistics report: calculate # of get cmds, broken down by hits and misses.

1 call to _memcache_admin_stats_gets()
memcache_admin_stats in modules/memcache/memcache_admin/memcache_admin.module
Memcache Stats page

File

modules/memcache/memcache_admin/memcache_admin.module, line 149

Code

function _memcache_admin_stats_gets($stats) {
  if ($stats['cmd_set'] + $stats['cmd_get'] == 0) {
    $gets = 0;
  }
  else {
    $gets = $stats['cmd_get'] / ($stats['cmd_set'] + $stats['cmd_get']) * 100;
  }
  if (empty($stats['uptime'])) {
    $average = 0;
  }
  else {
    $average = $stats['cmd_get'] / $stats['uptime'];
  }
  return t('!average/s; !total gets (!gets%); !hit hits (!percent_hit%) !miss misses (!percent_miss%)', array(
    '!average' => number_format($average, 2),
    '!gets' => number_format($gets, 2),
    '!hit' => number_format($stats['get_hits']),
    '!percent_hit' => $stats['cmd_get'] > 0 ? number_format($stats['get_hits'] / $stats['cmd_get'] * 100, 2) : '0.00',
    '!miss' => number_format($stats['get_misses']),
    '!percent_miss' => $stats['cmd_get'] > 0 ? number_format($stats['get_misses'] / $stats['cmd_get'] * 100, 2) : '0.00',
    '!total' => number_format($stats['cmd_get']),
  ));
}