_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
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 eve...
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 ? ...
javascript
{ "resource": "" }
q53202
train
function(handler) { for (var i = 0; i < this.lines_.length; ++i)
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 createSub...
javascript
{ "resource": "" }
q53204
train
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) this.slices[sI].start = (this.slices[sI].start + 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.cou...
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...
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...
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;
javascript
{ "resource": "" }
q53209
dispatchSimpleEvent
train
function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) { var e = new
javascript
{ "resource": "" }
q53210
CpuSlice
train
function CpuSlice(cat, title, colorId, start, args, opt_duration) {
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))
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++)
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]
javascript
{ "resource": "" }
q53214
CounterSeries
train
function CounterSeries(name, color) { tr.model.EventContainer.call(this); this.name_ = name; this.color_ = color; this.timestamps_ = []; this.samples_ = [];
javascript
{ "resource": "" }
q53215
train
function(callback) { this.kernel.iterateAllPersistableObjects(callback); for (var pid in this.processes)
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);
javascript
{ "resource": "" }
q53217
train
function(event) { for (var i = 0; i < this.userFriendlyCategoryDrivers_.length; i++) { var ufc = this.userFriendlyCategoryDrivers_[i].fromEvent(event);
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
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;
javascript
{ "resource": "" }
q53220
ObjectSnapshot
train
function ObjectSnapshot(objectInstance, ts, args) { tr.model.Event.call(this);
javascript
{ "resource": "" }
q53221
train
function(ts, val) { var sample = new PowerSample(this,
javascript
{ "resource": "" }
q53222
Device
train
function Device(model) { if (!model) throw new Error('Must provide a model.'); tr.model.EventContainer.call(this);
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; ...
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
javascript
{ "resource": "" }
q53225
train
function(callback, opt_this) { var curSlice = this; while (curSlice.parentSlice) {
javascript
{ "resource": "" }
q53226
train
function(slice) { this.haveTopLevelSlicesBeenBuilt = false;
javascript
{ "resource": "" }
q53227
train
function(slices) { this.haveTopLevelSlicesBeenBuilt = false; slices.forEach(function(slice) {
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 mus...
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 Erro...
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...
javascript
{ "resource": "" }
q53231
train
function() { this.updateBounds(); var maxTimestamp = this.bounds.max; for (var sI = 0; sI < this.slices.length; sI++) {
javascript
{ "resource": "" }
q53232
train
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) { var slice = this.slices[sI];
javascript
{ "resource": "" }
q53233
train
function() { this.bounds.reset(); for (var i = 0; i < this.slices.length; i++) {
javascript
{ "resource": "" }
q53234
train
function(viewport) { var containerToTrack = viewport.containerToTrackMap; for (var i in this.yComponents_) {
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 = con...
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
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;
javascript
{ "resource": "" }
q53238
decorate
train
function decorate(source, constr) { var elements; if (typeof source == 'string') elements = tr.doc.querySelectorAll(source); else elements = [source];
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...
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); }
javascript
{ "resource": "" }
q53241
CommentBoxAnnotationView
train
function CommentBoxAnnotationView(viewport, annotation) { this.viewport_ = viewport; this.annotation_ = annotation; this.textArea_ = undefined; this.styleWidth = 250;
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(...
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-ad...
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)
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 ...
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() { ...
javascript
{ "resource": "" }
q53247
train
function(elem) { var addy = elem.find(".bitcoin-address"); window.getSelection().selectAllChildren(addy.get(0));
javascript
{ "resource": "" }
q53248
train
function(e) { var elem = $(e.target).parents(".bitcoin-address-container"); // We never know if
javascript
{ "resource": "" }
q53249
train
function(e) { e.preventDefault(); var elem = $(e.target).parents(".bitcoin-address-container");
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("da...
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) {...
javascript
{ "resource": "" }
q53252
train
function(_config) { var self = this; if(!_config) { throw new Error("You must give bitcoinaddress config
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)...
javascript
{ "resource": "" }
q53254
EventContainer
train
function EventContainer() { this.guid_ = tr.b.GUID.allocate();
javascript
{ "resource": "" }
q53255
train
function(callback, opt_this) { this.iterateAllEventContainers(function(ec) { ec.iterateAllEventsInThisContainer(
javascript
{ "resource": "" }
q53256
train
function(callback, opt_this) { function visit(ec) { callback.call(opt_this, ec);
javascript
{ "resource": "" }
q53257
Event
train
function Event() { SelectableItem.call(this, this /* modelItem */); this.guid_ = tr.b.GUID.allocate(); this.selectionState = SelectionState.NONE;
javascript
{ "resource": "" }
q53258
ThreadTimeSlice
train
function ThreadTimeSlice(thread, schedulingState, cat, start, args, opt_duration) { Slice.call(this, cat, schedulingState,
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 =...
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 ori...
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;
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 t...
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
javascript
{ "resource": "" }
q53264
ProtoIR
train
function ProtoIR(irType, name) { this.irType = irType; this.names = new Set(name ?
javascript
{ "resource": "" }
q53265
train
function(typeNames) { for (var i = 0; i < this.associatedEvents.length; ++i) { if
javascript
{ "resource": "" }
q53266
train
function() { var debugString = this.irType + '('; debugString += parseInt(this.start) + ' '; debugString +=
javascript
{ "resource": "" }
q53267
ObjectCollection
train
function ObjectCollection(parent) { tr.model.EventContainer.call(this); this.parent = parent; this.instanceMapsById_ = {}; // id -> TimeToObjectInstanceMap
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',
javascript
{ "resource": "" }
q53269
train
function(title, ts, opt_args) { var thread = this.importer.getOrCreatePseudoThread('gesture').thread;
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 || '';
javascript
{ "resource": "" }
q53271
train
function(amount) { for (var i = 0; i < this.series_.length; ++i)
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.boun...
javascript
{ "resource": "" }
q53273
TimeToObjectInstanceMap
train
function TimeToObjectInstanceMap(createObjectInstanceFunction, parent, id) { this.createObjectInstanceFunction_ = createObjectInstanceFunction;
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(th...
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) {
javascript
{ "resource": "" }
q53276
TimedEvent
train
function TimedEvent(start) { tr.model.Event.call(this); this.start = start; this.duration = 0;
javascript
{ "resource": "" }
q53277
train
function(that, precisionUnit) { if (precisionUnit === undefined) { precisionUnit = tr.b.u.TimeDisplayModes.ms; } var startsBefore = precisionUnit.roundedLess(that.start, this.start);
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)
javascript
{ "resource": "" }
q53279
group
train
function group(ary, fn) { return ary.reduce(function(accumulator, curr) { var key = fn(curr); if (key in 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; ...
javascript
{ "resource": "" }
q53281
arrayToDict
train
function arrayToDict(array, valueToKeyFn, opt_this) { opt_this = opt_this || this; var result = {}; var length = array.length;
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 r...
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,
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(),
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 ?...
javascript
{ "resource": "" }
q53286
train
function() { if (this.softwareMeasuredCpuCount_ !== undefined) { this.model_.kernel.softwareMeasuredCpuCount = this.softwareMeasuredCpuCount_; } this.createAsyncSlices_();
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 = {};
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
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',
javascript
{ "resource": "" }
q53290
GlobalMemoryDump
train
function GlobalMemoryDump(model, start) { tr.model.ContainerMemoryDump.call(this, start);
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 // ...
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-o...
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...
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); ...
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 && !visitedDum...
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) {
javascript
{ "resource": "" }
q53297
AsyncSliceGroup
train
function AsyncSliceGroup(parentContainer, opt_name) { tr.model.EventContainer.call(this); this.parentContainer_ = parentContainer;
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 ==...
javascript
{ "resource": "" }
q53299
train
function(subSlices) { if (subSlices === undefined || subSlices.length === 0) return; for (var sJ = 0; sJ < subSlices.length; sJ++) {
javascript
{ "resource": "" }