summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc94ac4)
raw | patch | inline | side by side (parent: fc94ac4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 2 Aug 2010 15:05:47 +0000 (15:05 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 2 Aug 2010 15:05:47 +0000 (15:05 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19344 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_stats.inc | patch | blob | history |
index 9d6517c3d3cf4d882bfc58987afd4303c96af44e..c8631ce2e0302cb3f93caf21c3d9525043868349 100644 (file)
$TABLE_NAME = stats::$tableName;
$query = "DROP TABLE '{$TABLE_NAME}'";
$ret = sqlite_query($query, $handle);
+ stats::$lastHandle = NULL;
+ stats::getDatabaseHandle();
}
// Get database handle, if it is invalid (NULL) return without creating stats
$res = stats::getDatabaseHandle();
+# stats::dropTable($res);
if(!$res) return;
// Ensure that 'clicks' and 'overallRenderTimer' are present and set correctly,
// -- 'clicks' is a counter wich is set in main.php -> Number of page reloads
// -- 'overallRenderTimer' is set in main.php -> timestamp of rendering start.
if(!isset($clicks) || empty($clicks)) $clicks = 0;
- if(!isset($overallRenderTimer) || empty($overallRenderTimer)){
+ if(!isset($overallRenderTimer)){
$renderTime = 0;
}else{
$renderTime = microtime(TRUE) - $overallRenderTimer;
$overallRenderTimer = microtime(TRUE);
}
+ // Enforce floating point values ...damn this sucks.
+ $duration += 0.000001;
+ $renderTime += 0.000001;
+
+ $duration = sprintf("%0.6f",$duration);
+ $renderTime = sprintf("%0.6f",$renderTime);
+
+ $duration = preg_replace("/\./",",",$duration);
+ $renderTime = preg_replace("/\./",",",$renderTime);
+
// Prepare values to be useable within a database
$uuid = $config->getGOsaUUID();
$type = sqlite_escape_string($type);
$info = sqlite_escape_string($info);
$clicks = sqlite_escape_string($clicks);
$memory_usage = sqlite_escape_string(stats::get_memory_usage());
- $cpu_load = sqlite_escape_string(stats::get_cpu_load());
+ $cpu_load = sqlite_escape_string(sprintf("%0.6f",stats::get_cpu_load()));
// Clean up category, which usally comes from acl_category and may still contain
// some special chars like /
static function show()
{
$res = stats::getDatabaseHandle();
+# stats::dropTable($res);
if(!$res) return;
$TABLE_NAME = stats::$tableName;
}
echo sqlite_error_string($ret);
+
+ echo "\n------ \n";
+ echo "Rendertime per plugin\n";
+ echo "------ \n";
+
+ $query = "
+ SELECT PLUGIN, RENDER_TIME * 1000000 AS RM
+ FROM {$TABLE_NAME}
+ GROUP BY PLUGIN
+ ";
+ $ret = sqlite_query($query, $res);
+
+ $colSize = 16;
+ $title = FALSE;
+ foreach(sqlite_fetch_all($ret) as $entry){
+ foreach($entry as $key => $str){
+ if(is_numeric($key)) continue;
+ echo str_pad($str,$colSize,' ')."|";
+ }
+ echo "\n";
+ }
+ echo sqlite_error_string($ret);
+
echo "</pre>";
}
}