Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="title1"><a href="javascript:show_fully();">Functions Timing results</a></div>
- <div class="first_row">Total time of page's PHP execution (from the first moment to last moment): <b><?php echo $this->decimal_outputer( _DEBUG_END_TIME_ - _DEBUG_START_TIME_ ); ?></b> seconds </div>
- <table class="dft_table"> <script> //document.getElementsByClassName("dft_table")[0].style.visibility = "hidden";</script>
- <thead>
- <tr class="head_tr">
- <th class="triggered_times">trigger<br/>count</th><th class="func_name">Action & Function name</th><th class="complete_length">complete length (seconds)</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $output = '';
- $time_total =0;
- if ($this->standard_way)
- {
- // ################ Output ################
- foreach($this->actions as $name=>$array) {
- $output .= '<tr>';
- $output .='<td>'. count($array) .'</td>';
- $output .='<td>'. $name .'</td>';
- $action_total = 0;
- foreach($array as $randKey=>$array1) {
- $mult = 10000;
- $action_total += ($array1['end']['time'] *$mult - $array1['start']['time'] *$mult)/$mult;
- }
- $output .='<td>'. $this->decimal_outputer( $action_total, 4) .'</td>';
- $output .='</tr>';
- $time_total += $action_total;
- }
- }
- else
- {
- // ================== at first, sort =============== //
- $sorted_data =[];
- $actions_total=0;
- foreach($GLOBALS['WPDFT_ARRAY'] as $actionName=>$actionExecutions)
- {
- $action_total=0;
- foreach($actionExecutions as $actionCycleIndex=>$arrayOfFuncs)
- {
- $functions_total=0;
- foreach($arrayOfFuncs as $funcName=>$funcExecutions)
- {
- $funcion_total = 0;
- foreach($funcExecutions as $funcCycleIndex=>$funcBlock) {
- $time = $this->decimal_normalizer($funcBlock['end'] - $funcBlock['start']);
- $funcion_total += $time;
- $sorted_data['actions'][$actionName]['cycles'][$actionCycleIndex]['functions'][$funcName]['cycles'][$funcCycleIndex]['time'] = $time;
- }
- $functions_total += $funcion_total;
- $sorted_data['actions'][$actionName]['cycles'][$actionCycleIndex]['functions'][$funcName]['time'] = $this->decimal_normalizer( $funcion_total );
- $this->array_sort_by_column($sorted_data['actions'][$actionName]['cycles'][$actionCycleIndex]['functions'][$funcName]['cycles'], 'time', SORT_DESC );
- }
- $action_total += $functions_total;
- $sorted_data['actions'][$actionName]['cycles'][$actionCycleIndex]['time'] = $this->decimal_normalizer($functions_total) ;
- $this->array_sort_by_column($sorted_data['actions'][$actionName]['cycles'][$actionCycleIndex]['functions'], 'time', SORT_DESC );
- }
- $actions_total += $action_total;
- $sorted_data['actions'][$actionName]['time'] = $this->decimal_normalizer($action_total);
- $this->array_sort_by_column($sorted_data['actions'][$actionName]['cycles'], 'time', SORT_DESC );
- }
- $time_total += $actions_total;
- $sorted_data['time'] = $this->decimal_normalizer($actions_total);
- $this->array_sort_by_column($sorted_data['actions'], 'time', SORT_DESC );
- // ################ Output ################
- $i1=0;
- foreach($sorted_data as $key__actions_time=>$time_or_actionsArray) //key: actions|time
- {
- $i1++;
- $i2=0;
- if ($key__actions_time!="actions") continue;
- foreach($time_or_actionsArray as $actionName=>$time_or_cycles_array_A) //key: only action name
- {
- foreach($time_or_cycles_array_A as $key__cycles_time=>$time_or_cycleArrays_A) //key: cycles|time
- {
- if ($key__cycles_time!="cycles") continue;
- foreach($time_or_cycleArrays_A as $a_cycleIndex=>$time_or_functions_Arrays) //key: only cycle index
- {
- foreach($time_or_functions_Arrays as $key__functions_time=>$time_or_functionArrays) //key: functions|time
- {
- if ($key__functions_time!="functions") continue;
- foreach($time_or_functionArrays as $functionName=>$time_or_cycles_array_F) //key: only function name
- {
- foreach($time_or_cycles_array_F as $key__cycles_time2=>$time_or_cycleArrays_F)//key: cycles|time
- {
- if ($key__cycles_time2!="cycles") continue;
- foreach($time_or_cycleArrays_F as $f_cycleIndex=>$time) //key: only cycle index
- {
- //$time
- }
- }
- $childDiv[] = '<div class="dft_child"> <div class="func_name">'.$functionName .' <span class="func_count">('.count($time_or_cycles_array_F['cycles']).')</span></div> <div class="func_path">'. $GLOBALS['WPDFT_func_paths'][$functionName].'</div></div>';
- $childTimes[]= '<div class="dft_child">'. $this->decimal_outputer( $time_or_cycles_array_F['time'], 5) .'</div>';
- }
- }
- }
- }
- /*
- if ( count($array) > 0 && count($array) != $i)
- {
- $childDiv[] = '<div class="dft_child separator"></div>';
- $childTimes[]= '<div class="dft_child separator"></div>';
- }
- */
- $childDiv_final = implode('', $childDiv);
- $childTimes_final = implode('', $childTimes);
- $output .= '<tr class="dft_tr">';
- $output .= '<td>'. count($time_or_cycles_array_A['cycles']) .'</td>';
- $output .= '<td>'. $actionName .' <div class="dft_childWrap">'.$childDiv_final.'</div></td>';
- $output .= '<td>'. $this->decimal_outputer( $time_or_cycles_array_A['time'], 4) .' <div class="dft_childWrap">'.$childTimes_final.'</div></td>';
- $output .= '</tr>';
- }
- }
- }
- echo $output;
- ?>
- </tbody>
- </table>
- <div class="first_row">Sum (maximum) time of actions & filters execution (<span class="notic"> This value is just an approximation, because ACTIONS TIME SHOULDN'T BE DIRECTLY SUMED-UP, BECAUSE ONE ACTION MIGHT HAVE BEEN EXECUTED WITHIN ANOTHER ACTION, and, summing up them directly may have caused incorrect (double) summation [So, this value is not reliable, but just an experimental. Instead, use TOTAL TIME of page and try to fix the slowest actions/functions. ... ##</span>): <b id="totalsum_actions"><?php echo $this->decimal_outputer( $time_total ); ?></b> seconds </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement