You are here

function _memcache_admin_stats_average in Memcache API and Integration 6

Same name and namespace in other branches
  1. 7 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 memcache_admin/memcache_admin.module
Memcahe Stats page

File

memcache_admin/memcache_admin.module, line 191

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)),
  ));
}