Beispiel #1
0
 public function debugHelper()
 {
     echo "<pre>";
     echo "<b>Kajona V4 Debug Subsystem</b>\n\n";
     if (getGet("debugfile") != "") {
         echo "Loading path for " . getGet("debugfile") . "\n";
         $strPath = array_search(getGet("debugfile"), class_resourceloader::getInstance()->getFolderContent("/debug", array(".php")));
         if ($strPath !== false) {
             echo "Passing request to " . $strPath . "\n\n";
             include _realpath_ . $strPath;
         }
     } else {
         echo "Searching for debug-scripts available...\n";
         $arrFiles = class_resourceloader::getInstance()->getFolderContent("/debug", array(".php"));
         echo "<ul>";
         foreach ($arrFiles as $strPath => $strOneFile) {
             echo "<li><a href='?debugfile=" . $strOneFile . "' >" . $strOneFile . "</a> <br />" . $strPath . "</li>";
         }
         echo "</ul>";
     }
     $arrTimestampEnde = gettimeofday();
     $intTimeUsed = ($arrTimestampEnde['sec'] * 1000000 + $arrTimestampEnde['usec'] - ($this->arrTimestampStart['sec'] * 1000000 + $this->arrTimestampStart['usec'])) / 1000000;
     echo "\n\n<b>PHP-Time:</b>                              " . number_format($intTimeUsed, 6) . " sec \n";
     echo "<b>Queries db/cachesize/cached/fired:</b>     " . class_carrier::getInstance()->getObjDB()->getNumber() . "/" . class_carrier::getInstance()->getObjDB()->getCacheSize() . "/" . class_carrier::getInstance()->getObjDB()->getNumberCache() . "/" . (class_carrier::getInstance()->getObjDB()->getNumber() - class_carrier::getInstance()->getObjDB()->getNumberCache()) . "\n";
     echo "<b>Templates cached:</b>                      " . class_carrier::getInstance()->getObjTemplate()->getNumberCacheSize() . " \n";
     echo "<b>Memory/Max Memory:</b>                     " . bytesToString(memory_get_usage()) . "/" . bytesToString(memory_get_peak_usage()) . " \n";
     echo "<b>Classes Loaded:</b>                        " . class_classloader::getInstance()->getIntNumberOfClassesLoaded() . " \n";
     echo "<b>Cache requests/hits/saves/cachesize:</b>   " . class_cache::getIntRequests() . "/" . class_cache::getIntHits() . "/" . class_cache::getIntSaves() . "/" . class_cache::getIntCachesize() . " \n";
     echo "</pre>";
 }
Beispiel #2
0
 protected function printDebugValues()
 {
     $strDebug = "";
     $arrTimestampEnde = gettimeofday();
     $intTimeUsed = ($arrTimestampEnde['sec'] * 1000000 + $arrTimestampEnde['usec'] - ($this->arrTestStartDate['sec'] * 1000000 + $this->arrTestStartDate['usec'])) / 1000000;
     $strDebug .= "PHP-Time:                            " . number_format($intTimeUsed, 6) . " sec \n";
     //Hows about the queries?
     $strDebug .= "Queries db/cachesize/cached/fired:   " . class_carrier::getInstance()->getObjDB()->getNumber() . "/" . class_carrier::getInstance()->getObjDB()->getCacheSize() . "/" . class_carrier::getInstance()->getObjDB()->getNumberCache() . "/" . (class_carrier::getInstance()->getObjDB()->getNumber() - class_carrier::getInstance()->getObjDB()->getNumberCache()) . " \n";
     //anything to say about the templates?
     $strDebug .= "Templates cached:                    " . class_carrier::getInstance()->getObjTemplate()->getNumberCacheSize() . " \n";
     //memory
     $strDebug .= "Memory/Max Memory:                   " . bytesToString(memory_get_usage()) . "/" . bytesToString(memory_get_peak_usage()) . " \n";
     $strDebug .= "Classes Loaded:                      " . class_classloader::getInstance()->getIntNumberOfClassesLoaded() . " \n";
     //and check the cache-stats
     $strDebug .= "Cache requests/hits/saves/cachesize: " . class_cache::getIntRequests() . "/" . class_cache::getIntHits() . "/" . class_cache::getIntSaves() . "/" . class_cache::getIntCachesize() . " \n";
     //echo get_called_class()."\n".$strDebug."\n";
 }
 /**
  * Generates debugging-infos, but only in non-xml mode
  *
  * @param string $strReturn
  *
  * @return string
  */
 private function getDebugInfo($strReturn)
 {
     $strDebug = "";
     if (_timedebug_ || _dbnumber_ || _templatenr_ || _memory_) {
         //Maybe we need the time used to generate this page
         if (_timedebug_ === true) {
             $arrTimestampEnde = gettimeofday();
             $intTimeUsed = ($arrTimestampEnde['sec'] * 1000000 + $arrTimestampEnde['usec'] - ($this->arrTimestampStart['sec'] * 1000000 + $this->arrTimestampStart['usec'])) / 1000000;
             $strDebug .= "<b>PHP-Time:</b> " . number_format($intTimeUsed, 6) . " sec ";
         }
         //Hows about the queries?
         if (_dbnumber_ === true) {
             $strDebug .= "<b>Queries db/cachesize/cached/fired:</b> " . class_carrier::getInstance()->getObjDB()->getNumber() . "/" . class_carrier::getInstance()->getObjDB()->getCacheSize() . "/" . class_carrier::getInstance()->getObjDB()->getNumberCache() . "/" . (class_carrier::getInstance()->getObjDB()->getNumber() - class_carrier::getInstance()->getObjDB()->getNumberCache()) . " ";
         }
         //anything to say about the templates?
         if (_templatenr_ === true) {
             $strDebug .= "<b>Templates cached:</b> " . class_carrier::getInstance()->getObjTemplate()->getNumberCacheSize() . " ";
         }
         //memory
         if (_memory_ === true) {
             $strDebug .= "<b>Memory/Max Memory:</b> " . bytesToString(memory_get_usage()) . "/" . bytesToString(memory_get_peak_usage()) . " ";
             $strDebug .= "<b>Classes Loaded:</b> " . class_classloader::getInstance()->getIntNumberOfClassesLoaded() . " ";
         }
         //and check the cache-stats
         if (_cache_ === true) {
             $strDebug .= "<b>Cache requests/hits/saves/cachesize:</b> " . class_cache::getIntRequests() . "/" . class_cache::getIntHits() . "/" . class_cache::getIntSaves() . "/" . class_cache::getIntCachesize() . " ";
         }
         if (_xmlLoader_ === true) {
             class_response_object::getInstance()->addHeader("Kajona Debug: " . $strDebug);
         } else {
             $strDebug = "<pre style='z-index: 2000000; position: fixed; background-color: white; width: 100%; top: 0px; font-size: 10px; padding: 0; margin: 0;'>Kajona Debug: " . $strDebug . "</pre>";
             $intBodyPos = uniStrpos($strReturn, "</body>");
             if ($intBodyPos !== false) {
                 $strReturn = uniSubstr($strReturn, 0, $intBodyPos) . $strDebug . uniSubstr($strReturn, $intBodyPos);
             } else {
                 $strReturn = $strDebug . $strReturn;
             }
         }
     }
     return $strReturn;
 }