-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdemo.php
More file actions
39 lines (28 loc) · 710 Bytes
/
Copy pathdemo.php
File metadata and controls
39 lines (28 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace App\Structural\Flyweight;
require(__DIR__ . '/../../../vendor/autoload.php');
$csv = new Generator("demo.csv", 5000);
$csv->create();
$file = fopen('demo.csv', 'r');
$devicesDB = new DeviceStorage();
for ($i = 0; $row = fgetcsv($file); ++$i) {
// Omitting file headers
if ($i) {
$devicesDB->addDevice(
$row[1],
$row[2],
$row[3],
$row[4],
$row[5],
$row[6]
);
}
}
fclose($file);
$devicesDB->checkDevicesHealth();
// 3.4 MB RAM USED
// 22.92 MB RAM USED
// 2.21 MB RAM USED
// 10.91 MB RAM USED
echo round(memory_get_usage() / 1024 / 1024, 2) . " MB RAM USED";