The GlobalMemoryDump represents a simultaneous memory dump of all
processes.
@constructor
508212
function GlobalMemoryDump(model, start) {
    tr.model.ContainerMemoryDump.call(this, start);
    this.model = model;
    this.processMemoryDumps = {};
  }
957691
function log (message) {
  if (!global.testing && !global.isModuleUse) {
    console.log(message)
  } else {
    debug(message)
  }
}
409001
function(memory) {
        var memoryHistory = this.get('memory');

        if (!memoryHistory) {
            memoryHistory = [];
            this.set({
                memory: memoryHistory
            });
        }

        memoryHistory.push(memory);
        while (memoryHistory.length > this._statHistory) {
            memoryHistory.shift();
        }

        var avg = 0;
        memoryHistory.filter(function(f) {
            return f !== null;
        }).forEach(function(f) {
            avg += f;
        });
        avg /= memoryHistory.length;
        this.set({
            avgMemory: Math.round(avg)
        });
    }
1062431
function main() {
	var fpath;
	var fopts;
	var conf;
	var out;
	var len;
	var i;

	fopts = {
		'encoding': 'utf8'
	};

	len = completions.length;
	debug( 'Generating %d completions files...', len );

	for ( i = 0; i < len; i++ ) {
		conf = completions[ i ];

		debug( 'Generating completions (%s)...', conf.name );
		out = {
			'scope': conf.scope,
			'completions': conf.completions
		};
		out = JSON.stringify( out, null, '\t' );

		debug( 'Writing completions file...' );
		fpath = join( DIR, 'stdlib-'+conf.name+'.sublime-completions' );
		writeFileSync( fpath, out, fopts );

		debug( 'Successfully generated completions file.' );
	}
	debug( 'Finished generating completions files.' );
}
82417
function ContainerMemoryDump(start) {
    tr.model.TimedEvent.call(this, start);

    // 'light' or 'detailed' memory dump. See
    // base::trace_event::MemoryDumpLevelOfDetail in the Chromium
    // repository.
    this.levelOfDetail = undefined;

    this.memoryAllocatorDumps_ = undefined;
    this.memoryAllocatorDumpsByFullName_ = undefined;
  }
593069
function main() {
	var len;
	var min;
	var max;
	var f;
	var i;

	min = 1; // 10^min
	max = 6; // 10^max

	for ( i = min; i <= max; i++ ) {
		len = pow( 10, i );
		f = createBenchmark( len );
		bench( pkg+':len='+len, f );
	}
}
823999
function() {
      if (this.allObjectEvents_.length === 0)
        return;

      function processEvent(objectEventState) {
        var event = objectEventState.event;
        var thread = objectEventState.thread;
        if (event.name === undefined) {
          this.model_.importWarning({
            type: 'object_parse_error',
            message: 'While processing ' + JSON.stringify(event) + ': ' +
                'Object events require an name parameter.'
          });
        }

        if (event.id === undefined) {
          this.model_.importWarning({
            type: 'object_parse_error',
            message: 'While processing ' + JSON.stringify(event) + ': ' +
                'Object events require an id parameter.'
          });
        }
        var process = thread.parent;
        var ts = timestampFromUs(event.ts);
        var instance;
        if (event.ph === 'N') {
          try {
            instance = process.objects.idWasCreated(
                event.id, event.cat, event.name, ts);
          } catch (e) {
            this.model_.importWarning({
              type: 'object_parse_error',
              message: 'While processing create of ' +
                  event.id + ' at ts=' + ts + ': ' + e
            });
            return;
          }
        } else if (event.ph === 'O') {
          if (event.args.snapshot === undefined) {
            this.model_.importWarning({
              type: 'object_parse_error',
              message: 'While processing ' + event.id + ' at ts=' + ts + ': ' +
                  'Snapshots must have args: {snapshot: ...}'
            });
            return;
          }
          var snapshot;
          try {
            var args = this.deepCopyIfNeeded_(event.args.snapshot);
            var cat;
            if (args.cat) {
              cat = args.cat;
              delete args.cat;
            } else {
              cat = event.cat;
            }

            var baseTypename;
            if (args.base_type) {
              baseTypename = args.base_type;
              delete args.base_type;
            } else {
              baseTypename = undefined;
            }
            snapshot = process.objects.addSnapshot(
                event.id, cat, event.name, ts,
                args, baseTypename);
            snapshot.snapshottedOnThread = thread;
          } catch (e) {
            this.model_.importWarning({
              type: 'object_parse_error',
              message: 'While processing snapshot of ' +
                  event.id + ' at ts=' + ts + ': ' + e
            });
            return;
          }
          instance = snapshot.objectInstance;
        } else if (event.ph === 'D') {
          try {
            process.objects.idWasDeleted(event.id, event.cat, event.name, ts);
            var instanceMap = process.objects.getOrCreateInstanceMap_(event.id);
            instance = instanceMap.lastInstance;
          } catch (e) {
            this.model_.importWarning({
              type: 'object_parse_error',
              message: 'While processing delete of ' +
                  event.id + ' at ts=' + ts + ': ' + e
            });
            return;
          }
        }

        if (instance)
          instance.colorId = getEventColor(event, instance.typeName);
      }

      this.allObjectEvents_.sort(function(x, y) {
        var d = x.event.ts - y.event.ts;
        if (d != 0)
          return d;
        return x.sequenceNumber - y.sequenceNumber;
      });

      var allObjectEvents = this.allObjectEvents_;
      for (var i = 0; i < allObjectEvents.length; i++) {
        var objectEventState = allObjectEvents[i];
        try {
          processEvent.call(this, objectEventState);
        } catch (e) {
          this.model_.importWarning({
            type: 'object_parse_error',
            message: e.message
          });
        }
      }
    }
