PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 4.3.0
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v4.3.0
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / CronArchive / Performance / Measurement.php
matomo / app / core / CronArchive / Performance Last commit date
Logger.php 5 years ago Measurement.php 5 years ago
Measurement.php
165 lines
1 <?php
2 /**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 */
8
9 namespace Piwik\CronArchive\Performance;
10
11 class Measurement
12 {
13 /**
14 * @var string
15 */
16 private $category;
17
18 /**
19 * @var string
20 */
21 private $measuredName;
22
23 /**
24 * @var string
25 */
26 private $idSite;
27
28 /**
29 * @var string
30 */
31 private $dateRange;
32
33 /**
34 * @var string
35 */
36 private $periodType;
37
38 /**
39 * @var string
40 */
41 private $segment;
42
43 /**
44 * @var float
45 */
46 private $time;
47
48 /**
49 * @var string
50 */
51 private $memory;
52
53 /**
54 * @var string
55 */
56 private $peakMemory;
57
58 public function __construct($category, $name, $idSite, $dateRange, $periodType, $segment, $time, $memory, $peakMemory)
59 {
60 $this->category = $category;
61 $this->measuredName = $name;
62 $this->idSite = $idSite;
63 $this->dateRange = $dateRange;
64 $this->periodType = $periodType;
65 $this->segment = trim($segment);
66 $this->time = $time;
67 $this->memory = $memory;
68 $this->peakMemory = $peakMemory;
69 }
70
71 public function __toString()
72 {
73 $parts = [
74 ucfirst($this->category) . ": {$this->measuredName}",
75 "idSite: {$this->idSite}",
76 "period: {$this->periodType} ({$this->dateRange})",
77 "segment: " . (!empty($this->segment) ? $this->segment : 'none'),
78 "duration: {$this->time}s",
79 "memory leak: {$this->memory}",
80 "peak memory usage: {$this->peakMemory}",
81 ];
82
83 return implode(', ', $parts);
84 }
85
86 /**
87 * @return string
88 */
89 public function getCategory()
90 {
91 return $this->category;
92 }
93
94 /**
95 * @param string $category
96 */
97 public function setCategory($category)
98 {
99 $this->category = $category;
100 }
101
102 /**
103 * @return string
104 */
105 public function getMeasuredName()
106 {
107 return $this->measuredName;
108 }
109
110 /**
111 * @param string $measuredName
112 */
113 public function setMeasuredName($measuredName)
114 {
115 $this->measuredName = $measuredName;
116 }
117
118 /**
119 * @return string
120 */
121 public function getIdSite()
122 {
123 return $this->idSite;
124 }
125
126 /**
127 * @param string $idSite
128 */
129 public function setIdSite($idSite)
130 {
131 $this->idSite = $idSite;
132 }
133
134 /**
135 * @return string
136 */
137 public function getDateRange()
138 {
139 return $this->dateRange;
140 }
141
142 /**
143 * @param string $dateRange
144 */
145 public function setDateRange($dateRange)
146 {
147 $this->dateRange = $dateRange;
148 }
149
150 /**
151 * @return string
152 */
153 public function getPeriodType()
154 {
155 return $this->periodType;
156 }
157
158 /**
159 * @param string $periodType
160 */
161 public function setPeriodType($periodType)
162 {
163 $this->periodType = $periodType;
164 }
165 }