[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/ -> profilerlib.php (summary)

(no description)

File Size: 709 lines (26 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 2 classes

Console_Getopt:: (6 methods):
  getopt2()
  getopt()
  doGetopt()
  _parseShortOption()
  _parseLongOption()
  readPHPArgv()

Profiler:: (16 methods):
  _get_pprofp()
  get_profiling()
  usage()
  parse_info()
  num_cmp()
  by_time()
  by_c_time()
  by_avgcpu()
  by_calls()
  by_rtime()
  by_c_rtime()
  by_stime()
  by_c_stime()
  by_utime()
  by_c_utime()
  by_mem()

Defines 16 functions

  scandir()

Class: Console_Getopt  - X-Ref

Command-line options parsing class.

getopt2($args, $short_options, $long_options = null)   X-Ref
Parses the command-line options.

The first parameter to this function should be the list of command-line
arguments without the leading reference to the running program.

The second parameter is a string of allowed short options. Each of the
option letters can be followed by a colon ':' to specify that the option
requires an argument, or a double colon '::' to specify that the option
takes an optional argument.

The third argument is an optional array of allowed long options. The
leading '--' should not be included in the option name. Options that
require an argument should be followed by '=', and options that take an
option argument should be followed by '=='.

The return value is an array of two elements: the list of parsed
options and the list of non-option command-line arguments. Each entry in
the list of parsed options is a pair of elements - the first one
specifies the option, and the second one specifies the option argument,
if there was one.

Long and short options can be mixed.

Most of the semantics of this function are based on GNU getopt_long().

param: array  $args           an array of command-line arguments
param: string $short_options  specifies the list of allowed short options
param: array  $long_options   specifies the list of allowed long options
return: array two-element array containing the list of parsed options and

getopt($args, $short_options, $long_options = null)   X-Ref
This function expects $args to start with the script name (POSIX-style).
Preserved for backwards compatibility.


doGetopt($version, $args, $short_options, $long_options = null)   X-Ref
The actual implementation of the argument parsing code.


_parseShortOption($arg, $short_options, &$opts, &$args)   X-Ref


_parseLongOption($arg, $long_options, &$opts, &$args)   X-Ref


readPHPArgv()   X-Ref
Safely read the $argv PHP array across different PHP configurations.
Will take care on register_globals and register_argc_argv ini directives

return: mixed the $argv PHP array or PEAR error if not registered

Class: Profiler  - X-Ref

Profiler adapted from Pear::APD's pprofp script. Not quite there yet, I need
to get this to accept a similar list of arguments as the script does,
and process them the same way. Also make sure that the file being loaded
is the right one. Also support multiple pids used in one page load (up to 4 so far).
Then output all this in a nicely formatted table.

_get_pprofp($cleanup = true)   X-Ref
Concatenates all the pprof files generated by apd_set_pprof_trace()
and returns the resulting string, which can then be processed by
get_profiling();
It also deletes these files once finished, in order to limit
cluttering of the filesystem. This can be switched off by
providing "false" as the only argument to this function.

WARNING: If you switch cleanup off, profiling data will
accumulate from one pageload to the next.

param: boolean $cleanup Whether to delete pprof files or not.
return: String Profiling raw data

get_profiling($args)   X-Ref
Returns profiling information gathered using APD functions.
Accepts a numerical array of command-line arguments.

param: Array $args
return: String Profiling info

usage()   X-Ref
No description

parse_info($tag, $datasource, &$cfg)   X-Ref
No description

num_cmp($a, $b)   X-Ref
No description

by_time($a,$b)   X-Ref
No description

by_c_time($a,$b)   X-Ref
No description

by_avgcpu($a,$b)   X-Ref
No description

by_calls($a, $b)   X-Ref
No description

by_rtime($a,$b)   X-Ref
No description

by_c_rtime($a,$b)   X-Ref
No description

by_stime($a,$b)   X-Ref
No description

by_c_stime($a,$b)   X-Ref
No description

by_utime($a,$b)   X-Ref
No description

by_c_utime($a,$b)   X-Ref
No description

by_mem($a, $b)   X-Ref
No description

Functions
Functions that are not part of a class:

scandir($dir, $sortorder = 0)   X-Ref
No description



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7