MediaWiki  master
ProfilerOutputDump.php
Go to the documentation of this file.
1 <?php
28  protected $suffix = ".xhprof";
29 
35  public function canUse() {
36  if ( empty( $this->params['outputDir'] ) ) {
37  return false;
38  }
39  return true;
40  }
41 
42  public function log( array $stats ) {
43  if ( !$this->collector instanceof ProfilerXhprof ) {
44  $this->logger->error( 'ProfilerOutputDump must be used with ProfilerXhprof' );
45  return;
46  }
47  $data = $this->collector->getRawData();
48  $filename = sprintf( "%s/%s.%s%s",
49  $this->params['outputDir'],
50  uniqid(),
51  $this->collector->getProfileID(),
52  $this->suffix );
53  file_put_contents( $filename, serialize( $data ) );
54  }
55 }
ProfilerXhprof
Profiler that captures all function calls from the XHProf PHP extension.
Definition: ProfilerXhprof.php:36
ProfilerOutputDump\$suffix
$suffix
Definition: ProfilerOutputDump.php:28
serialize
serialize()
Definition: ApiMessageTrait.php:138
ProfilerOutputDump\log
log(array $stats)
Log MediaWiki-style profiling data.
Definition: ProfilerOutputDump.php:42
ProfilerOutput
Base class for profiling output.
Definition: ProfilerOutput.php:30
ProfilerOutputDump
Dump profiler data in a ".xhprof" file.
Definition: ProfilerOutputDump.php:27
ProfilerOutputDump\canUse
canUse()
Can this output type be used?
Definition: ProfilerOutputDump.php:35