Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2018-08-01 00:48:07 +0300
committerGitHub <noreply@github.com>2018-08-01 00:48:07 +0300
commit6cb6548c19a93b3c9c173d6bb9c1a9f68835f252 (patch)
treeba39c77ddd6cd53f19cfd26e8fa5e8605f391b3d /core/Timer.php
parent8210ff8e201f9635dbdc2e9bde63c11f169fbd83 (diff)
Add some simple profiling output to core:archive command (#13215)
* Initial code to gather performance measurements across processes. * Get proof of concept to work. * couple tweaks * Modified to use a custom log file instead of option table. * add peak memory value
Diffstat (limited to 'core/Timer.php')
-rw-r--r--core/Timer.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/core/Timer.php b/core/Timer.php
index 3aea3db1b9..835b1659bc 100644
--- a/core/Timer.php
+++ b/core/Timer.php
@@ -61,7 +61,23 @@ class Timer
*/
public function getMemoryLeak()
{
- return "Memory delta: " . $this->formatter->getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart);
+ return "Memory delta: " . $this->getMemoryLeakValue();
+ }
+
+ /**
+ * @return string
+ */
+ public function getMemoryLeakValue()
+ {
+ return $this->formatter->getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart);
+ }
+
+ /**
+ * @return string
+ */
+ public function getPeakMemoryValue()
+ {
+ return $this->formatter->getPrettySizeFromBytes($this->getPeakMemoryUsage());
}
/**
@@ -93,4 +109,12 @@ class Timer
}
return 0;
}
+
+ public function getPeakMemoryUsage()
+ {
+ if (function_exists('memory_get_peak_usage')) {
+ return memory_get_peak_usage();
+ }
+ return 0;
+ }
}