精緻な時間を計測する関数セット。
主に自分がJavaScriptで演算時間を計る為に作っていた、細かい時間を計測する関数セットです。使い方はJSファイルの中に記載されています。
関数の操作サンプル。各プロトタイプ関数の実行はボタンで行え、結果とDebugをテキストフィールドに表示します。尚、このページが開かれた瞬間に、オブジェクトは生成され測定は開始済みとなっています。
function Cost()
{
var new_Times = new Date;
this.isCost = true;
this.isStop = false;
this.type = "cost";
this.Start = new_Times.getTime();
this.End = this.Start;
this.Total = 0;
this.lap_sta = this.Start;
this.lap_end = 0;
this.lap_time = 0;
}
Cost.prototype._End = function()
{
var new_Times = new Date;
this.End = new_Times.getTime();
this.Total += this.End-this.Start;
this.isStop = true;
}
Cost.prototype._ReStart = function()
{
var new_Times = new Date;
this.Start = new_Times.getTime();
this.End = this.Start;
this.isStop = false;
}
Cost.prototype._Refresh = function()
{
var new_Times = new Date;
this.isStop = false;
this.Start = new_Times.getTime();
this.End = this.Start;
this.Total = 0;
}
Cost.prototype._Lap_s = function()
{
var new_Times = new Date;
this.lap_sta = new_Times.getTime();
this.lap_end = 0;
this.lap_time = 0;
}
Cost.prototype._Lap_e = function()
{
var new_Times = new Date;
this.lap_end = new_Times.getTime();
this.lap_time = this.lap_end-this.lap_sta;
}