dolibarr 21.0.0-beta
DolMemoryCollector.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25use DebugBar\DataCollector\MemoryCollector;
26
30class DolMemoryCollector extends MemoryCollector
31{
37 public function collect()
38 {
39 global $conf;
40
41 $this->updatePeakUsage();
42 return array(
43 'peak_usage' => $this->peakUsage,
44 //'peak_usage_str' => $this->getDataFormatter()->formatBytes($this->peakUsage, 2)
45 'peak_usage_str' => (empty($conf->dol_optimize_smallscreen) ? dol_print_size($this->peakUsage, 0) : dol_print_size($this->peakUsage, 1))
46 );
47 }
48
54 public function getWidgets()
55 {
56 global $langs;
57
58 $langs->load("other");
59
60 return array(
61 "memory" => array(
62 "icon" => "cogs",
63 "tooltip" => $langs->transnoentities('MemoryUsage'),
64 "map" => "memory.peak_usage_str",
65 "default" => "'0B'"
66 )
67 );
68 }
69}
DolMemoryCollector class.
getWidgets()
Return widget settings.
collect()
Return value of indicator.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formatted size.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79