Beispiel #1
0
    /**
     * Returns profiling information.
     *
     * $profiling[x]['name']  = name of marker x
     * $profiling[x]['time']  = time index of marker x
     * $profiling[x]['diff']  = execution time from marker x-1 to this marker x
     * $profiling[x]['total'] = total execution time up to marker x
     *
     * @return array
     * @access public
     */
    function getProfiling() {
        $i = $total = 0;
        $result = array();
        $temp = reset($this->markers);
        $this->maxStringLength = 0;

        foreach ($this->markers as $marker => $time) {
            if (extension_loaded('bcmath')) {
                $diff  = bcsub($time, $temp, 6);
                $total = bcadd($total, $diff, 6);
            } else {
                $diff  = $time - $temp;
                $total = $total + $diff;
            }
            $initial_memory = !isset($initial_memory) ? $this->_memory[$marker] : $initial_memory+$tmp_memory;
            $files = !isset($files) ? $this->_files[$marker] : $files+$previous_files;

            $tmp_memory = @$this->_memory[$marker]-$initial_memory;

            $result[$i]['name']  = $marker;
            $result[$i]['time']  = $time;
            $result[$i]['diff']  = $diff;
            $result[$i]['total'] = $total;
            $result[$i]['memory'] = number_to_human_size($tmp_memory);
            $result[$i]['total_memory'] = number_to_human_size(@$this->_memory[$marker]);
            $result[$i]['files'] = @$this->_files[$marker] - $files;
            $result[$i]['total_files'] = @$this->_files[$marker];

            $previous_files = $result[$i]['files'];
            $previous_memory = $result[$i]['files'];

            $this->maxStringLength = (strlen($marker) > $this->maxStringLength ? strlen($marker) + 1 : $this->maxStringLength);

            $temp = $time;
            $i++;
        }

        $result[0]['diff'] = '-';
        $result[0]['total'] = '-';
        $this->maxStringLength = (strlen('total') > $this->maxStringLength ? strlen('total') : $this->maxStringLength);
        $this->maxStringLength += 2;

        return $result;
    }
    ?>
 (<?php 
    echo number_to_human_size($size) . ' ' . $ext;
    ?>
)</a></li>
  <?php 
    if ($post->has_jpeg()) {
        ?>
        <?php 
        # If we have a JPEG, the above link was the JPEG.  Link to the PNG here.
        ?>
        <li><a href="<?php 
        echo $post->file_url;
        ?>
" class="original-file-unchanged" id="png">Download PNG (<?php 
        echo number_to_human_size($post->file_size);
        ?>
)</a></li>
  <?php 
    }
}
if ($post->can_user_delete()) {
    ?>
          <li><a href="/post/delete/<?php 
    echo $post->id;
    ?>
">Delete</a></li>
<?php 
}
if ($post->is_deleted() && User::is('>=35')) {
    ?>
Beispiel #3
0
function memusage()
{
    echo 'Memory usage: ' . number_to_human_size(memory_get_usage());
}