flymis/WebRoot/dojojs/src/profile.js

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/community/licensing.shtml
*/

dojo.provide("dojo.profile");

// summary:
//		provides a manual profiling utility that can be used to gather relative
//		timing data.


// FIXME: need to tie into the event system or provide a closure-based way to
// watch timings of functions without manually instrumenting them.
// FIXME: need to make the dump() function work in command line environments

dojo.profile = {
	_profiles: {},
	_pns: [],

	start:function(/*String*/ name){
		// summary:
		//		start an iteration for the profiling target with the specified
		//		name. If a previously started iteration has not yet been ended
		//		for this name, it's automatically closed out and a new
		//		iteration begun.
		// name:
		//		a unique name to identify the thing being profiled
		if(!this._profiles[name]){
			this._profiles[name] = {iters: 0, total: 0};
			this._pns[this._pns.length] = name;
		}else{
			if(this._profiles[name]["start"]){
				this.end(name);
			}
		}
		this._profiles[name].end = null;
		this._profiles[name].start = new Date();
	},

	end:function(/*String*/ name){
		// summary:
		//		closes a timing loop for the named profiling target
		// name:
		//		a unique name to identify the thing being profiled. The name
		//		passed to end() should be the same as that passed to start()
		var ed = new Date();
		if((this._profiles[name])&&(this._profiles[name]["start"])){
			with(this._profiles[name]){
				end = ed;
				total += (end - start);
				start = null;
				iters++;
			}
		}else{
后面还有 86 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。