本文整理汇总了PHP中debug::_time_to_float方法的典型用法代码示例。如果您正苦于以下问题:PHP debug::_time_to_float方法的具体用法?PHP debug::_time_to_float怎么用?PHP debug::_time_to_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类debug
的用法示例。
在下文中一共展示了debug::_time_to_float方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_report_internal
function parse_report_internal($as_html = true)
{
$end_time = microtime();
$return_text = '';
if ($as_html) {
if (count($this->debug_strings) - count($this->time_points) > 0) {
$return_text .= "<script>NEED_TO_FOCUS=1</script>";
}
$return_text .= '<table><tr><td>';
$return_text .= '<table cellspacing=0 cellpadding=1>';
}
$counter = 0;
foreach ($this->debug_strings as $debug) {
$counter++;
$output_data = $this->output_format[$debug['level']];
if (is_array($output_data)) {
$color = $output_data['color'];
$name = $output_data['name'];
if ($as_html) {
$return_text .= "<tr>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<th align='left'>{$counter})<span style='color:{$color}'>{$name}:</span></th>\r\n </tr>\r\n <tr><td><pre>" . htmlspecialchars($debug['string']) . "</pre></td></tr>";
} else {
$return_text .= "{$name}: " . $debug['string'] . "\n";
}
}
}
if ($as_html) {
$return_text .= "</table>";
$return_text .= "<h3>Timing points:</h3>";
$return_text .= "<table style='border: 1px solid black;' cellspacing='0' cellpadding='1'><tr><th>Checkpoint</th><th>Elapsed</th><th>Rel. Elapsed</th></tr>";
}
$start_time = false;
$elapsed = 0.0;
$rel_array = array(-1 => 0.0);
for ($i = 0; $i < count($this->time_points); ++$i) {
$point = $this->time_points[$i];
$next_point = false;
if (isset($this->time_points[$i + 1])) {
$next_point = $this->time_points[$i + 1];
}
$time = debug::_time_to_float($point['time']);
$next_time = false;
if ($next_point !== false) {
$next_time = debug::_time_to_float($next_point['time']);
}
if ($start_time === false) {
$start_time = $time;
}
$elapsed = $time - $start_time;
$rel_elapsed = $rel_array[$i - 1];
$rel_array[] = $next_time - $time;
if ($i % 2 == 0) {
$class = 'timingpoint1';
} else {
$class = 'timingpoint2';
}
if ($as_html) {
$return_text .= "<tr><td class='{$class}'>" . $point['description'] . "</td><td class='{$class}'>" . number_format($elapsed, $this->timing_accuracy) . " sec</td><td class='{$class}'>" . (number_format($rel_elapsed, $this->timing_accuracy) . " sec") . "</td>" . "</tr>";
} else {
$return_text .= $point['description'] . number_format($elapsed, $this->timing_accuracy) . " sec " . (number_format($rel_elapsed, $this->timing_accuracy) . " sec") . "\n";
}
}
if (count($this->time_points) > 0) {
$t_time = explode(' ', $end_time);
ereg("0\\.([0-9]+)", '' . $t_time[0], $t1);
$end_time = $t_time[1] . '.' . $t1[1];
$total_elapsed = $end_time - $start_time;
if ($as_html) {
$return_text .= "<tr><td><b>Total runtime:</b></td><td><b>" . number_format($total_elapsed, $this->timing_accuracy) . " sec</b></td><td></td></tr>";
} else {
$return_text .= "Total runtime: " . number_format($total_elapsed, $this->timing_accuracy) . " sec\n";
}
} else {
if ($as_html) {
$return_text .= "<tr><td> No timing points defined</td><td>";
} else {
$return_text .= "No timing points defined\n";
}
}
if ($as_html) {
$return_text .= "</table>";
}
if ($as_html) {
$return_text .= "<h3>Time accumulators:</h3>";
$return_text .= "<table style='border: 1px solid black;' cellspacing='0' cellpadding='1'><tr><th> Accumulator</th><th> Elapsed</th><th> Percent</th><th> Count</th><th> Average</th></tr>";
$i = 0;
}
$script_end_time = debug::_time_to_float(microtime());
$total_elapsed = $script_end_time - $this->script_start;
$time_list = $this->time_accumulator_list;
$groups = $this->time_accumulator_group_list;
$group_list = array();
foreach ($groups as $group_key => $key_list) {
if (count($key_list) == 0 && !array_key_exists($group_key, $time_list)) {
continue;
}
$group_list[$group_key] = array('name' => $group_key);
if (array_key_exists($group_key, $time_list)) {
if ($time_list[$group_key]['time'] != 0) {
$group_list[$group_key]['time_data'] = $time_list[$group_key];
}
//.........这里部分代码省略.........
示例2: _parse_report_internal
function _parse_report_internal($as_html = true)
{
$end_time = microtime();
$return_text = '';
if ($as_html)
{
if ((count($this->debug_strings) - count($this->time_points)) > 0)
$return_text .= "<script>NEED_TO_FOCUS=1</script>";
$return_text .= '<table><tr><td>';
$return_text .= '<table cellspacing=0 cellpadding=1>';
}
$counter = 0;
foreach ($this->debug_strings as $debug)
{
$counter++;
$output_data = $this->output_format[$debug['level']];
if (is_array($output_data))
{
$color = $output_data['color'];
$name = $output_data['name'];
if ($as_html)
{
$return_text .= "<tr>
<th align='left'><a name={$counter}>{$counter})<span style='color:$color'>{$name}:</span></th>
</tr>
<tr><td>" . debug :: _parse_html_debug_info($debug) . "</td></tr>";
}
else
$return_text .= "$name: " . debug :: _parse_text_debug_info($debug);
}
}
if ($as_html)
{
$return_text .= "</table>";
$return_text .= "<h3>Timing points:</h3>";
$return_text .= "<table style='border: 1px solid black;' cellspacing='0' cellpadding='1'><tr><th>Checkpoint</th><th>Elapsed</th><th>Rel. Elapsed</th><th>Mem</th><th>Rel. Mem</th></tr>";
}
$start_time = false;
$elapsed = 0.00;
$rel_array = array(-1 => 0.00);
$rel_memory_array = array(-1 => 0);
for ($i=0; $i < count($this->time_points); ++$i)
{
$point = $this->time_points[$i];
if (isset($this->time_points[$i + 1]))
$next_point = $this->time_points[$i + 1];
else
$next_point = false;
$time = debug :: _time_to_float($point['time']);
$memory = $point['memory_usage'];
$next_time = false;
$next_memory = 0;
if ($next_point !== false)
{
$next_time = debug :: _time_to_float($next_point['time']);
$next_memory = $next_point['memory_usage'];
}
if ($start_time === false)
$start_time = $time;
$elapsed = $time - $start_time;
$rel_elapsed = $rel_array[$i-1];
$rel_memory_elapsed = $rel_memory_array[$i-1];
$rel_array[] = $next_time - $time;
$rel_memory_array[] = $next_memory - $memory;
if ($i % 2 == 0)
$class = 'timingpoint1';
else
$class = 'timingpoint2';
if ($as_html)
{
$return_text .= "<tr><td class='$class'>" . $point['description'] . "</td><td class='$class'>" .
number_format($elapsed, $this->timing_accuracy) . "s</td><td class='$class'>" .
number_format($rel_elapsed, $this->timing_accuracy) . "s</td>" .
"<td class='$class'>" . number_format($memory / 1024, 2) . "Kb </td>" .
"<td class='$class'>" . number_format($rel_memory_elapsed / 1024, 2) . "Kb</td>"
. "</tr>";
}
else
{
$return_text .= $point['description'] .
number_format($elapsed, $this->timing_accuracy) . "s " .
number_format($rel_elapsed, $this->timing_accuracy) . "s " .
number_format($memory / 1024, 2) . "Kb " .
number_format($rel_memory_elapsed / 1024, 2) . "Kb" .
"\n";
}
//.........这里部分代码省略.........