more sensible naming

This commit is contained in:
Shish 2015-08-02 21:23:45 +01:00
parent 6e56224b8d
commit ec5d9bb6f4
2 changed files with 9 additions and 9 deletions

View file

@ -700,14 +700,14 @@ function getExtension ($mime_type){
}
$_shm_execs = 0;
$_shm_query_count = 0;
/**
* $db is the connection object
*
* @private
*/
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'])) {
$fp = @fopen("data/sql.log", "a");
if($fp) {
@ -729,10 +729,10 @@ function _count_execs($db, $sql, $inputarray) {
#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
else if (is_array(reset($inputarray))) $_shm_execs += sizeof($inputarray);
else $_shm_execs++;
else if (is_array(reset($inputarray))) $_shm_query_count += sizeof($inputarray);
else $_shm_query_count++;
# in PHP4.4 and PHP5, we need to return a value by reference
$null = null; return $null;
}
@ -1501,7 +1501,7 @@ $_shm_load_start = microtime(true);
* @return string debug info to add to the page.
*/
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);
@ -1518,7 +1518,7 @@ function get_debug_info() {
$miss = $database->cache->get_misses();
$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 .= "; $hits cache hits and $miss misses";
$debug .= "; Shimmie version ". VERSION . $commit; // .", SCore Version ". SCORE_VERSION;

View file

@ -19,14 +19,14 @@ class StatsDInterface extends Extension {
public static $stats = array();
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;
StatsDInterface::$stats["shimmie.$type.hits"] = "1|c";
StatsDInterface::$stats["shimmie.$type.time"] = "$time|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.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.cache-hits"] = $database->cache->get_hits()."|c";
StatsDInterface::$stats["shimmie.$type.cache-misses"] = $database->cache->get_misses()."|c";