ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
memcachestat.php File Reference

Go to the source code of this file.

Functions

 tdate ($input)
 
 hours ($input)
 
 humanreadable ($input)
 

Variables

 $config = SimpleSAML_Configuration::getInstance()
 
 $formats
 
 $statsraw = SimpleSAML_Memcache::getStats()
 
 $stats = $statsraw
 
foreach($stats AS $key=> &$entry) $t = new SimpleSAML_XHTML_Template($config, 'memcacheMonitor:memcachestat.tpl.php')
 
 $rowTitles
 
$t data ['title'] = 'Memcache stats'
 
$t data ['rowtitles'] = $rowTitles
 
$t data ['table'] = $stats
 
$t data ['statsraw'] = $statsraw
 

Function Documentation

◆ hours()

hours (   $input)

Definition at line 7 of file memcachestat.php.

7 {
8 if ($input < 60) return number_format($input, 2) . ' sec';
9 if ($input < 60*60) return number_format(($input/60),2) . ' min';
10 if ($input < 24*60*60) return number_format(($input/(60*60)),2) . ' hours';
11 return number_format($input/(24*60*60),2) . ' days';
12
13}

Referenced by ilDurationInputGUI\setHours().

+ Here is the caller graph for this function:

◆ humanreadable()

humanreadable (   $input)

Definition at line 16 of file memcachestat.php.

16 {
17
18 $output = "";
19 $input = abs($input);
20
21 if ($input >= (1024*1024*1024*1024*1024*1024*1024*100)) {
22 $output = sprintf("%5ldEi", $input / (1024*1024*1024*1024*1024*1024) );
23 } else if ($input >= (1024*1024*1024*1024*1024*1024*10)) {
24 $output = sprintf("%5.1fEi", $input / (1024.0*1024.0*1024.0*1024.0*1024.0*1024.0) );
25 } else if ($input >= (1024*1024*1024*1024*1024*1024)) {
26 $output = sprintf("%5.2fEi", $input / (1024.0*1024.0*1024.0*1024.0*1024.0*1024.0) );
27
28
29 } else if ($input >= (1024*1024*1024*1024*1024*100)) {
30 $output = sprintf("%5ldPi", $input / (1024*1024*1024*1024*1024) );
31 } else if ($input >= (1024*1024*1024*1024*1024*10)) {
32 $output = sprintf("%5.1fPi", $input / (1024.0*1024.0*1024.0*1024.0*1024.0) );
33 } else if ($input >= (1024*1024*1024*1024*1024)) {
34 $output = sprintf("%5.2fPi", $input / (1024.0*1024.0*1024.0*1024.0*1024.0) );
35
36 } else if ($input >= (1024*1024*1024*1024*100)) {
37 $output = sprintf("%5ldTi", $input / (1024*1024*1024*1024) );
38 } else if ($input >= (1024*1024*1024*1024*10)) {
39 $output = sprintf("%5.1fTi", $input / (1024.0*1024.0*1024.0*1024.0) );
40 } else if ($input >= (1024*1024*1024*1024)) {
41 $output = sprintf("%5.2fTi", $input / (1024.0*1024.0*1024.0*1024.0) );
42
43
44 } else if ($input >= (1024*1024*1024*100)) {
45 $output = sprintf("%5ldGi", $input / (1024*1024*1024) );
46 } else if ($input >= (1024*1024*1024*10)) {
47 $output = sprintf("%5.1fGi", $input / (1024.0*1024.0*1024.0) );
48 } else if ($input >= (1024*1024*1024)) {
49 $output = sprintf("%5.2fGi", $input / (1024.0*1024.0*1024.0) );
50
51 } else if ($input >= (1024*1024*100)) {
52 $output = sprintf("%5ldMi", $input / (1024*1024) );
53 } else if ($input >= (1024*1024*10)) {
54 $output = sprintf("%5.1fM", $input / (1024.0*1024.0) );
55 } else if ($input >= (1024*1024)) {
56 $output = sprintf("%5.2fMi", $input / (1024.0*1024.0) );
57
58 } else if ($input >= (1024 * 100)) {
59 $output = sprintf("%5ldKi", $input / (1024) );
60 } else if ($input >= (1024 * 10)) {
61 $output = sprintf("%5.1fKi", $input / 1024.0 );
62 } else if ($input >= (1024)) {
63 $output = sprintf("%5.2fKi", $input / 1024.0 );
64
65 } else {
66 $output = sprintf("%5ld", $input );
67 }
68
69 return $output;
70}
71
72
73
74
76
77// Make sure that the user has admin access rights
79
80
81$formats = array(
82 'bytes' => 'humanreadable',
83 'bytes_read' => 'humanreadable',
84 'bytes_written' => 'humanreadable',
85 'limit_maxbytes' => 'humanreadable',
86 'time' => 'tdate',
87 'uptime' => 'hours',
88);
89
91
93
94foreach($stats AS $key => &$entry) {
95 if (array_key_exists($key, $formats)) {
96 $func = $formats[$key];
97 foreach($entry AS $k => $val) {
98 $entry[$k] = $func($val);
99 }
100 }
101
102}
sprintf('%.4f', $callTime)
static requireAdmin()
Require admin access to the current page.
Definition: Auth.php:60
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
static getStats()
This function retrieves statistics about all memcache server groups.
Definition: Memcache.php:455
$key
Definition: croninfo.php:18
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$formats
$config
$statsraw
$stats

References $output, and sprintf.

◆ tdate()

tdate (   $input)

Definition at line 3 of file memcachestat.php.

3 {
4 return date(DATE_RFC822, $input);
5}
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

References date.

Variable Documentation

◆ $config

Definition at line 75 of file memcachestat.php.

◆ $formats

$formats
Initial value:
= array(
'bytes' => 'humanreadable',
'bytes_read' => 'humanreadable',
'bytes_written' => 'humanreadable',
'limit_maxbytes' => 'humanreadable',
'time' => 'tdate',
'uptime' => 'hours',
)

Definition at line 81 of file memcachestat.php.

◆ $rowTitles

$rowTitles

Definition at line 105 of file memcachestat.php.

◆ $stats

$stats = $statsraw

Definition at line 92 of file memcachestat.php.

◆ $statsraw

Definition at line 90 of file memcachestat.php.

◆ $t

foreach ( $stats AS $key=> & $entry) $t = new SimpleSAML_XHTML_Template($config, 'memcacheMonitor:memcachestat.tpl.php')

Definition at line 104 of file memcachestat.php.

◆ data [1/4]

$t data[ 'rowtitles'] = $rowTitles

Definition at line 156 of file memcachestat.php.

◆ data [2/4]

$t data[ 'statsraw'] = $statsraw

Definition at line 158 of file memcachestat.php.

◆ data [3/4]

$t data[ 'table'] = $stats

Definition at line 157 of file memcachestat.php.

◆ data [4/4]

$t data[ 'title'] = 'Memcache stats'

Definition at line 155 of file memcachestat.php.