You are here

function _memcache_admin_stats_average in Zircon Profile 8.0

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

Statistics report: calculate per-connection averages.

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

File

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

Code

function _memcache_admin_stats_average($stats) {
  if ($stats['total_connections'] == 0) {
    $get = 0;
    $set = 0;
    $read = 0;
    $write = 0;
  }
  else {
    $get = $stats['cmd_get'] / $stats['total_connections'];
    $set = $stats['cmd_set'] / $stats['total_connections'];
    $read = $stats['bytes_written'] / $stats['total_connections'];
    $write = $stats['bytes_read'] / $stats['total_connections'];
  }
  return t('!read in !get gets; !write in !set sets', array(
    '!get' => number_format($get, 2),
    '!set' => number_format($set, 2),
    '!read' => format_size(number_format($read, 2)),
    '!write' => format_size(number_format($write, 2)),
  ));
}