ProfilerStub.php 960 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Stub profiling functions
  4. * @file
  5. * @ingroup Profiler
  6. */
  7. /** backward compatibility */
  8. $wgProfiling = false;
  9. /** is setproctitle function available ? */
  10. $haveProctitle = function_exists( 'setproctitle' );
  11. /**
  12. * Begin profiling of a function
  13. * @param $fn string
  14. */
  15. function wfProfileIn( $fn = '' ) {
  16. global $hackwhere, $wgDBname, $haveProctitle;
  17. if( $haveProctitle ){
  18. $hackwhere[] = $fn;
  19. setproctitle( $fn . " [$wgDBname]" );
  20. }
  21. }
  22. /**
  23. * Stop profiling of a function
  24. * @param $fn string
  25. */
  26. function wfProfileOut( $fn = '' ) {
  27. global $hackwhere, $wgDBname, $haveProctitle;
  28. if( !$haveProctitle )
  29. return;
  30. if( count( $hackwhere ) )
  31. array_pop( $hackwhere );
  32. if( count( $hackwhere ) )
  33. setproctitle( $hackwhere[count( $hackwhere )-1] . " [$wgDBname]" );
  34. }
  35. /**
  36. * Does nothing, just for compatibility
  37. */
  38. function wfGetProfilingOutput( $s, $e ) {}
  39. /**
  40. * Does nothing, just for compatibility
  41. */
  42. function wfProfileClose() {}