You are here

function _memcache_admin_stats_sets in Zircon Profile 8.0

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

Statistics report: calculate # of set cmds and total cmds.

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

File

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

Code

function _memcache_admin_stats_sets($stats) {
  if ($stats['cmd_set'] + $stats['cmd_get'] == 0) {
    $sets = 0;
  }
  else {
    $sets = $stats['cmd_set'] / ($stats['cmd_set'] + $stats['cmd_get']) * 100;
  }
  if (empty($stats['uptime'])) {
    $average = 0;
  }
  else {
    $average = $sets / $stats['uptime'];
  }
  return t('!average/s; !set sets (!sets%) of !total commands', array(
    '!average' => number_format($average, 2),
    '!sets' => number_format($sets, 2),
    '!set' => number_format($stats['cmd_set']),
    '!total' => number_format($stats['cmd_set'] + $stats['cmd_get']),
  ));
}