Skip to content

Instantly share code, notes, and snippets.

@videlalvaro
Created February 10, 2010 12:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save videlalvaro/300265 to your computer and use it in GitHub Desktop.
Save videlalvaro/300265 to your computer and use it in GitHub Desktop.
<?php
if($enable_graphite)
{
$fp = @fsockopen('127.0.0.1', 2003, $errno, $errstr, 1);
if($fp)
{
$out = array();
$out[] = sprintf('symfony.%s.%s.%s.memory %s %d%s',
gethostname(),
sfContext::getInstance()->getModuleName(),
sfContext::getInstance()->getActionName(),
memory_get_usage(true),
time(), "\n");
$out[] = sprintf('symfony.%s.%s.%s.requesttime %s %d%s',
gethostname(),
sfContext::getInstance()->getModuleName(),
sfContext::getInstance()->getActionName(),
microtime(true) - $start_request,
time(), "\n");
foreach($out as $o)
{
@fwrite($fp, $o);
}
@fclose($fp);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment