Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
Memory | n/a |
0 / 0 |
n/a |
0 / 0 |
4 | n/a |
0 / 0 |
|||
getUsage | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getAllocate | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getPeakUsage | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
getPeakAllocate | n/a |
0 / 0 |
n/a |
0 / 0 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\Core; |
6 | |
7 | /** |
8 | * メモリ使用状況のあれこれ。 |
9 | * |
10 | * 原則使用しない。 |
11 | * |
12 | * @codeCoverageIgnore |
13 | */ |
14 | abstract class Memory |
15 | { |
16 | #region function |
17 | |
18 | /** |
19 | * 現在の使用メモリ量を取得。 |
20 | * |
21 | * `memory_get_usage(false)` ラッパー。 |
22 | * |
23 | * @return int |
24 | * @see https://www.php.net/manual/function.memory-get-usage.php |
25 | */ |
26 | public static function getUsage(): int |
27 | { |
28 | return memory_get_usage(false); |
29 | } |
30 | |
31 | /** |
32 | * システム割り当てメモリ量を取得。 |
33 | * |
34 | * `memory_get_usage(false)` ラッパー。 |
35 | * |
36 | * @return int |
37 | * @see https://www.php.net/manual/function.memory-get-usage.php |
38 | */ |
39 | public static function getAllocate(): int |
40 | { |
41 | return memory_get_usage(true); |
42 | } |
43 | |
44 | /** |
45 | * スクリプトのメモリ最大使用量を取得。 |
46 | * |
47 | * `memory_get_peak_usage(false)` ラッパー。 |
48 | * |
49 | * @return int |
50 | * @see https://www.php.net/manual/function.memory-get-peak-usage.php |
51 | */ |
52 | public static function getPeakUsage(): int |
53 | { |
54 | return memory_get_peak_usage(false); |
55 | } |
56 | |
57 | /** |
58 | * スクリプトのシステム割り当てメモリ最大使用量を取得。 |
59 | * |
60 | * `memory_get_peak_usage(true)` ラッパー。 |
61 | * |
62 | * @return int |
63 | * @see https://www.php.net/manual/function.memory-get-peak-usage.php |
64 | */ |
65 | public static function getPeakAllocate(): int |
66 | { |
67 | return memory_get_peak_usage(true); |
68 | } |
69 | |
70 | #endregion |
71 | } |