268994
function() {
                // Force anything that is inlined onto the stack so we don't have duplication
                // when we examine local
                this.flushInline();
                var local = this.popStack();
                this.pushSource('if (' + local + ' != null) { ' + this.appendToBuffer(local) + ' }');
                if (this.environment.isSimple) {
                    this.pushSource("else { " + this.appendToBuffer("''") + " }");
                }
            }
1356115
function InMemoryStorage() {

	var store = {};
    var self = this;

	this.getItem = function(key) {
		return store[key] || null;
	};

	this.setItem = function(key, value) {
		store[key] = value;
        updateLength();
	};

	this.removeItem = function(key) {
		delete store[key];
        updateLength();
	};

	this.clear = function() {
		store = {};
        updateLength();
	};

    function updateLength() {
        self.length = Object.keys(store).length
    }

    updateLength();
}
479015
public static synchronized void dumpTraceMemory() {
		LogRepositoryWriter writer = getBinaryHandler().getTraceWriter();
		if (writer instanceof LogRepositoryWriterCBuffImpl) {
			((LogRepositoryWriterCBuffImpl) writer).dumpItems();
		}
	}
1344967
function (storeOrEditor, fn) {
    debug('Processing entries in in-memory store.');
    var store = (storeOrEditor && storeOrEditor.store ? storeOrEditor.store : storeOrEditor);
    store.each(function (file) {
      fn.call(this, file, store);
    });
  }
831356
function () {
                stateMemory.discarded = [];
                if (this._isIE7OrLess) {
                    stateMemory.states = [stateMemory.states[this._currentPos]];
                    return;
                }
                var states = stateMemory.states;
                var expirationTime = ((new Date()).getTime() - this.EXPIRATION_TIME * 1000) + "";
                for (var i = 0; i < states.length; i++) {
                    if (states[i].id > expirationTime) {
                        break;
                    }
                }
                states.splice(0, i);
            }
