-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathtest_local.php
More file actions
45 lines (36 loc) · 1010 Bytes
/
Copy pathtest_local.php
File metadata and controls
45 lines (36 loc) · 1010 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
40
41
42
43
44
45
<?php
/**
* Created by PhpStorm.
* User: m_luosu
* Date: 2016/12/27
* Time: 18:06
*/
require_once('./MGQrCodeReader/MGQrCodeReader.php');
// test
$img_path = './image/';
$dir = scandir($img_path);
$ignoredFiles = [
'.',
'..'
];
$MGQrCodeReader = new \MGQrCodeReader\MGQrCodeReader();
foreach($dir as $index=>$file) {
if(in_array($file, $ignoredFiles)) continue;
$stime = microtime(true);
$smem = convert();
echo '---------', "\n",'start at: ', $stime, "\n",'start mem: ', $smem, "\n";
echo $file, "\n";
echo $MGQrCodeReader->read($img_path. $file);
$etime = microtime(true);
$emem = convert();
echo "\n",
'end at: ',$etime, "\n",
'end mem: ',$emem, "\n",
'cost time: ', number_format(($etime-$stime), 6, '.', '').' seconds', "\n",
'---------', "\n";
}
function convert(){
$size = memory_get_usage(true);
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}