PHP 脚本执行内存使用大小
来源:互联网 发布:沈阳居住证网络查询 编辑:程序博客网 时间:2024/06/05 16:17
<?php/*php内存使用机制Time 2014-06-04*/function convert($size){ $unit = array('b','kb','mb','gb','tb','pb'); return round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];}function curl_post($url, array $post = array(), array $options = array()){ $defaults = array( CURLOPT_POST => 1, CURLOPT_HEADER => 0, CURLOPT_URL => $url, CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 4, CURLOPT_POSTFIELDS => http_build_query($post) ); $ch = curl_init(); curl_setopt_array($ch, ($options + $defaults)); if( ! $result = curl_exec($ch)) { trigger_error(curl_error($ch)); } curl_close($ch); return $result;}function start() { $array = array(); for ($i = 1; $i <= 30; $i++) { $array[] = $i.'<orders> <order> <orderid>E00000000001</orderid> <callback>D_00001</callback> <customerid>761342</customerid> <mailno>1200000000001</mailno> <sender> <name>刘XX</name> <company>韵达快运</company> <city>上海市,青浦区</city> <address>盈港东路6679号</address> <postcode>201703</postcode> <phone>021-12345678</phone> <mobile>13812345678,13587654321</mobile> </sender> <receiver> <name>张YY</name> <company>缘港商务</company> <city>广东省,广州市,天河区</city> <address>帝王大厦5-12号</address> <postcode>510520</postcode> <phone>021-12345678</phone> <mobile>13587654321</mobile> </receiver> <sendstarttime>2010-06-19 08:00:00</sendstarttime> <sendendtime>2010-06-19 12:00:00</sendendtime> <weight>0.753</weight> <size>0.12,0.23,0.11</size> <value>126.50</value> <freight>8.00</freight> <premium>1.00</premium> <other_charges>0.00</other_charges> <collection_currency>CNY</collection_currency> <collection_value>155.50</collection_value> <special>0</special> <items> <item> <name>芭比闹钟</name> <number>1</number> <remark></remark> </item> </items> <remark>包已打好</remark> </order></orders>'; } foreach ($array as $value) { $response = curl_post('http://127.0.0.1/demo/test/interface.php', array('data'=>$value)); }}$i = 5;while (true) { echo convert(memory_get_usage()) . "--s--\n"; start(); echo convert(memory_get_usage()) . "--e--\n"; $i--; if ($i < 1) { break; }}?>
0 0
- PHP 脚本执行内存使用大小
- 使用PHP 执行casperjs脚本
- 监测程序内存使用大小的脚本
- 使用php作linux自动执行脚本
- centos使用crontab定时执行php脚本
- php执行shell脚本
- PHP执行shell脚本
- linux 执行php脚本
- PHP脚本执行过程
- php脚本执行流程
- php自动执行脚本
- php 自动执行脚本
- php 异步执行脚本
- 定时执行php脚本
- windows下使用PHP实现定时执行脚本
- windows下使用PHP实现定时执行脚本
- PHP使用Yii框架写一个不间断执行的脚本
- windows下使用PHP实现定时执行脚本
- OCP 1Z0 051 QUESTION NO: 54
- 博客出炉了
- java操作excel-jxl
- 顺序图知识点
- FF,ie6,ie7兼容性
- PHP 脚本执行内存使用大小
- jEasyUI 中文版
- java高新技术之使用反射和内省对对象的操作
- 赋值操作符概要
- API Hook基本原理和实现
- C++中星号(*)和与号(&)的用法
- 研大考研不是骗子,五一试学感悟
- 8080 和 6800 接口的区别
- C# download file from webserver