Skip to content

Instantly share code, notes, and snippets.

@Renobird
Created April 21, 2015 14:30
Show Gist options
  • Save Renobird/e8b72491efea683a0bde to your computer and use it in GitHub Desktop.
Save Renobird/e8b72491efea683a0bde to your computer and use it in GitHub Desktop.
ProcessWire Debug Timers
<?php
/**
* Debug timers for Processwire when you can't enable debug mode
*
* https://processwire.com/talk/topic/7865-performance-drop-after-update-to-25/?p=76166
*
* Courstesy of sforsman
*
*/
$timer = "debug";
Debug::timer($timer."1");
// Phase 1 code
Debug::saveTimer($timer."1", "Phase 1");
Debug::timer($timer."2");
// Phase 2 code
Debug::saveTimer($timer."2", "Phase 2");
Debug::timer($timer."3");
// Phase 3 code
Debug::saveTimer($timer."3", "Phase 3");
Debug::timer($timer."4");
// Phase 4 code
Debug::saveTimer($timer."4", "Phase 4");
file_put_contents(wire('config')->paths->logs."/timers.txt", var_export(Debug::getSavedTimers(),true), FILE_APPEND);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment