<@doc> A utility Class for performning perfomnace measurements Instances of this class are created automatically by the system, and should not be created directly. (c) SAP AG 2003-2006. All rights reserved. Class PerformanceMng; <@doc> Constructs and initializes an BaseChannel object The unique channel identifier constructor(id) this.msg=[]; this.times=[]; //this.begin('begin measurements'); end <@doc scope="private" >A collection of all massages readonly property msgs = []; <@doc scope="private" >A collection of all the time stamps readonly property times = []; <@doc scope="private" >A collection of all the records keys readonly property keys = {}; <@doc scope="private">Gets the folder name readonly property folderName = 'C:\\VCLogs\\'; <@doc scope="private">Gets the file name readonly property fileName = (new Date()).getTime() + '__LOG'; <@doc scope="private" >Gets log counter readonly property logCounter = 0; <@doc >log output in the console readonly property CONSOLE = 0x01; <@doc >log output in the local directory of the user readonly property FILE = 0x02; <@doc scope="private" >Gets the log output device readonly property outputDevice = 0x02 | 0x01 ; <@doc scope="private" >Gets and Sets whether to activate the performance checks in the GML DOM readonly property disabled = false; <@doc scope="private" >Gets and Sets the statistics mode readonly property statisticsMode = false; /////////////////////////////////////////////////////////////////////// // METHODS <@doc> Sets the starting time of the performance measurment. Important Notes: Make sure that for each PTIMESTART call there is a corresponding PTIMEEND call. The log is printed to the console and to the following folder C:\VCLogs so make sure that this folder exist on your machine. Configure the security setting in your browser to allow ActiveX component, so the logs could be written to your local hard-drive. Description to be printed to the log. method begin(desc) //if(this.disabled) return; var caller = arguments.callee.caller; var mName = caller && caller.name || 'Undefined'; var cName = caller && caller.Class && caller.Class.fullname || 'Undefined'; this.times.push({key:desc||(cName+' ' + mName), start:new Date()}); if (!this.statisticsMode){ var str = []; str.push(""); this.msgs.push( str.join('') ); } end <@doc> Sets the ending time of the performance measurment. method end() //if(this.disabled) return; if (this.times.length == 0){ this.clear('PTIME WAS ENDED WITH ERRORS.'); return; } if (this.times.length == 1){ var record = this.times.pop(); var time = new Date() - record.start; if(this.statisticsMode) { var obj = this.keys[record.key]; if(!obj) obj = this.keys[record.key] = {hits:0, total:0}; obj.hits++; obj.total += time; }else { this.msgs.push(""); } //this.log(true); return; } var record = this.times.pop(); var time = new Date() - record.start; if(this.statisticsMode) { var obj = this.keys[record.key]; if(!obj) obj = this.keys[record.key] = {hits:0, total:0}; obj.hits++; obj.total += time; }else { this.msgs.push("