_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q53200
train
function(timeShift) { this.forEachLine(function(text, eventBase, cpuNumber, pid, ts) { var eventName = eventBase.eventName; var handler = this.eventHandlers_[eventName]; if (!handler) { this.model_.importWarning({ type: 'parse_error', message: 'Unknown event ' + eventName + ' (' + text + ')' }); return; } ts += timeShift; if (!handler(eventName, cpuNumber, pid, ts, eventBase)) { this.model_.importWarning({ type: 'parse_error', message: 'Malformed ' + eventName + ' event (' + text + ')' }); } }.bind(this)); }
javascript
{ "resource": "" }
q53201
train
function() { var lines = []; var extractResult = LinuxPerfImporter._extractEventsFromSystraceHTML( this.events_, true); if (!extractResult.ok) extractResult = LinuxPerfImporter._extractEventsFromSystraceMultiHTML( this.events_, true); var lines = extractResult.ok ? extractResult.lines : this.events_.split('\n'); var lineParser = null; for (var lineNumber = 0; lineNumber < lines.length; ++lineNumber) { var line = lines[lineNumber].trim(); if (line.length == 0 || /^#/.test(line)) continue; if (lineParser == null) { lineParser = autoDetectLineParser(line); if (lineParser == null) { this.model_.importWarning({ type: 'parse_error', message: 'Cannot parse line: ' + line }); continue; } } var eventBase = lineParser(line); if (!eventBase) { this.model_.importWarning({ type: 'parse_error', message: 'Unrecognized line: ' + line }); continue; } this.lines_.push([ line, eventBase, parseInt(eventBase.cpuNumber), parseInt(eventBase.pid), parseFloat(eventBase.timestamp) * 1000 ]); } }
javascript
{ "resource": "" }
q53202
train
function(handler) { for (var i = 0; i < this.lines_.length; ++i) { var line = this.lines_[i]; handler.apply(this, line); } }
javascript
{ "resource": "" }
q53203
Cpu
train
function Cpu(kernel, number) { if (kernel === undefined || number === undefined) throw new Error('Missing arguments'); this.kernel = kernel; this.cpuNumber = number; this.slices = []; this.counters = {}; this.bounds = new tr.b.Range(); this.samples_ = undefined; // Set during createSubSlices // Start timestamp of the last active thread. this.lastActiveTimestamp_ = undefined; // Identifier of the last active thread. On Linux, it's a pid while on // Windows it's a thread id. this.lastActiveThread_ = undefined; // Name and arguments of the last active thread. this.lastActiveName_ = undefined; this.lastActiveArgs_ = undefined; }
javascript
{ "resource": "" }
q53204
train
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) this.slices[sI].start = (this.slices[sI].start + amount); for (var id in this.counters) this.counters[id].shiftTimestampsForward(amount); }
javascript
{ "resource": "" }
q53205
train
function() { this.bounds.reset(); if (this.slices.length) { this.bounds.addValue(this.slices[0].start); this.bounds.addValue(this.slices[this.slices.length - 1].end); } for (var id in this.counters) { this.counters[id].updateBounds(); this.bounds.addRange(this.counters[id].bounds); } if (this.samples_ && this.samples_.length) { this.bounds.addValue(this.samples_[0].start); this.bounds.addValue( this.samples_[this.samples_.length - 1].end); } }
javascript
{ "resource": "" }
q53206
train
function(end_timestamp, args) { // Don't generate a slice if the last active thread is the idle task. if (this.lastActiveThread_ == undefined || this.lastActiveThread_ == 0) return; if (end_timestamp < this.lastActiveTimestamp_) { throw new Error('The end timestamp of a thread running on CPU ' + this.cpuNumber + ' is before its start timestamp.'); } // Merge |args| with |this.lastActiveArgs_|. If a key is in both // dictionaries, the value from |args| is used. for (var key in args) { this.lastActiveArgs_[key] = args[key]; } var duration = end_timestamp - this.lastActiveTimestamp_; var slice = new tr.model.CpuSlice( '', this.lastActiveName_, ColorScheme.getColorIdForGeneralPurposeString(this.lastActiveName_), this.lastActiveTimestamp_, this.lastActiveArgs_, duration); slice.cpu = this; this.slices.push(slice); // Clear the last state. this.lastActiveTimestamp_ = undefined; this.lastActiveThread_ = undefined; this.lastActiveName_ = undefined; this.lastActiveArgs_ = undefined; }
javascript
{ "resource": "" }
q53207
train
function(range) { var stats = {}; function addStatsForFreq(freqSample, index) { // Counters don't have an explicit end or duration; // calculate the end by looking at the starting point // of the next value in the series, or if that doesn't // exist, assume this frequency is held until the end. var freqEnd = (index < freqSample.series_.length - 1) ? freqSample.series_.samples_[index + 1].timestamp : range.max; var freqRange = tr.b.Range.fromExplicitRange(freqSample.timestamp, freqEnd); var intersection = freqRange.findIntersection(range); if (!(freqSample.value in stats)) stats[freqSample.value] = 0; stats[freqSample.value] += intersection.duration; } var freqCounter = this.getCounter('', 'Clock Frequency'); if (freqCounter !== undefined) { var freqSeries = freqCounter.getSeries(0); if (!freqSeries) return; tr.b.iterateOverIntersectingIntervals(freqSeries.samples_, function(x) { return x.timestamp; }, function(x, index) { return index < freqSeries.length - 1 ? freqSeries.samples_[index + 1].timestamp : range.max; }, range.min, range.max, addStatsForFreq); } return stats; }
javascript
{ "resource": "" }
q53208
FlowEvent
train
function FlowEvent(category, id, title, colorId, start, args, opt_duration) { tr.model.TimedEvent.call(this, start); this.category = category || ''; this.title = title; this.colorId = colorId; this.start = start; this.args = args; this.id = id; this.startSlice = undefined; this.endSlice = undefined; this.startStackFrame = undefined; this.endStackFrame = undefined; if (opt_duration !== undefined) this.duration = opt_duration; }
javascript
{ "resource": "" }
q53209
dispatchSimpleEvent
train
function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) { var e = new tr.b.Event(type, opt_bubbles, opt_cancelable); return target.dispatchEvent(e); }
javascript
{ "resource": "" }
q53210
CpuSlice
train
function CpuSlice(cat, title, colorId, start, args, opt_duration) { Slice.apply(this, arguments); this.threadThatWasRunning = undefined; this.cpu = undefined; }
javascript
{ "resource": "" }
q53211
train
function(line) { // Matches Mali perf events with thread info var lineREWithThread = /^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/; if (lineREWithThread.test(line)) return lineREWithThread; // Matches old-style Mali perf events var lineRENoThread = /^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/; if (lineRENoThread.test(line)) return lineRENoThread; return null; }
javascript
{ "resource": "" }
q53212
EventSet
train
function EventSet(opt_events) { this.bounds_dirty_ = true; this.bounds_ = new tr.b.Range(); this.length_ = 0; this.guid_ = tr.b.GUID.allocate(); this.pushed_guids_ = {}; if (opt_events) { if (opt_events instanceof Array) { for (var i = 0; i < opt_events.length; i++) this.push(opt_events[i]); } else if (opt_events instanceof EventSet) { this.addEventSet(opt_events); } else { this.push(opt_events); } } }
javascript
{ "resource": "" }
q53213
train
function(event) { if (event.guid == undefined) throw new Error('Event must have a GUID'); if (this.contains(event)) return event; this.pushed_guids_[event.guid] = true; this[this.length_++] = event; this.bounds_dirty_ = true; return event; }
javascript
{ "resource": "" }
q53214
CounterSeries
train
function CounterSeries(name, color) { tr.model.EventContainer.call(this); this.name_ = name; this.color_ = color; this.timestamps_ = []; this.samples_ = []; // Set by counter.addSeries this.counter = undefined; this.seriesIndex = undefined; }
javascript
{ "resource": "" }
q53215
train
function(callback) { this.kernel.iterateAllPersistableObjects(callback); for (var pid in this.processes) this.processes[pid].iterateAllPersistableObjects(callback); }
javascript
{ "resource": "" }
q53216
train
function() { var categoriesDict = {}; this.device.addCategoriesToDict(categoriesDict); this.kernel.addCategoriesToDict(categoriesDict); for (var pid in this.processes) this.processes[pid].addCategoriesToDict(categoriesDict); this.categories = []; for (var category in categoriesDict) if (category != '') this.categories.push(category); }
javascript
{ "resource": "" }
q53217
train
function(event) { for (var i = 0; i < this.userFriendlyCategoryDrivers_.length; i++) { var ufc = this.userFriendlyCategoryDrivers_[i].fromEvent(event); if (ufc !== undefined) return ufc; } return undefined; }
javascript
{ "resource": "" }
q53218
train
function(data) { data.showToUser = !!data.showToUser; this.importWarnings_.push(data); // Only log each warning type once. We may want to add some kind of // flag to allow reporting all importer warnings. if (this.reportedImportWarnings_[data.type] === true) return; if (this.importOptions_.showImportWarnings) console.warn(data.message); this.reportedImportWarnings_[data.type] = true; }
javascript
{ "resource": "" }
q53219
Sample
train
function Sample(cpu, thread, title, start, leafStackFrame, opt_weight, opt_args) { tr.model.TimedEvent.call(this, start); this.title = title; this.cpu = cpu; this.thread = thread; this.leafStackFrame = leafStackFrame; this.weight = opt_weight; this.args = opt_args || {}; }
javascript
{ "resource": "" }
q53220
ObjectSnapshot
train
function ObjectSnapshot(objectInstance, ts, args) { tr.model.Event.call(this); this.objectInstance = objectInstance; this.ts = ts; this.args = args; }
javascript
{ "resource": "" }
q53221
train
function(ts, val) { var sample = new PowerSample(this, ts, val); this.samples_.push(sample); return sample; }
javascript
{ "resource": "" }
q53222
Device
train
function Device(model) { if (!model) throw new Error('Must provide a model.'); tr.model.EventContainer.call(this); this.powerSeries_ = undefined; this.vSyncTimestamps_ = []; }
javascript
{ "resource": "" }
q53223
Slice
train
function Slice(category, title, colorId, start, args, opt_duration, opt_cpuStart, opt_cpuDuration, opt_argsStripped, opt_bind_id) { tr.model.TimedEvent.call(this, start); this.category = category || ''; this.title = title; this.colorId = colorId; this.args = args; this.startStackFrame = undefined; this.endStackFrame = undefined; this.didNotFinish = false; this.inFlowEvents = []; this.outFlowEvents = []; this.subSlices = []; this.selfTime = undefined; this.cpuSelfTime = undefined; this.important = false; this.parentContainer = undefined; this.argsStripped = false; this.bind_id_ = opt_bind_id; // parentSlice and isTopLevel will be set by SliceGroup. this.parentSlice = undefined; this.isTopLevel = false; // After SliceGroup processes Slices, isTopLevel should be equivalent to // !parentSlice. if (opt_duration !== undefined) this.duration = opt_duration; if (opt_cpuStart !== undefined) this.cpuStart = opt_cpuStart; if (opt_cpuDuration !== undefined) this.cpuDuration = opt_cpuDuration; if (opt_argsStripped !== undefined) this.argsStripped = true; }
javascript
{ "resource": "" }
q53224
train
function(callback, opt_this) { var parentStack = []; var started = false; // get the root node and push it to the DFS stack var topmostSlice = this.mostTopLevelSlice; parentStack.push(topmostSlice); // Using the stack to perform DFS while (parentStack.length !== 0) { var curSlice = parentStack.pop(); if (started) callback.call(opt_this, curSlice); else started = (curSlice.guid === this.guid); for (var i = curSlice.subSlices.length - 1; i >= 0; i--) { parentStack.push(curSlice.subSlices[i]); } } }
javascript
{ "resource": "" }
q53225
train
function(callback, opt_this) { var curSlice = this; while (curSlice.parentSlice) { curSlice = curSlice.parentSlice; callback.call(opt_this, curSlice); } }
javascript
{ "resource": "" }
q53226
train
function(slice) { this.haveTopLevelSlicesBeenBuilt = false; slice.parentContainer = this.parentContainer_; this.slices.push(slice); return slice; }
javascript
{ "resource": "" }
q53227
train
function(slices) { this.haveTopLevelSlicesBeenBuilt = false; slices.forEach(function(slice) { slice.parentContainer = this.parentContainer_; this.slices.push(slice); }, this); }
javascript
{ "resource": "" }
q53228
train
function(category, title, ts, opt_args, opt_tts, opt_argsStripped, opt_colorId) { if (this.openPartialSlices_.length) { var prevSlice = this.openPartialSlices_[ this.openPartialSlices_.length - 1]; if (ts < prevSlice.start) throw new Error('Slices must be added in increasing timestamp order'); } var colorId = opt_colorId || ColorScheme.getColorIdForGeneralPurposeString(title); var slice = new this.sliceConstructor(category, title, colorId, ts, opt_args ? opt_args : {}, null, opt_tts, undefined, opt_argsStripped); this.openPartialSlices_.push(slice); slice.didNotFinish = true; this.pushSlice(slice); return slice; }
javascript
{ "resource": "" }
q53229
train
function(ts, opt_tts, opt_colorId) { if (!this.openSliceCount) throw new Error('endSlice called without an open slice'); var slice = this.openPartialSlices_[this.openSliceCount - 1]; this.openPartialSlices_.splice(this.openSliceCount - 1, 1); if (ts < slice.start) throw new Error('Slice ' + slice.title + ' end time is before its start.'); slice.duration = ts - slice.start; slice.didNotFinish = false; slice.colorId = opt_colorId || slice.colorId; if (opt_tts && slice.cpuStart !== undefined) slice.cpuDuration = opt_tts - slice.cpuStart; return slice; }
javascript
{ "resource": "" }
q53230
train
function(category, title, ts, duration, tts, cpuDuration, opt_args, opt_argsStripped, opt_colorId, opt_bind_id) { var colorId = opt_colorId || ColorScheme.getColorIdForGeneralPurposeString(title); var slice = new this.sliceConstructor(category, title, colorId, ts, opt_args ? opt_args : {}, duration, tts, cpuDuration, opt_argsStripped, opt_bind_id); if (duration === undefined) slice.didNotFinish = true; this.pushSlice(slice); return slice; }
javascript
{ "resource": "" }
q53231
train
function() { this.updateBounds(); var maxTimestamp = this.bounds.max; for (var sI = 0; sI < this.slices.length; sI++) { var slice = this.slices[sI]; if (slice.didNotFinish) slice.duration = maxTimestamp - slice.start; } this.openPartialSlices_ = []; }
javascript
{ "resource": "" }
q53232
train
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) { var slice = this.slices[sI]; slice.start = (slice.start + amount); } }
javascript
{ "resource": "" }
q53233
train
function() { this.bounds.reset(); for (var i = 0; i < this.slices.length; i++) { this.bounds.addValue(this.slices[i].start); this.bounds.addValue(this.slices[i].end); } }
javascript
{ "resource": "" }
q53234
train
function(viewport) { var containerToTrack = viewport.containerToTrackMap; for (var i in this.yComponents_) { var yComponent = this.yComponents_[i]; var track = containerToTrack.getTrackByStableId(yComponent.stableId); if (track !== undefined) return track; } }
javascript
{ "resource": "" }
q53235
train
function(viewport) { var dt = viewport.currentDisplayTransform; var containerToTrack = viewport.containerToTrackMap; var viewX = dt.xWorldToView(this.xWorld_); var viewY = -1; for (var index in this.yComponents_) { var yComponent = this.yComponents_[index]; var track = containerToTrack.getTrackByStableId(yComponent.stableId); if (track !== undefined) { var boundRect = track.getBoundingClientRect(); viewY = yComponent.yPercentOffset * boundRect.height + boundRect.top; break; } } return { viewX: viewX, viewY: viewY }; }
javascript
{ "resource": "" }
q53236
ContainerMemoryDump
train
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; }
javascript
{ "resource": "" }
q53237
Process
train
function Process(model, pid) { if (model === undefined) throw new Error('model must be provided'); if (pid === undefined) throw new Error('pid must be provided'); tr.model.ProcessBase.call(this, model); this.pid = pid; this.name = undefined; this.labels = []; this.instantEvents = []; this.memoryDumps = []; this.frames = []; this.activities = []; }
javascript
{ "resource": "" }
q53238
decorate
train
function decorate(source, constr) { var elements; if (typeof source == 'string') elements = tr.doc.querySelectorAll(source); else elements = [source]; for (var i = 0, el; el = elements[i]; i++) { if (!(el instanceof constr)) constr.decorate(el); } }
javascript
{ "resource": "" }
q53239
define
train
function define(className, opt_parentConstructor, opt_tagNS) { if (typeof className == 'function') { throw new Error('Passing functions as className is deprecated. Please ' + 'use (className, opt_parentConstructor) to subclass'); } var className = className.toLowerCase(); if (opt_parentConstructor && !opt_parentConstructor.tagName) throw new Error('opt_parentConstructor was not ' + 'created by tr.ui.b.define'); // Walk up the parent constructors until we can find the type of tag // to create. var tagName = className; var tagNS = undefined; if (opt_parentConstructor) { if (opt_tagNS) throw new Error('Must not specify tagNS if parentConstructor is given'); var parent = opt_parentConstructor; while (parent && parent.tagName) { tagName = parent.tagName; tagNS = parent.tagNS; parent = parent.parentConstructor; } } else { tagNS = opt_tagNS; } /** * Creates a new UI element constructor. * Arguments passed to the constuctor are provided to the decorate method. * You will need to call the parent elements decorate method from within * your decorate method and pass any required parameters. * @constructor */ function f() { if (opt_parentConstructor && f.prototype.__proto__ != opt_parentConstructor.prototype) { throw new Error( className + ' prototye\'s __proto__ field is messed up. ' + 'It MUST be the prototype of ' + opt_parentConstructor.tagName); } var el; if (tagNS === undefined) el = tr.doc.createElement(tagName); else el = tr.doc.createElementNS(tagNS, tagName); f.decorate.call(this, el, arguments); return el; } /** * Decorates an element as a UI element class. * @param {!Element} el The element to decorate. */ f.decorate = function(el) { el.__proto__ = f.prototype; el.decorate.apply(el, arguments[1]); el.constructor = f; }; f.className = className; f.tagName = tagName; f.tagNS = tagNS; f.parentConstructor = (opt_parentConstructor ? opt_parentConstructor : undefined); f.toString = function() { if (!f.parentConstructor) return f.tagName; return f.parentConstructor.toString() + '::' + f.className; }; return f; }
javascript
{ "resource": "" }
q53240
f
train
function f() { if (opt_parentConstructor && f.prototype.__proto__ != opt_parentConstructor.prototype) { throw new Error( className + ' prototye\'s __proto__ field is messed up. ' + 'It MUST be the prototype of ' + opt_parentConstructor.tagName); } var el; if (tagNS === undefined) el = tr.doc.createElement(tagName); else el = tr.doc.createElementNS(tagNS, tagName); f.decorate.call(this, el, arguments); return el; }
javascript
{ "resource": "" }
q53241
CommentBoxAnnotationView
train
function CommentBoxAnnotationView(viewport, annotation) { this.viewport_ = viewport; this.annotation_ = annotation; this.textArea_ = undefined; this.styleWidth = 250; this.styleHeight = 50; this.fontSize = 10; this.rightOffset = 50; this.topOffset = 25; }
javascript
{ "resource": "" }
q53242
train
function(address, amount, label, message) { var tmpl = ["bitcoin:", address, "?"]; if(amount) { tmpl = tmpl.concat(["amount=", encodeURIComponent(amount), "&"]); } if(label) { tmpl = tmpl.concat(["label=", encodeURIComponent(label), "&"]); } if(message) { tmpl = tmpl.concat(["message=", encodeURIComponent(message), "&"]); } // Remove prefixing extra var lastc = tmpl[tmpl.length-1]; if(lastc == "&" || lastc == "?") { tmpl = tmpl.splice(0, tmpl.length-1); } return tmpl.join(""); }
javascript
{ "resource": "" }
q53243
train
function(elem, source) { // Replace .bitcoin-address in the template var addr = elem.find(".bitcoin-address"); // Add a maker class so that we don't reapply template // on the subsequent scans addr.addClass("bitcoin-address-controls"); addr.text(source.attr("data-bc-address")); // Copy orignal attributes; $.each(["address", "amount", "label", "message"], function() { var attrName = "data-bc-" + this; elem.attr(attrName, source.attr(attrName)); }); // Build BTC URL var url = this.buildBitcoinURI(source.attr("data-bc-address"), source.attr("data-bc-amount"), source.attr("data-bc-label"), source.attr("data-bc-message")); elem.find(".bitcoin-address-action-send").attr("href", url); }
javascript
{ "resource": "" }
q53244
train
function() { var template = document.getElementById(this.config.template); if(!template) { throw new Error("Bitcoin address template element missing:" + this.config.template); } template = $(template); if(template.size() != 1) { throw new Error("Bitcoin address template DOM does not contain a single element"); } return template; }
javascript
{ "resource": "" }
q53245
train
function(target, template) { if(!template) { template = this.getTemplate(); } // Make a deep copy, so we don't accidentally modify // template elements in-place var elem = template.clone(false, true); this.buildControls(elem, target); // Make sure we are visible (HTML5 way, CSS way) // and clean up the template id if we managed to copy it around elem.removeAttr("hidden id"); elem.show(); target.replaceWith(elem); }
javascript
{ "resource": "" }
q53246
train
function() { var self = this; var template = this.getTemplate(); // Optionally bail out if the default selection // is not given (user calls applyTemplate() manually) if(!this.config.selector) { return; } $(this.config.selector).each(function() { var $this = $(this); // Template already applied if($this.hasClass("bitcoin-address-controls")) { return; } // Make sure we don't apply the template on the template itself if($this.parents("#" + self.config.template).size() > 0) { return; } // Don't reapply templates on subsequent scans self.applyTemplate($this, template); }); }
javascript
{ "resource": "" }
q53247
train
function(elem) { var addy = elem.find(".bitcoin-address"); window.getSelection().selectAllChildren(addy.get(0)); elem.find(".bitcoin-action-hint").hide(); elem.find(".bitcoin-action-hint-copy").slideDown(); }
javascript
{ "resource": "" }
q53248
train
function(e) { var elem = $(e.target).parents(".bitcoin-address-container"); // We never know if the click action was succesfully complete elem.find(".bitcoin-action-hint").hide(); elem.find(".bitcoin-action-hint-send").slideDown(); }
javascript
{ "resource": "" }
q53249
train
function(e) { e.preventDefault(); var elem = $(e.target).parents(".bitcoin-address-container"); this.prepareCopySelection(elem); return false; }
javascript
{ "resource": "" }
q53250
train
function(qrContainer) { var elem = qrContainer.parents(".bitcoin-address-container"); var url; //var addr = elem.attr("data-bc-address"); if(this.config.qrRawAddress) { url = elem.attr("data-bc-address"); } else { url = this.buildBitcoinURI(elem.attr("data-bc-address"), elem.attr("data-bc-amount"), elem.attr("data-bc-label")); } var options = $.extend({}, this.config.qr, { text: url }); var qrCode = new qrcode.QRCode(qrContainer.get(0), options); }
javascript
{ "resource": "" }
q53251
train
function(e) { e.preventDefault(); var elem = $(e.target).parents(".bitcoin-address-container"); var addr = elem.attr("data-bc-address"); var qrContainer = elem.find(".bitcoin-address-qr-container"); // Lazily generate the QR code if(qrContainer.children().size() === 0) { this.generateQR(qrContainer); } elem.find(".bitcoin-action-hint").hide(); elem.find(".bitcoin-action-hint-qr").slideDown(); return false; }
javascript
{ "resource": "" }
q53252
train
function(_config) { var self = this; if(!_config) { throw new Error("You must give bitcoinaddress config object"); } this.config = _config; $ = this.config.jQuery || jQuery; this.scan(); this.initUX(); }
javascript
{ "resource": "" }
q53253
train
function(traces) { if (tr.isHeadless) throw new Error('Cannot use this method in headless mode.'); var overlay = tr.ui.b.Overlay(); overlay.title = 'Importing...'; overlay.userCanClose = false; overlay.msgEl = document.createElement('div'); overlay.appendChild(overlay.msgEl); overlay.msgEl.style.margin = '20px'; overlay.update = function(msg) { this.msgEl.textContent = msg; } overlay.visible = true; var promise = tr.b.Task.RunWhenIdle(this.createImportTracesTask(overlay, traces)); promise.then( function() { overlay.visible = false; }, function(err) { overlay.visible = false; } ); return promise; }
javascript
{ "resource": "" }
q53254
EventContainer
train
function EventContainer() { this.guid_ = tr.b.GUID.allocate(); this.important = true; this.bounds_ = new tr.b.Range(); }
javascript
{ "resource": "" }
q53255
train
function(callback, opt_this) { this.iterateAllEventContainers(function(ec) { ec.iterateAllEventsInThisContainer( function(eventType) { return true; }, callback, opt_this); }); }
javascript
{ "resource": "" }
q53256
train
function(callback, opt_this) { function visit(ec) { callback.call(opt_this, ec); ec.iterateAllChildEventContainers(visit); } visit(this); }
javascript
{ "resource": "" }
q53257
Event
train
function Event() { SelectableItem.call(this, this /* modelItem */); this.guid_ = tr.b.GUID.allocate(); this.selectionState = SelectionState.NONE; this.associatedAlerts = new tr.model.EventSet(); this.info = undefined; }
javascript
{ "resource": "" }
q53258
ThreadTimeSlice
train
function ThreadTimeSlice(thread, schedulingState, cat, start, args, opt_duration) { Slice.call(this, cat, schedulingState, this.getColorForState_(schedulingState), start, args, opt_duration); this.thread = thread; this.schedulingState = schedulingState; this.cpuOnWhichThreadWasRunning = undefined; }
javascript
{ "resource": "" }
q53259
findEmptyRangesBetweenRanges
train
function findEmptyRangesBetweenRanges(inRanges, opt_totalRange) { if (opt_totalRange && opt_totalRange.isEmpty) opt_totalRange = undefined; var emptyRanges = []; if (!inRanges.length) { if (opt_totalRange) emptyRanges.push(opt_totalRange); return emptyRanges; } inRanges = inRanges.slice(); inRanges.sort(function(x, y) { return x.min - y.min; }); if (opt_totalRange && (opt_totalRange.min < inRanges[0].min)) { emptyRanges.push(tr.b.Range.fromExplicitRange( opt_totalRange.min, inRanges[0].min)); } inRanges.forEach(function(range, index) { for (var otherIndex = 0; otherIndex < inRanges.length; ++otherIndex) { if (index === otherIndex) continue; var other = inRanges[otherIndex]; if (other.min > range.max) { // |inRanges| is sorted, so |other| is the first range after |range|, // and there is an empty range between them. emptyRanges.push(tr.b.Range.fromExplicitRange( range.max, other.min)); return; } // Otherwise, |other| starts before |range| ends, so |other| might // possibly contain the end of |range|. if (other.max > range.max) { // |other| does contain the end of |range|, so no empty range starts // at the end of this |range|. return; } } if (opt_totalRange && (range.max < opt_totalRange.max)) { emptyRanges.push(tr.b.Range.fromExplicitRange( range.max, opt_totalRange.max)); } }); return emptyRanges; }
javascript
{ "resource": "" }
q53260
AsyncSlice
train
function AsyncSlice(category, title, colorId, start, args, duration, opt_isTopLevel, opt_cpuStart, opt_cpuDuration, opt_argsStripped) { tr.model.TimedEvent.call(this, start); this.category = category || ''; // We keep the original title from the trace file in originalTitle since // some sub-classes, e.g. NetAsyncSlice, change the title field. this.originalTitle = title; this.title = title; this.colorId = colorId; this.args = args; this.startStackFrame = undefined; this.endStackFrame = undefined; this.didNotFinish = false; this.important = false; this.subSlices = []; this.parentContainer = undefined; this.id = undefined; this.startThread = undefined; this.endThread = undefined; this.cpuStart = undefined; this.cpuDuration = undefined; this.argsStripped = false; this.startStackFrame = undefined; this.endStackFrame = undefined; this.duration = duration; // TODO(nduca): Forgive me for what I must do. this.isTopLevel = (opt_isTopLevel === true); if (opt_cpuStart !== undefined) this.cpuStart = opt_cpuStart; if (opt_cpuDuration !== undefined) this.cpuDuration = opt_cpuDuration; if (opt_argsStripped !== undefined) this.argsStripped = opt_argsStripped; }
javascript
{ "resource": "" }
q53261
Task
train
function Task(runCb, thisArg) { if (runCb !== undefined && thisArg === undefined) throw new Error('Almost certainly, you meant to pass a thisArg.'); this.runCb_ = runCb; this.thisArg_ = thisArg; this.afterTask_ = undefined; this.subTasks_ = []; }
javascript
{ "resource": "" }
q53262
train
function() { if (this.runCb_ !== undefined) this.runCb_.call(this.thisArg_, this); var subTasks = this.subTasks_; this.subTasks_ = undefined; // Prevent more subTasks from being posted. if (!subTasks.length) return this.afterTask_; // If there are subtasks, then we want to execute all the subtasks and // then this task's afterTask. To make this happen, we update the // afterTask of all the subtasks so the point upward to each other, e.g. // subTask[0].afterTask to subTask[1] and so on. Then, the last subTask's // afterTask points at this task's afterTask. for (var i = 1; i < subTasks.length; i++) subTasks[i - 1].afterTask_ = subTasks[i]; subTasks[subTasks.length - 1].afterTask_ = this.afterTask_; return subTasks[0]; }
javascript
{ "resource": "" }
q53263
ObjectInstance
train
function ObjectInstance( parent, id, category, name, creationTs, opt_baseTypeName) { tr.model.Event.call(this); this.parent = parent; this.id = id; this.category = category; this.baseTypeName = opt_baseTypeName ? opt_baseTypeName : name; this.name = name; this.creationTs = creationTs; this.creationTsWasExplicit = false; this.deletionTs = Number.MAX_VALUE; this.deletionTsWasExplicit = false; this.colorId = 0; this.bounds = new tr.b.Range(); this.snapshots = []; this.hasImplicitSnapshots = false; }
javascript
{ "resource": "" }
q53264
ProtoIR
train
function ProtoIR(irType, name) { this.irType = irType; this.names = new Set(name ? [name] : undefined); this.start = Infinity; this.end = -Infinity; this.associatedEvents = new tr.model.EventSet(); }
javascript
{ "resource": "" }
q53265
train
function(typeNames) { for (var i = 0; i < this.associatedEvents.length; ++i) { if (typeNames.indexOf(this.associatedEvents[i].typeName) >= 0) return true; } return false; }
javascript
{ "resource": "" }
q53266
train
function() { var debugString = this.irType + '('; debugString += parseInt(this.start) + ' '; debugString += parseInt(this.end); this.associatedEvents.forEach(function(event) { debugString += ' ' + event.typeName; }); return debugString + ')'; }
javascript
{ "resource": "" }
q53267
ObjectCollection
train
function ObjectCollection(parent) { tr.model.EventContainer.call(this); this.parent = parent; this.instanceMapsById_ = {}; // id -> TimeToObjectInstanceMap this.instancesByTypeName_ = {}; this.createObjectInstance_ = this.createObjectInstance_.bind(this); }
javascript
{ "resource": "" }
q53268
GestureParser
train
function GestureParser(importer) { Parser.call(this, importer); importer.registerEventHandler('tracing_mark_write:log', GestureParser.prototype.logEvent.bind(this)); importer.registerEventHandler('tracing_mark_write:SyncInterpret', GestureParser.prototype.syncEvent.bind(this)); importer.registerEventHandler('tracing_mark_write:HandleTimer', GestureParser.prototype.timerEvent.bind(this)); }
javascript
{ "resource": "" }
q53269
train
function(title, ts, opt_args) { var thread = this.importer.getOrCreatePseudoThread('gesture').thread; thread.sliceGroup.beginSlice( 'touchpad_gesture', title, ts, opt_args); }
javascript
{ "resource": "" }
q53270
Counter
train
function Counter(parent, id, category, name) { tr.model.EventContainer.call(this); this.parent_ = parent; this.id_ = id; this.category_ = category || ''; this.name_ = name; this.series_ = []; this.totals = []; }
javascript
{ "resource": "" }
q53271
train
function(amount) { for (var i = 0; i < this.series_.length; ++i) this.series_[i].shiftTimestampsForward(amount); }
javascript
{ "resource": "" }
q53272
train
function() { this.totals = []; this.maxTotal = 0; this.bounds.reset(); if (this.series_.length === 0) return; var firstSeries = this.series_[0]; var lastSeries = this.series_[this.series_.length - 1]; this.bounds.addValue(firstSeries.getTimestamp(0)); this.bounds.addValue(lastSeries.getTimestamp(lastSeries.length - 1)); var numSeries = this.numSeries; this.maxTotal = -Infinity; // Sum the samples at each timestamp. // Note, this assumes that all series have all timestamps. for (var i = 0; i < firstSeries.length; ++i) { var total = 0; this.series_.forEach(function(series) { total += series.getSample(i).value; this.totals.push(total); }.bind(this)); this.maxTotal = Math.max(total, this.maxTotal); } }
javascript
{ "resource": "" }
q53273
TimeToObjectInstanceMap
train
function TimeToObjectInstanceMap(createObjectInstanceFunction, parent, id) { this.createObjectInstanceFunction_ = createObjectInstanceFunction; this.parent = parent; this.id = id; this.instances = []; }
javascript
{ "resource": "" }
q53274
RegulatorParser
train
function RegulatorParser(importer) { Parser.call(this, importer); importer.registerEventHandler('regulator_enable', RegulatorParser.prototype.regulatorEnableEvent.bind(this)); importer.registerEventHandler('regulator_enable_delay', RegulatorParser.prototype.regulatorEnableDelayEvent.bind(this)); importer.registerEventHandler('regulator_enable_complete', RegulatorParser.prototype.regulatorEnableCompleteEvent.bind(this)); importer.registerEventHandler('regulator_disable', RegulatorParser.prototype.regulatorDisableEvent.bind(this)); importer.registerEventHandler('regulator_disable_complete', RegulatorParser.prototype.regulatorDisableCompleteEvent.bind(this)); importer.registerEventHandler('regulator_set_voltage', RegulatorParser.prototype.regulatorSetVoltageEvent.bind(this)); importer.registerEventHandler('regulator_set_voltage_complete', RegulatorParser.prototype.regulatorSetVoltageCompleteEvent.bind(this)); this.model_ = importer.model_; }
javascript
{ "resource": "" }
q53275
train
function(ctrName, valueName) { var ctr = this.model_.kernel .getOrCreateCounter(null, 'vreg ' + ctrName + ' ' + valueName); // Initialize the counter's series fields if needed. if (ctr.series[0] === undefined) { ctr.addSeries(new tr.model.CounterSeries(valueName, ColorScheme.getColorIdForGeneralPurposeString( ctrName + '.' + valueName))); } return ctr; }
javascript
{ "resource": "" }
q53276
TimedEvent
train
function TimedEvent(start) { tr.model.Event.call(this); this.start = start; this.duration = 0; this.cpuStart = undefined; this.cpuDuration = undefined; }
javascript
{ "resource": "" }
q53277
train
function(that, precisionUnit) { if (precisionUnit === undefined) { precisionUnit = tr.b.u.TimeDisplayModes.ms; } var startsBefore = precisionUnit.roundedLess(that.start, this.start); var endsAfter = precisionUnit.roundedLess(this.end, that.end); return !startsBefore && !endsAfter; }
javascript
{ "resource": "" }
q53278
comparePossiblyUndefinedValues
train
function comparePossiblyUndefinedValues(x, y, cmp, opt_this) { if (x !== undefined && y !== undefined) return cmp.call(opt_this, x, y); if (x !== undefined) return -1; if (y !== undefined) return 1; return 0; }
javascript
{ "resource": "" }
q53279
group
train
function group(ary, fn) { return ary.reduce(function(accumulator, curr) { var key = fn(curr); if (key in accumulator) accumulator[key].push(curr); else accumulator[key] = [curr]; return accumulator; }, {}); }
javascript
{ "resource": "" }
q53280
invertArrayOfDicts
train
function invertArrayOfDicts(array, opt_dictGetter, opt_this) { opt_this = opt_this || this; var result = {}; for (var i = 0; i < array.length; i++) { var item = array[i]; if (item === undefined) continue; var dict = opt_dictGetter ? opt_dictGetter.call(opt_this, item) : item; if (dict === undefined) continue; for (var key in dict) { var valueList = result[key]; if (valueList === undefined) result[key] = valueList = new Array(array.length); valueList[i] = dict[key]; } } return result; }
javascript
{ "resource": "" }
q53281
arrayToDict
train
function arrayToDict(array, valueToKeyFn, opt_this) { opt_this = opt_this || this; var result = {}; var length = array.length; for (var i = 0; i < length; i++) { var value = array[i]; var key = valueToKeyFn.call(opt_this, value); result[key] = value; } return result; }
javascript
{ "resource": "" }
q53282
ProcessMemoryDump
train
function ProcessMemoryDump(globalMemoryDump, process, start) { tr.model.ContainerMemoryDump.call(this, start); this.process = process; this.globalMemoryDump = globalMemoryDump; // Process memory totals (optional object) with the following fields (also // optional): // - residentBytes: Total resident bytes (number) // - peakResidentBytes: Peak resident bytes (number) // - arePeakResidentBytesResettable: Flag whether peak resident bytes are // resettable (boolean) // - platformSpecific: Map from OS-specific total names (string) to sizes // (number) this.totals = undefined; this.vmRegions_ = undefined; // Map from allocator names to heap dumps. this.heapDumps = undefined; this.tracingOverheadOwnershipSetUp_ = false; this.tracingOverheadDiscountedFromVmRegions_ = false; }
javascript
{ "resource": "" }
q53283
ThreadSlice
train
function ThreadSlice(cat, title, colorId, start, args, opt_duration, opt_cpuStart, opt_cpuDuration, opt_argsStripped, opt_bind_id) { Slice.call(this, cat, title, colorId, start, args, opt_duration, opt_cpuStart, opt_cpuDuration, opt_argsStripped, opt_bind_id); // Do not modify this directly. // subSlices is configured by SliceGroup.rebuildSubRows_. this.subSlices = []; }
javascript
{ "resource": "" }
q53284
train
function(event, opt_slice) { var thread = this.model_.getOrCreateProcess(event.pid). getOrCreateThread(event.tid); this.allFlowEvents_.push({ refGuid: tr.b.GUID.getLastGuid(), sequenceNumber: this.allFlowEvents_.length, event: event, slice: opt_slice, // slice for events that have flow info thread: thread }); }
javascript
{ "resource": "" }
q53285
train
function(event) { var ctr_name; if (event.id !== undefined) ctr_name = event.name + '[' + event.id + ']'; else ctr_name = event.name; var ctr = this.model_.getOrCreateProcess(event.pid) .getOrCreateCounter(event.cat, ctr_name); var reservedColorId = event.cname ? getEventColor(event) : undefined; // Initialize the counter's series fields if needed. if (ctr.numSeries === 0) { for (var seriesName in event.args) { var colorId = reservedColorId || getEventColor(event, ctr.name + '.' + seriesName); ctr.addSeries(new tr.model.CounterSeries(seriesName, colorId)); } if (ctr.numSeries === 0) { this.model_.importWarning({ type: 'counter_parse_error', message: 'Expected counter ' + event.name + ' to have at least one argument to use as a value.' }); // Drop the counter. delete ctr.parent.counters[ctr.name]; return; } } var ts = timestampFromUs(event.ts); ctr.series.forEach(function(series) { var val = event.args[series.name] ? event.args[series.name] : 0; series.addCounterSample(ts, val); }); }
javascript
{ "resource": "" }
q53286
train
function() { if (this.softwareMeasuredCpuCount_ !== undefined) { this.model_.kernel.softwareMeasuredCpuCount = this.softwareMeasuredCpuCount_; } this.createAsyncSlices_(); this.createFlowSlices_(); this.createExplicitObjects_(); this.createImplicitObjects_(); this.createMemoryDumps_(); }
javascript
{ "resource": "" }
q53287
concatenateArguments
train
function concatenateArguments(args1, args2) { if (args1.params === undefined || args2.params === undefined) return tr.b.concatenateObjects(args1, args2); // Make an argument object to hold the combined params. var args3 = {}; args3.params = tr.b.concatenateObjects(args1.params, args2.params); return tr.b.concatenateObjects(args1, args2, args3); }
javascript
{ "resource": "" }
q53288
HeapEntry
train
function HeapEntry(heapDump, leafStackFrame, size) { this.heapDump = heapDump; // The leaf stack frame of the associated backtrace (e.g. drawQuad for the // drawQuad <- draw <- MessageLoop::RunTask backtrace). If undefined, the // heap entry is a sum over all backtraces. On the other hand, an empty // backtrace is represented by the root stack frame, which has an undefined // name. this.leafStackFrame = leafStackFrame; this.size = size; }
javascript
{ "resource": "" }
q53289
KernelFuncParser
train
function KernelFuncParser(importer) { LinuxPerfParser.call(this, importer); importer.registerEventHandler('graph_ent', KernelFuncParser.prototype.traceKernelFuncEnterEvent. bind(this)); importer.registerEventHandler('graph_ret', KernelFuncParser.prototype.traceKernelFuncReturnEvent. bind(this)); this.model_ = importer.model_; this.ppids_ = {}; }
javascript
{ "resource": "" }
q53290
GlobalMemoryDump
train
function GlobalMemoryDump(model, start) { tr.model.ContainerMemoryDump.call(this, start); this.model = model; this.processMemoryDumps = {}; }
javascript
{ "resource": "" }
q53291
train
function() { // 1. Calculate not-owned and not-owning sub-sizes of all MADs // (depth-first post-order traversal). this.traverseAllocatorDumpsInDepthFirstPostOrder( this.calculateDumpSubSizes_.bind(this)); // 2. Calculate owned and owning coefficients of owned and owner MADs // respectively (arbitrary traversal). this.traverseAllocatorDumpsInDepthFirstPostOrder( this.calculateDumpOwnershipCoefficient_.bind(this)); // 3. Calculate cumulative owned and owning coefficients of all MADs // (depth-first pre-order traversal). this.traverseAllocatorDumpsInDepthFirstPreOrder( this.calculateDumpCumulativeOwnershipCoefficient_.bind(this)); // 4. Calculate the effective sizes of all MADs (depth-first post-order // traversal). this.traverseAllocatorDumpsInDepthFirstPostOrder( this.calculateDumpEffectiveSize_.bind(this)); }
javascript
{ "resource": "" }
q53292
train
function(dump) { // Completely skip dumps with undefined size. if (!hasSize(dump)) return; // We only need to consider owned dumps. if (dump.ownedBy.length === 0) return; // Sort the owners in decreasing order of ownership importance and // increasing order of not-owning sub-size (in case of equal importance). var owners = dump.ownedBy.map(function(ownershipLink) { return { dump: ownershipLink.source, importance: optional(ownershipLink.importance, 0), notOwningSubSize: optional(ownershipLink.source.notOwningSubSize_, 0) }; }); owners.sort(function(a, b) { if (a.importance === b.importance) return a.notOwningSubSize - b.notOwningSubSize; return b.importance - a.importance; }); // Loop over the list of owners and distribute the owned dump's not-owned // sub-size among them according to their ownership importance and // not-owning sub-size. var currentImportanceStartPos = 0; var alreadyAttributedSubSize = 0; while (currentImportanceStartPos < owners.length) { var currentImportance = owners[currentImportanceStartPos].importance; // Find the position of the first owner with lower priority. var nextImportanceStartPos = currentImportanceStartPos + 1; while (nextImportanceStartPos < owners.length && owners[nextImportanceStartPos].importance === currentImportance) { nextImportanceStartPos++; } // Visit the owners with the same importance in increasing order of // not-owned sub-size, split the owned memory among them appropriately, // and calculate their owning coefficients. var attributedNotOwningSubSize = 0; for (var pos = currentImportanceStartPos; pos < nextImportanceStartPos; pos++) { var owner = owners[pos]; var notOwningSubSize = owner.notOwningSubSize; if (notOwningSubSize > alreadyAttributedSubSize) { attributedNotOwningSubSize += (notOwningSubSize - alreadyAttributedSubSize) / (nextImportanceStartPos - pos); alreadyAttributedSubSize = notOwningSubSize; } var owningCoefficient = 0; if (notOwningSubSize !== 0) owningCoefficient = attributedNotOwningSubSize / notOwningSubSize; owner.dump.owningCoefficient_ = owningCoefficient; } currentImportanceStartPos = nextImportanceStartPos; } // Attribute the remainder of the owned dump's not-owned sub-size to // the dump itself and calculate its owned coefficient. var notOwnedSubSize = optional(dump.notOwnedSubSize_, 0); var remainderSubSize = notOwnedSubSize - alreadyAttributedSubSize; var ownedCoefficient = 0; if (notOwnedSubSize !== 0) ownedCoefficient = remainderSubSize / notOwnedSubSize; dump.ownedCoefficient_ = ownedCoefficient; }
javascript
{ "resource": "" }
q53293
train
function(dump) { // Completely skip dumps with undefined size. As a result, each dump will // have defined effective size if and only if it has defined size. if (!hasSize(dump)) { // The rest of the pipeline relies on effective size being either a // valid ScalarAttribute, or undefined. dump.attributes[EFFECTIVE_SIZE_ATTRIBUTE_NAME] = undefined; return; } var effectiveSize; if (dump.children === undefined || dump.children.length === 0) { // Leaf dump. effectiveSize = getSize(dump) * dump.cumulativeOwningCoefficient_ * dump.cumulativeOwnedCoefficient_; } else { // Non-leaf dump. effectiveSize = 0; dump.children.forEach(function(childDump) { if (!hasSize(childDump)) return; effectiveSize += childDump.attributes[EFFECTIVE_SIZE_ATTRIBUTE_NAME].value; }); } var attribute = new tr.model.ScalarAttribute('bytes', effectiveSize); dump.attributes[EFFECTIVE_SIZE_ATTRIBUTE_NAME] = attribute; // Add attribute infos regarding ownership (if applicable). // TODO(petrcermak): This belongs to the corresponding analysis UI code. if (dump.ownedBy.length > 0) { var message = 'shared by:' + dump.ownedBy.map(function(ownershipLink) { return '\n - ' + ownershipToUserFriendlyString( ownershipLink.source, ownershipLink.importance); }).join(); attribute.infos.push(new tr.model.AttributeInfo( tr.model.AttributeInfoType.MEMORY_OWNED, message)); } if (dump.owns !== undefined) { var target = dump.owns.target; var message = 'shares ' + ownershipToUserFriendlyString(target, dump.owns.importance) + ' with'; var otherOwnershipLinks = target.ownedBy.filter( function(ownershipLink) { return ownershipLink.source !== dump; }); if (otherOwnershipLinks.length > 0) { message += ':'; message += otherOwnershipLinks.map(function(ownershipLink) { return '\n - ' + ownershipToUserFriendlyString( ownershipLink.source, ownershipLink.importance); }).join(); } else { message += ' no other dumps'; } attribute.infos.push(new tr.model.AttributeInfo( tr.model.AttributeInfoType.MEMORY_OWNER, message)); } }
javascript
{ "resource": "" }
q53294
train
function(fn) { var visitedDumps = new WeakSet(); var openDumps = new WeakSet(); function visit(dump) { if (visitedDumps.has(dump)) return; if (openDumps.has(dump)) throw new Error(dump.userFriendlyName + ' contains a cycle'); openDumps.add(dump); // Visit owners before the dumps they own. dump.ownedBy.forEach(function(ownershipLink) { visit.call(this, ownershipLink.source); }, this); // Visit children before parents. dump.children.forEach(visit, this); // Actually visit the current memory allocator dump. fn.call(this, dump); visitedDumps.add(dump); openDumps.delete(dump); } this.iterateAllRootAllocatorDumps(visit); }
javascript
{ "resource": "" }
q53295
train
function(fn) { var visitedDumps = new WeakSet(); function visit(dump) { if (visitedDumps.has(dump)) return; // If this dumps owns another dump which hasn't been visited yet, then // wait for this dump to be visited later. if (dump.owns !== undefined && !visitedDumps.has(dump.owns.target)) return; // If this dump's parent hasn't been visited yet, then wait for this // dump to be visited later. if (dump.parent !== undefined && !visitedDumps.has(dump.parent)) return; // Actually visit the current memory allocator dump. fn.call(this, dump); visitedDumps.add(dump); // Visit owners after the dumps they own. dump.ownedBy.forEach(function(ownershipLink) { visit.call(this, ownershipLink.source); }, this); // Visit children after parents. dump.children.forEach(visit, this); } this.iterateAllRootAllocatorDumps(visit); }
javascript
{ "resource": "" }
q53296
ModelIndices
train
function ModelIndices(model) { // For now the only indices we construct are for flowEvents this.flowEventsById_ = {}; model.flowEvents.forEach(function(fe) { if (fe.id !== undefined) { if (!this.flowEventsById_.hasOwnProperty(fe.id)) { this.flowEventsById_[fe.id] = new Array(); } this.flowEventsById_[fe.id].push(fe); } }, this); }
javascript
{ "resource": "" }
q53297
AsyncSliceGroup
train
function AsyncSliceGroup(parentContainer, opt_name) { tr.model.EventContainer.call(this); this.parentContainer_ = parentContainer; this.slices = []; this.name_ = opt_name; this.viewSubGroups_ = undefined; }
javascript
{ "resource": "" }
q53298
train
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) { var slice = this.slices[sI]; slice.start = (slice.start + amount); // Shift all nested subSlices recursively. var shiftSubSlices = function(subSlices) { if (subSlices === undefined || subSlices.length === 0) return; for (var sJ = 0; sJ < subSlices.length; sJ++) { subSlices[sJ].start += amount; shiftSubSlices(subSlices[sJ].subSlices); } }; shiftSubSlices(slice.subSlices); } }
javascript
{ "resource": "" }
q53299
train
function(subSlices) { if (subSlices === undefined || subSlices.length === 0) return; for (var sJ = 0; sJ < subSlices.length; sJ++) { subSlices[sJ].start += amount; shiftSubSlices(subSlices[sJ].subSlices); } }
javascript
{ "resource": "" }