[BUGFIX] Moving files in filelist renames file to "1"
[Packages/TYPO3.CMS.git] / t3lib / log / processor / class.t3lib_log_processor_memorypeakusage.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2012 Ingo Renner (ingo@typo3.org)
6 * (c) 2012 Steffen Müller (typo3@t3node.com)
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 *
18 * This script is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * This copyright notice MUST APPEAR in all copies of the script!
24 ***************************************************************/
25
26
27 /**
28 * Memory peak usage processor methods.
29 *
30 * @author Ingo Renner <ingo@typo3.org>
31 * @author Steffen Müller <typo3@t3node.com>
32 * @package TYPO3
33 * @subpackage t3lib
34 */
35 class t3lib_log_processor_MemoryPeakUsage extends t3lib_log_processor_AbstractMemory {
36
37 /**
38 * Processes a log record and adds memory peak usage information.
39 *
40 * @param t3lib_log_Record $logRecord The log record to process
41 * @return t3lib_log_Record The processed log record with additional data
42 * @see memory_get_peak_usage()
43 */
44 public function processLogRecord(t3lib_log_Record $logRecord) {
45 $bytes = memory_get_peak_usage($this->getRealMemoryUsage());
46
47 if ($this->formatSize) {
48 $size = t3lib_div::formatSize($bytes);
49 } else {
50 $size = $bytes;
51 }
52
53 $logRecord->addData(array(
54 'memoryPeakUsage' => $size
55 ));
56
57 return $logRecord;
58 }
59
60 }
61
62 ?>