\HeydayXhprof
HeydayXhprof acts as a wrapper to `xhprof` providing useful tools for starting and stopping `xhprof` profiling.
- Author: Cam Spiers <cameron@heyday.co.nz>
- License: http://www.opensource.org/licenses/MIT MIT
Synopsis
class HeydayXhprof
{
- // constants
- const LINK_MODE_NONE = 0;
- const LINK_MODE_JS = 1;
- const LINK_MODE_LINK = 2;
- // members
- protected static boolean $default_flags = false;
- protected static boolean $app_name = false;
- protected static boolean $started = false;
- protected static integer $probability = 1;
- protected static integer $link_mode = 1;
- protected static array $exclusions = ;
- // methods
- public static void setLinkMode()
- public static int getLinkMode()
- public static null setProbability()
- public static int getProbability()
- public static bool testProbability()
- public static null addExclusion()
- public static null addExclusions()
- public static null setExclusions()
- public static array getExclusions()
- public static bool isExcluded()
- public static bool isAllowed()
- public static null start()
- public static null end()
- public static void getLink()
- public static void getUrl()
- public static int getDefaultFlags()
- public static null setDefaultFlags()
- public static string getAppName()
- public static null setAppName()
- public static boolean isStarted()
Constants
Name | Value |
---|---|
LINK_MODE_NONE | 0 |
LINK_MODE_JS | 1 |
LINK_MODE_LINK | 2 |
Members
protected
-
$app_name
Stores the "app name"/profile name. Used in profile saving and `HeydayXhprofRun` saving. -
$default_flags
Stores default flags used in `xhprof_enable` -
$exclusions
Stores request url based exclusions - $link_mode — int
-
$probability
Stores probability for use in profiling under load -
$started
Stores whether or not profiling is currently in progress
Methods
public
- addExclusion() — Add single url for exclusion
- addExclusions() — Add an array of urls for exclusion.
- end() — End the current profiling.
- getAppName() — Get the app name for profile saving, if it doesn't exist then set it the SilverStripe project name
- getDefaultFlags() — Return default flags, if they don't exists then set some reasonable alternatives.
- getExclusions() — Get exclusions
- getLink()
- getLinkMode()
- getProbability() — Get Probability
- getUrl()
- isAllowed() — Check if we are allowed to profile based on url. If allowed by url, test probability.
- isExcluded() — Check is url is excluded
- isStarted() — Tests if profiling has been started
- setAppName() — Set the app name for profile saving and run saving.
- setDefaultFlags() — Set default flags for use in profiling
- setExclusions() — Set exclusions
- setLinkMode()
- setProbability() — Set the probability for profiling under load
- start() — Start the profiling.
- testProbability() — Test whether or not request should be profiled based on a probability.