Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #19 from danielcsgomes/master
Browse files Browse the repository at this point in the history
xhgui issues solved
  • Loading branch information
jonaswouters committed Oct 15, 2012
2 parents 91e4834 + 738ec3b commit 20dc5b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
16 changes: 7 additions & 9 deletions DataCollector/XhprofCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,11 @@ public function startProfiling()

if (false !== strpos($_SERVER['REQUEST_URI'], "_wdt") || false !== strpos($_SERVER['REQUEST_URI'], "_profiler")) {
$this->profiling = false;

return;
}

if (mt_rand(1, $this->container->getParameter('jns_xhprof.sample_size')) != 1) {
$this->profiling = false;

return;
}

Expand Down Expand Up @@ -125,26 +123,26 @@ private function saveProfilingDataToDB($xhprof_data)
}

$em = $this->doctrine->getEntityManager($this->container->getParameter('jns_xhprof.entity_manager'));

$xhprofDetail = new XhprofDetail();
$xhprofDetail
->setId($this->runId)
->setUrl($url)
->setCanonicalUrl($this->getCanonicalUrl($url))
->setServerName($sname)
->setPerfData(gzcompress(json_encode($xhprof_data), 2))
->setCookie(json_encode($_COOKIE))
->setPost(json_encode($_POST))
->setGet(json_encode($_GET))
->setPerfData(gzcompress(serialize(($xhprof_data))))
->setCookie(serialize($_COOKIE))
->setPost(serialize($_POST))
->setGet(serialize($_GET))
->setPmu($pmu)
->setWt($wt)
->setCpu($cpu)
->setServerId(getenv('SERV_NAME'))
->setServerId(getenv('SERVER_NAME'))
->setAggregateCallsInclude('')
;

$em->persist($xhprofDetail);
$em->flush();

$this->runId = $xhprofDetail->getId();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Entity/XhprofDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


/**
* @ORM\Table(name="xhprof")
* @ORM\Table(name="details")
* @ORM\Entity
* @ORM\HasLifecycleCallbacks
*/
Expand Down
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,16 @@ Make sure you have XHProf installed.
If you are on a mac you can easily install it via [Macports][2]
sudo port install php5-xhprof

### Get the bundle
### Composer

To install the bundle, place it in the `src/Jns/Bundle` directory of your project
(so that it lives at `src/Jns/Bundle/XhprofBundle`). You can do this by adding
the bundle as a submodule, cloning it, or simply downloading the source.
Add the following dependencies to your projects composer.json file:

git submodule add https://github.com/jonaswouters/XhprofBundle.git src/Jns/Bundle/XhprofBundle
"require": {
# ..
"jns/xhprof-bundle": "dev-master"
# ..
}

### Add the Jns namespace to your autoloader

If this is the first Jns bundle in your Symfony 2 project, you'll
need to add the `Jns` namespace to your autoloader. This file is usually located at `app/autoload.php`.

$loader->registerNamespaces(array(
'Jns' => __DIR__.'/../src'
// ...
));

### Initializing the bundle

Expand Down

0 comments on commit 20dc5b8

Please sign in to comment.