File "Stopwatch.php"

Full path: /www/ansys/qgis/005_honmoku/messages/class/Stopwatch.php
File size: 1.17 KiB (1198 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//	ストップウォッチ
//	クラス名:	cStopwatch
//	備考	:	
//	更新	:	2012/10/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
class Stopwatch
{
	private $_start;
	private static $_instance;
	
	//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	//	コンストラクタ
	//	更新	:	2012/10/18 KMK-Teraoka
	//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	private function __construct()
	{
		$this->_start = microtime(true);
	}
	
	//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	//	計測を開始する
	//	更新	:	2012/10/18 KMK-Teraoka
	//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	public static function start()
	{
		if (isset(self::$_instance))
		{
			return self::$_instance;
		}
		else
		{
			return self::$_instance = new self();
		}
	}
	
	//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	//	デクストラクタ
	//	更新	:	2012/10/18 KMK-Teraoka
	//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
	public function __destruct()
	{
		print "<font color=\"#989898\">";
		print "speed=>";
		print microtime(true) - $this->_start;
		print "[ms]";
		print "</font>";
	}
}
?>

PHP File Manager