Esempio n. 1
0
 function edump_object_name($obj)
 {
     edump(object_name($obj));
 }
Esempio n. 2
0
 function statisticsExecTime($func, array $params, $xAxis)
 {
     set_time_limit(170);
     $func_name = '';
     if (is_array($func)) {
         if (!method_exists($func[0], $func[1])) {
             return false;
         }
         $func_name = object_name($func[0]) . '->' . $func[1];
     } else {
         if (is_string($func)) {
             if (!function_exists($func)) {
                 return false;
             }
             $func_name = $func;
         } else {
             if (is_callable($func)) {
                 // if(! function_exists($func)){
                 // return false;
                 // }
                 $func_name = 'Closure';
             } else {
                 return false;
             }
         }
     }
     $mem = [];
     $time = [];
     foreach ($params as $v) {
         mark('start');
         $result = call_user_func_array($func, (array) $v);
         $time[] = floatval(mark('start', 'end'));
         $memory = memory_mark();
         if (isset($memory['start']) && isset($memory['end'])) {
             $mem[] = floatval(memory_mark('start', 'end'));
         }
         mark('[clear]');
         memory_mark('[clear]');
     }
     $data = [['name' => 'Exec Time', 'data' => $time]];
     $mem && ($data[] = ['name' => 'Exec Memory', 'data' => $mem]);
     $xAxis = ['categories' => $xAxis];
     return chart($xAxis, $data, 'Function [' . htmlentities($func_name) . '] Execute Time Statistics', 'At ' . date('Y-m-d H:i:s'), 'Number');
 }