Skip to content

Instantly share code, notes, and snippets.

@co3k
Created April 2, 2010 13:32
Show Gist options
  • Save co3k/353137 to your computer and use it in GitHub Desktop.
Save co3k/353137 to your computer and use it in GitHub Desktop.
diff --git a/web/index.php b/web/index.php
index 8d02f46..3884136 100644
--- a/web/index.php
+++ b/web/index.php
@@ -8,6 +8,8 @@
* file and the NOTICE file that were distributed with this source code.
*/
+// xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
+
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('pc_frontend', 'prod', false);
@@ -18,3 +20,24 @@ if (!opMobileUserAgent::getInstance()->getMobile()->isNonMobile())
}
sfContext::createInstance($configuration)->dispatch();
+/*
+$xhprof_data = xhprof_disable();
+
+$lastEntry = sfContext::getInstance()->getActionStack()->getLastEntry();
+$routeName = sfContext::getInstance()->getRouting()->getCurrentRouteName();
+$entryId = $routeName.'_'.$lastEntry->getModuleName().'_'.$lastEntry->getActionName().'_'.getmypid();
+
+$XHPROF_ROOT = '/home/co3k/src/xhprof-0.9.2';
+include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
+include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
+
+$xhprof_runs = new XHProfRuns_Default();
+
+$run_id = $xhprof_runs->save_run($xhprof_data, $entryId);
+
+echo '<pre>'.htmlspecialchars("---------------\n".
+ "Assuming you have set up the http based UI for \n".
+ "XHProf at some address, you can view run at \n".
+ "http://ebizori.deb/xhp/index.php?run=$run_id&source=$entryId\n".
+ "---------------\n").'</pre>';
+ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment