Hoa central
Memory.php
Go to the documentation of this file.
1 <?php
2 
37 namespace {
38 
39 from('Hoa')
40 
41 
44 -> import('Memory.Exception');
45 
46 }
47 
48 namespace Hoa\Memory {
49 
60 class Memory {
61 
72  public static function getUsage ( $realUsage = false ) {
73 
74  return memory_get_usage($realUsage);
75  }
76 
87  public static function getPeakUsage ( $realUsage = false ) {
88 
89  return memory_get_peak_usage($realUsage);
90  }
91 
101  public static function setLimit ( $size) {
102 
103  return ini_set('memory_limit', $size);
104  }
105 
112  public static function getLimit ( ) {
113 
114  return ini_get('memory_limit');
115  }
116 
148  public static function getRUsage ( $who = 0 ) {
149 
150  if(OS_WIN)
151  throw new Exception(
152  'Cannot get the current resource usages on Windows.', 0);
153 
154  return getrusage($who);
155  }
156 }
157 
158 }
159 
160 namespace {
161 
165 Hoa\Core\Consistency::flexEntity('Hoa\Memory\Memory');
166 
167 }
static getPeakUsage($realUsage=false)
Definition: Memory.php:87
static getUsage($realUsage=false)
Definition: Memory.php:72
static getRUsage($who=0)
Definition: Memory.php:148
static setLimit($size)
Definition: Memory.php:101
static getLimit()
Definition: Memory.php:112