more sensible naming
This commit is contained in:
parent
6e56224b8d
commit
ec5d9bb6f4
@ -700,14 +700,14 @@ function getExtension ($mime_type){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$_shm_execs = 0;
|
$_shm_query_count = 0;
|
||||||
/**
|
/**
|
||||||
* $db is the connection object
|
* $db is the connection object
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
function _count_execs($db, $sql, $inputarray) {
|
function _count_execs($db, $sql, $inputarray) {
|
||||||
global $_shm_execs;
|
global $_shm_query_count;
|
||||||
if ((defined('DEBUG_SQL') && DEBUG_SQL === true) || (!defined('DEBUG_SQL') && @$_GET['DEBUG_SQL'])) {
|
if ((defined('DEBUG_SQL') && DEBUG_SQL === true) || (!defined('DEBUG_SQL') && @$_GET['DEBUG_SQL'])) {
|
||||||
$fp = @fopen("data/sql.log", "a");
|
$fp = @fopen("data/sql.log", "a");
|
||||||
if($fp) {
|
if($fp) {
|
||||||
@ -729,10 +729,10 @@ function _count_execs($db, $sql, $inputarray) {
|
|||||||
#log_error("core", "failed to open sql.log for appending");
|
#log_error("core", "failed to open sql.log for appending");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is_array($inputarray)) $_shm_execs++;
|
if (!is_array($inputarray)) $_shm_query_count++;
|
||||||
# handle 2-dimensional input arrays
|
# handle 2-dimensional input arrays
|
||||||
else if (is_array(reset($inputarray))) $_shm_execs += sizeof($inputarray);
|
else if (is_array(reset($inputarray))) $_shm_query_count += sizeof($inputarray);
|
||||||
else $_shm_execs++;
|
else $_shm_query_count++;
|
||||||
# in PHP4.4 and PHP5, we need to return a value by reference
|
# in PHP4.4 and PHP5, we need to return a value by reference
|
||||||
$null = null; return $null;
|
$null = null; return $null;
|
||||||
}
|
}
|
||||||
@ -1501,7 +1501,7 @@ $_shm_load_start = microtime(true);
|
|||||||
* @return string debug info to add to the page.
|
* @return string debug info to add to the page.
|
||||||
*/
|
*/
|
||||||
function get_debug_info() {
|
function get_debug_info() {
|
||||||
global $config, $_shm_event_count, $database, $_shm_execs, $_shm_load_start;
|
global $config, $_shm_event_count, $database, $_shm_query_count, $_shm_load_start;
|
||||||
|
|
||||||
$i_mem = sprintf("%5.2f", ((memory_get_peak_usage(true)+512)/1024)/1024);
|
$i_mem = sprintf("%5.2f", ((memory_get_peak_usage(true)+512)/1024)/1024);
|
||||||
|
|
||||||
@ -1518,7 +1518,7 @@ function get_debug_info() {
|
|||||||
$miss = $database->cache->get_misses();
|
$miss = $database->cache->get_misses();
|
||||||
|
|
||||||
$debug = "<br>Took $time seconds (db:$dbtime) and {$i_mem}MB of RAM";
|
$debug = "<br>Took $time seconds (db:$dbtime) and {$i_mem}MB of RAM";
|
||||||
$debug .= "; Used $i_files files and $_shm_execs queries";
|
$debug .= "; Used $i_files files and $_shm_query_count queries";
|
||||||
$debug .= "; Sent $_shm_event_count events";
|
$debug .= "; Sent $_shm_event_count events";
|
||||||
$debug .= "; $hits cache hits and $miss misses";
|
$debug .= "; $hits cache hits and $miss misses";
|
||||||
$debug .= "; Shimmie version ". VERSION . $commit; // .", SCore Version ". SCORE_VERSION;
|
$debug .= "; Shimmie version ". VERSION . $commit; // .", SCore Version ". SCORE_VERSION;
|
||||||
|
@ -19,14 +19,14 @@ class StatsDInterface extends Extension {
|
|||||||
public static $stats = array();
|
public static $stats = array();
|
||||||
|
|
||||||
private function _stats($type) {
|
private function _stats($type) {
|
||||||
global $config, $_shm_event_count, $database, $_shm_execs, $_shm_load_start;
|
global $config, $_shm_event_count, $database, $_shm_query_count, $_shm_load_start;
|
||||||
$time = microtime(true) - $_shm_load_start;
|
$time = microtime(true) - $_shm_load_start;
|
||||||
StatsDInterface::$stats["shimmie.$type.hits"] = "1|c";
|
StatsDInterface::$stats["shimmie.$type.hits"] = "1|c";
|
||||||
StatsDInterface::$stats["shimmie.$type.time"] = "$time|ms";
|
StatsDInterface::$stats["shimmie.$type.time"] = "$time|ms";
|
||||||
StatsDInterface::$stats["shimmie.$type.time-db"] = "{$database->dbtime}|ms";
|
StatsDInterface::$stats["shimmie.$type.time-db"] = "{$database->dbtime}|ms";
|
||||||
StatsDInterface::$stats["shimmie.$type.memory"] = memory_get_peak_usage(true)."|c";
|
StatsDInterface::$stats["shimmie.$type.memory"] = memory_get_peak_usage(true)."|c";
|
||||||
StatsDInterface::$stats["shimmie.$type.files"] = count(get_included_files())."|c";
|
StatsDInterface::$stats["shimmie.$type.files"] = count(get_included_files())."|c";
|
||||||
StatsDInterface::$stats["shimmie.$type.queries"] = $_shm_execs."|c";
|
StatsDInterface::$stats["shimmie.$type.queries"] = $_shm_query_count."|c";
|
||||||
StatsDInterface::$stats["shimmie.$type.events"] = $_shm_event_count."|c";
|
StatsDInterface::$stats["shimmie.$type.events"] = $_shm_event_count."|c";
|
||||||
StatsDInterface::$stats["shimmie.$type.cache-hits"] = $database->cache->get_hits()."|c";
|
StatsDInterface::$stats["shimmie.$type.cache-hits"] = $database->cache->get_hits()."|c";
|
||||||
StatsDInterface::$stats["shimmie.$type.cache-misses"] = $database->cache->get_misses()."|c";
|
StatsDInterface::$stats["shimmie.$type.cache-misses"] = $database->cache->get_misses()."|c";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user