Exemplo n.º 1
0
 /**
  * Build the graph and draw component on it
  * Image is sent to the user browser
  *
  * @param string $file Save the image in the specified file. Let it null to print image to screen.
  */
 public function draw($file = NULL)
 {
     if ($this->timing) {
         $time = microtimeFloat();
     }
     $this->create();
     foreach ($this->components as $component) {
         $this->drawComponent($component);
     }
     $this->drawTitle();
     $this->drawShadow();
     $this->drawLabels();
     if ($this->timing) {
         $this->drawTiming(microtimeFloat() - $time);
     }
     $this->send($file);
     if ($file === NULL) {
         $data = ob_get_contents();
         if ($this->name !== NULL) {
             if (is_writable(ARTICHOW . "/cache") === FALSE) {
                 trigger_error("Cache directory is not writable");
             }
             $file = ARTICHOW . "/cache/" . $this->name . "";
             file_put_contents($file, $data);
             $file .= "-time";
             file_put_contents($file, $this->timeout . "\n" . $this->getFormat());
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Build the graph and draw component on it
  *
  * @param string $mode Display mode (can be a file name)
  */
 public function draw($mode = Graph::DRAW_DISPLAY)
 {
     if ($this->timing) {
         $time = microtimeFloat();
     }
     $this->create();
     foreach ($this->components as $component) {
         $this->drawComponent($component);
     }
     $this->drawTitle();
     $this->drawShadow();
     $this->drawLabels();
     if ($this->timing) {
         $this->drawTiming(microtimeFloat() - $time);
     }
     // Create graph
     $data = $this->get();
     // Put the graph in the cache if needed
     $this->cache($data);
     switch ($mode) {
         case Graph::DRAW_DISPLAY:
             $this->sendHeaders();
             echo $data;
             break;
         case Graph::DRAW_RETURN:
             return $data;
         default:
             if (is_string($mode)) {
                 file_put_contents($mode, $data);
             } else {
                 awImage::drawError("Class Graph: Unable to draw the graph.");
             }
     }
 }
 static function SetExecutionPoint($_partId)
 {
     self::$Rendertimes[] = array($_partId, microtimeFloat(microtime()));
 }
Exemplo n.º 4
0
            require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php";
            getTranslationData();
        } else {
            $RESPONSE->SetValidationError(AUTH_RESULT);
        }
    }
}
if (defined("VALIDATED") && LOGOFF) {
    $INTERNAL[CALLER_SYSTEM_ID]->GetExternalObjects();
    foreach ($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats as $chat) {
        $chat->InternalClose();
    }
}
if (defined("VALIDATED") && !SERVERSETUP) {
    if (isset($_POST[POST_GLOBAL_TYPING])) {
        $INTERNAL[CALLER_SYSTEM_ID]->Typing = $_POST[POST_GLOBAL_TYPING];
    }
    $INTERNAL[CALLER_SYSTEM_ID]->Save();
}
if (LOGIN && DB_ACCESS_REQUIRED) {
    require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php";
    $res = testDataBase($CONFIG["gl_db_host"], $CONFIG["gl_db_user"], $CONFIG["gl_db_pass"], $CONFIG["gl_db_name"], $CONFIG["gl_db_prefix"]);
    if (!empty($res)) {
        $RESPONSE->SetValidationError(LOGIN_REPLY_DB, $res);
    }
}
$RESPONSE->GlobalHash = empty($RESPONSE->Messages) && empty($RESPONSE->Ratings) && empty($RESPONSE->Resources) && empty($RESPONSE->Archive) ? substr(md5($RESPONSE->XML), 0, 5) : "";
$RESPONSE->XML = $_POST[POST_INTERN_SERVER_ACTION] != INTERN_ACTION_LISTEN || isset($_POST[POST_GLOBAL_XMLCLIP_HASH_ALL]) && $_POST[POST_GLOBAL_XMLCLIP_HASH_ALL] != $RESPONSE->GlobalHash ? str_replace("<!--gl_all-->", base64_encode(substr(md5($RESPONSE->XML), 0, 5)), $RESPONSE->XML) : "";
$response = strlen($RESPONSE->XML) > 0 ? $RESPONSE->GetXML() : "";
$response = str_replace("<!--execution_time-->", base64_encode(floor((microtimeFloat(microtime()) - microtimeFloat(ACCESSTIME)) * 1000)), $response);
Exemplo n.º 5
0
$filename = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQF48ToAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL0xrUEhlbDdtUjRRXy01YUJqRzFLAAIEh7MhVwMEECcAAA==';
$icon = 'icon.jpg';
// Get new sizes
list($width, $height) = getimagesize($filename);
list($iconWidth, $iconHeight) = getimagesize($icon);
$startTime = microtimeFloat();
for ($i = 0; $i < 10; $i++) {
    // Load
    $thumb = imagecreatefromjpeg($filename);
    $source = imagecreatefromjpeg($icon);
    // merge
    imagecopy($thumb, $source, ($width - $iconWidth) / 2, ($height - $iconHeight) / 2, 0, 0, $iconWidth, $iconHeight);
    // Output
    imagejpeg($thumb, 'final.jpg');
    unset($thumb, $source);
}
$endTime = microtimeFloat();
echo "时间为", $endTime - $startTime, "\n";
$startTime = microtimeFloat();
for ($i = 0; $i < 10; $i++) {
    // Load
    $thumb = imagecreatefromjpeg($filename);
    $source = imagecreatefromjpeg($icon);
    // merge
    imagecopyresampled($thumb, $source, ($width - $iconWidth) / 2, ($height - $iconHeight) / 2, 0, 0, $iconWidth, $iconHeight, $iconWidth, $iconHeight);
    // Output
    imagejpeg($thumb, 'final.jpg');
    unset($thumb, $source);
}
$endTime = microtimeFloat();
echo "时间为", $endTime - $startTime, "\n";
Exemplo n.º 6
0
            echo "<tr><td>Classification before learning:</td><td>" . formatRating($ratingBefore) . "</td></tr>\n";
            echo "<tr><td>Classification after learning:</td><td>" . formatRating($ratingAfter) . "</td></tr>\n";
            echo "</table></div>\n\n";
            break;
        case "Delete from Spam":
            $b8->unlearn($text, b8::SPAM);
            echo "<p style=\"color:green\">Deleted the text from Spam</p>\n\n";
            break;
        case "Delete from Ham":
            $b8->unlearn($text, b8::HAM);
            echo "<p style=\"color:green\">Deleted the text from Ham</p>\n\n";
            break;
    }
    $mem_used = round(memory_get_usage() / 1048576, 5);
    $peak_mem_used = round(memory_get_peak_usage() / 1048576, 5);
    $time_taken = round(microtimeFloat() - $time_start, 5);
}
echo <<<END
<div>
<form action="{$_SERVER['PHP_SELF']}" method="post">
<div>
<textarea name="text" cols="50" rows="16">{$postedText}</textarea>
</div>
<table>
<tr>
<td><input type="submit" name="action" value="Classify" /></td>
</tr>
<tr>
<td><input type="submit" name="action" value="Save as Spam" /></td>
<td><input type="submit" name="action" value="Save as Ham" /></td>
</tr>
Exemplo n.º 7
0
 /**
  * adds msg to static logs in this class
  * @param string $msg
  */
 public static function addFileLog($msg)
 {
     $time = microtimeFloat() - cLogsDb::$startLogs;
     cLogsDb::$aDbFileLogs[] = getDateToPrint(mktime(), "m-d-Y H:i:s") . " + {$time}\n\t" . $msg . "\n";
     //$this->addLog($msg,"MYSQL ERROR", "_dbLog _error");
 }
Exemplo n.º 8
0
function endTimer() {
	global $TIMER;
	return microtimeFloat() - $TIMER;
}
Exemplo n.º 9
0
}
/**
 * main service function.
 * @param type $idArr
 */
function execute($idArr)
{
    $result['status'] = 0;
    $result['data'] = getMgsCegDescCate($idArr);
    echo json_encode($result);
}
/**
 * print the error info. 
 */
function printParamErr()
{
    $err['status'] = 1;
    $err['error'] = 'An error has occurred in parameter.';
    echo json_encode($err);
}
function microtimeFloat()
{
    list($uesc, $sec) = explode(" ", microtime());
    return (double) $uesc + (double) $sec;
}
$startTime = microtimeFloat();
init();
$runTime = number_format(microtimeFloat() - $startTime, 4);
echo '<br><br>';
echo $runTime;
echo " s";