From 81a905d013fd8cf6fff14eb8db625741c7235b34 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 30 Aug 2012 15:41:29 +0000 Subject: Added debug parameter reqtimings to time multiget subrequests --- it_url.class | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'it_url.class') diff --git a/it_url.class b/it_url.class index 2527d7a..1b82278 100644 --- a/it_url.class +++ b/it_url.class @@ -387,8 +387,11 @@ function get_multi($p=null) curl_setopt($ch[$key], CURLOPT_URL, $url); curl_setopt_array($ch[$key], $opts); curl_multi_add_handle($mh, $ch[$key]); + $keys[$ch[$key]] = $key; } + $start = microtime(true); + # curl_multi loop copied from example at http://php.net/manual/en/function.curl-multi-exec.php $active = null; do { @@ -403,8 +406,14 @@ function get_multi($p=null) $mrc = curl_multi_exec($mh, $active); while (($info = curl_multi_info_read($mh)) !== false) - if ($info['msg'] == CURLMSG_DONE && $info['result'] != CURLE_OK) - $error[$info['handle']] = $info['result']; + { + if ($info['msg'] == CURLMSG_DONE) + { + EDC('reqtimings', $keys[$info['handle']], $info['result'], (microtime(true) - $start) * 1000); + if ($info['result'] != CURLE_OK) + $error[$info['handle']] = $info['result']; + } + } } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } -- cgit v1.2.3