stanley-king 4 years ago
parent
commit
828f0a6afb
2 changed files with 19 additions and 2 deletions
  1. 5 1
      helper/refill/RefillBase.php
  2. 14 1
      test/TestTime.php

+ 5 - 1
helper/refill/RefillBase.php

@@ -328,7 +328,11 @@ class RefillBase
                 'quality' => $quality,'order_id' => $order_id];
 
             util::incr_commit_pre($channel_name,$card_type,$amount,$quality);
-            [$state, $errmsg,$neterr] = $provider->add($card_no, $card_type, $amount, $params);
+
+            $start = microtime(true);
+            [$state, $errmsg, $neterr] = $provider->add($card_no, $card_type, $amount, $params);
+            Log::record(sprintf(" %s add request time=%.6f", $channel_name,microtime(true) - $start), Log::DEBUG);
+
             if ($state)
             {
                 //提交成功

+ 14 - 1
test/TestTime.php

@@ -27,7 +27,20 @@ class TestTime extends TestCase
 
     public function testMicro()
     {
-        $y = (float) microtime();
+        $start = microtime(true);
+        $end = microtime(true);
+        Log::record("request time=" . ($end - $start),Log::DEBUG);
+
+        for ($i = 0; $i < 10000; $i++)
+        {
+            $x = microtime();
+            $y = (float)$x;
+            Log::record("{$y}",Log::DEBUG);
+        }
+
+        $x = microtime();
+        $y = (float)$x;
+        $z = (int)$x;
         $x = sprintf('%03d', $y * 1000000);
     }