MediaWiki REL1_37
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}
serialize()
Dump profiler data in a ".xhprof" file.
log(array $stats)
Log MediaWiki-style profiling data.
canUse()
Can this output type be used?
Base class for profiling output.
Profiler that captures all function calls from the XHProf PHP extension.