baseline
[omp.pkp.sfu.ca.git] / lib / pkp / classes / core / PKPProfiler.inc.php
blobc3765e2acc8f6be99e7a88a23b36266cf1b088b4
1 <?php
3 /**
4 * @file classes/core/PKPProfiler.inc.php
6 * Copyright (c) 2000-2009 John Willinsky
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 * @class PKPProfiler
10 * @ingroup core
12 * @brief Basic shell class used to wrap the PHP Quick Profiler Class
15 // $Id: PKPProfiler.inc.php,v 1.3 2009/05/05 23:21:04 asmecher Exp $
17 ini_set('include_path', BASE_SYS_DIR . '/lib/pkp/lib/pqp/classes/' . ENV_SEPARATOR . ini_get('include_path'));
18 require_once('PhpQuickProfiler.php');
20 class PKPProfiler {
22 /** @var $profiler object instance of the PQP profiler */
23 var $profiler;
25 /**
26 * Constructor.
28 function PKPProfiler() {
29 $this->profiler = new PhpQuickProfiler(PhpQuickProfiler::getMicroTime());
32 /**
33 * Gather information to be used to display profiling
34 * @return array of stored profiling information
36 function getData() {
37 $profiler =& $this->profiler;
38 $profiler->db = new PKPDBProfiler();
40 $profiler->gatherConsoleData();
41 $profiler->gatherFileData();
42 $profiler->gatherMemoryData();
43 $profiler->gatherQueryData();
44 $profiler->gatherSpeedData();
46 return $profiler->output;
50 class PKPDBProfiler {
52 /** @var $queryCount property to wrap DB connection query count */
53 var $queryCount;
55 /**
56 * Constructor.
58 function PKPDBProfiler() {
59 $dbconn =& DBConnection::getInstance();
61 $this->queryCount = $dbconn->getNumQueries();
62 $this->queries =& Registry::get('queries', true, array());