504882
function dumpAndWrap(fName /*, localDir:string*/, sourceToDump) {
    let p = new Promise(function (resolve) {
        fs.stat(fName, (err, stat) => {
            if (!err) {
                if (stat.isFile()) {
                    logger.debug(`Found a file to wrap at ${fName}`);
                    let stream = fs.createReadStream(fName, {
                        'encoding': 'utf8'
                    });
                    resolve(stream);
                    return;
                }
                logger.error(`Should not be here:\n ${util.format(stat)}`);
            }
            else {
                logger.warn(`cant find file ${fName}`);
                if (sourceToDump) {
                    logger.debug(`Found alternative source dumping it from \n ${util.format(sourceToDump)}`);
                    let target = fs.createWriteStream(fName, { 'flags': 'a' });
                    sourceToDump.pipe(target);
                    target.on('close', () => {
                        let stream = fs.createReadStream(fName, {
                            'encoding': 'utf8'
                        });
                        logger.debug(`should resolve with ${util.format(stream)}`);
                        resolve(stream);
                        return;
                    });
                }
                else {
                    logger.error("Output file error, Still cant open output file, returning empy stream");
                    let dummyStream = new streamLib.Readable();
                    dummyStream.push(null);
                    resolve(dummyStream);
                    return;
                }
            }
        });
    });
    return p;
}
767112
function(){
	// init a timer
	var _this	= this;
	var timerid	= null;
	// define function to return used heap size
	var inNode	= typeof(window) === 'undefined' ? true : false;
	var usedHeapSize= inNode ? function(){
		return process.memoryUsage().heapUsed;	
	} : function(){
		if( !window.performance || !window.performance.memory )	return 0;
		return window.performance.memory.usedJSHeapSize;	
	};

	// sanity check - if not available, output a warning
	if( GcMonitor.isAvailable() === false ){
		// open -a "/Applications/Google Chrome.app" --args --enable-memory-info
		console.warn('memory info are unavailable... for chrome, use --enable-memory-info. Other browsers dont have this feature.')
	}

	/**
	 * Start monitoring periodically
	 * 
	 * @param {Function|undefined} onChange optional function to notify when gc occurs
	 * @param {Number|undefined} period period of the check. default to 50ms
	 */
	this.start	= function(onChange, period){
		period	= period	|| 1000/60;
		onChange= onChange	|| function(delta){
			function bytesToSize(bytes, nFractDigit) {
				var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
				if (bytes == 0) return '0';
				nFractDigit	= nFractDigit !== undefined ? nFractDigit : 2;
				var precision	= Math.pow(10, nFractDigit);
				var i 		= Math.floor(Math.log(bytes) / Math.log(1024));
				return Math.round(bytes*precision / Math.pow(1024, i))/precision + ' ' + sizes[i];
			};
			console.warn(new Date + " -- GC occured! saved", bytesToSize(delta), 'consuming at', bytesToSize(burnRate), 'per second')
		}
		timerid	= setInterval(function(){
			_this.check(onChange);
		}, period);
		return this;	// for chained api
	};
	/**
	 * Stop monitoring periodically
	 */
	this.stop	= function(){
		cancelInterval(timerid);	
	};
	
	var lastUsedHeap	= null;
	var lastTimestamp	= null;
	var burnRate		= null;	
	/**
	 * Check if currently used memory is less than previous check. If so it 
	 * is assume a GC occured
	 * 
	 * @param  {Function|undefined} onChange callback notified synchronously if gc occured
	 */
	this.check	= function(onChange){
		// parameter polymorphism
		onChange	= onChange || function(property){}

		var present	= Date.now();//console.log('present', (present - lastTimestamp)/1000)
		var currUsedSize= usedHeapSize();

		if( lastUsedHeap === null ){
			lastUsedHeap	= currUsedSize;
			lastTimestamp	= present;
			return;
		}

		// check if the heap size in this cycle is LESS than what we had last
		// cycle; if so, then the garbage collector has kicked in
		var deltaMem	= currUsedSize - lastUsedHeap;
		if( deltaMem < 0 ){
			onChange(-deltaMem, burnRate);		
		}else{
			var deltaTime	= present - lastTimestamp
			var newBurnrate	= deltaMem / (deltaTime/1000);
			if( burnRate === null )	burnRate	= newBurnrate;
			var friction	= 0.99;
			burnRate	= burnRate * friction + newBurnrate * (1-friction);
		}

		lastUsedHeap	= currUsedSize;
		lastTimestamp	= present;
	}
	
	/**
	 * getter for the burnRate
	 * @type {Number}
	 */
	this.burnRate	= function(){
		if( burnRate === null )	return 0;
		return burnRate;
	}
	
	/**
	 * getter for the usedHeapSize
	 * @return {Number} used heap size in byte
	 */
	this.usedHeapSize	= function(){
		return usedHeapSize();
	}
}
672502
public static void dumpAll(Iterator<? extends Object> data, Writer output) {
    getSnakeYaml().dumpAll(data, output);
  }
300610
function() {
        var queue = this._queue;
        var globalOptions = this.globalOptions;
        var options = this.options;
        var before = options && options.before;
        var after = options && options.after;
        var onError = globalOptions.onError || (globalOptions.onErrorTarget && globalOptions.onErrorTarget[globalOptions.onErrorMethod]);
        var target, method, args, stack, i, l = queue.length;

        this.targetQueues = Object.create(null);

        if (l && before) { before(); }
        for (i = 0; i < l; i += 4) {
          target = queue[i];
          method = queue[i+1];
          args   = queue[i+2];
          stack  = queue[i+3]; // Debugging assistance

          // TODO: error handling
          if (args && args.length > 0) {
            if (onError) {
              try {
                method.apply(target, args);
              } catch (e) {
                onError(e);
              }
            } else {
              method.apply(target, args);
            }
          } else {
            if (onError) {
              try {
                method.call(target);
              } catch(e) {
                onError(e);
              }
            } else {
              method.call(target);
            }
          }
        }
        if (l && after) { after(); }

        // check if new items have been added
        if (queue.length > l) {
          this._queue = queue.slice(l);
          this.flush();
        } else {
          this._queue.length = 0;
        }
      }
498368
function dumpProgrammes(obj) {
	for (var e in obj.category_programmes.elements) {
		var p = obj.category_programmes.elements[e];
		console.log(p.id+' '+p.tleo_type+' '+p.title);
		if ((p.tleo_type == 'brand') || (p.tleo_type == 'series')) {
			showChildren(p.id);
		}
	}
}