id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
23,700
googlearchive/node-big-rig
lib/third_party/tracing/base/event.js
dispatchSimpleEvent
function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) { var e = new tr.b.Event(type, opt_bubbles, opt_cancelable); return target.dispatchEvent(e); }
javascript
function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) { var e = new tr.b.Event(type, opt_bubbles, opt_cancelable); return target.dispatchEvent(e); }
[ "function", "dispatchSimpleEvent", "(", "target", ",", "type", ",", "opt_bubbles", ",", "opt_cancelable", ")", "{", "var", "e", "=", "new", "tr", ".", "b", ".", "Event", "(", "type", ",", "opt_bubbles", ",", "opt_cancelable", ")", ";", "return", "target", ".", "dispatchEvent", "(", "e", ")", ";", "}" ]
Dispatches a simple event on an event target. @param {!EventTarget} target The event target to dispatch the event on. @param {string} type The type of the event. @param {boolean=} opt_bubbles Whether the event bubbles or not. @param {boolean=} opt_cancelable Whether the default action of the event can be prevented. @return {boolean} If any of the listeners called {@code preventDefault} during the dispatch this will return false.
[ "Dispatches", "a", "simple", "event", "on", "an", "event", "target", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/event.js#L81-L84
23,701
googlearchive/node-big-rig
lib/third_party/tracing/model/cpu_slice.js
CpuSlice
function CpuSlice(cat, title, colorId, start, args, opt_duration) { Slice.apply(this, arguments); this.threadThatWasRunning = undefined; this.cpu = undefined; }
javascript
function CpuSlice(cat, title, colorId, start, args, opt_duration) { Slice.apply(this, arguments); this.threadThatWasRunning = undefined; this.cpu = undefined; }
[ "function", "CpuSlice", "(", "cat", ",", "title", ",", "colorId", ",", "start", ",", "args", ",", "opt_duration", ")", "{", "Slice", ".", "apply", "(", "this", ",", "arguments", ")", ";", "this", ".", "threadThatWasRunning", "=", "undefined", ";", "this", ".", "cpu", "=", "undefined", ";", "}" ]
A CpuSlice represents a slice of time on a CPU. @constructor
[ "A", "CpuSlice", "represents", "a", "slice", "of", "time", "on", "a", "CPU", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/cpu_slice.js#L24-L28
23,702
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/mali_parser.js
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
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; }
[ "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", ";", "}" ]
Deduce the format of Mali perf events. @return {RegExp} the regular expression for parsing data when the format is recognized; otherwise null.
[ "Deduce", "the", "format", "of", "Mali", "perf", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/mali_parser.js#L249-L261
23,703
googlearchive/node-big-rig
lib/third_party/tracing/model/event_set.js
EventSet
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
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); } } }
[ "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", ")", ";", "}", "}", "}" ]
Represents a event set within a and its associated set of tracks. @constructor
[ "Represents", "a", "event", "set", "within", "a", "and", "its", "associated", "set", "of", "tracks", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/event_set.js#L26-L43
23,704
googlearchive/node-big-rig
lib/third_party/tracing/model/event_set.js
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
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; }
[ "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", ";", "}" ]
push pushes only unique events. If an event has been already pushed, do nothing.
[ "push", "pushes", "only", "unique", "events", ".", "If", "an", "event", "has", "been", "already", "pushed", "do", "nothing", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/event_set.js#L80-L91
23,705
googlearchive/node-big-rig
lib/third_party/tracing/model/counter_series.js
CounterSeries
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
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; }
[ "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", ";", "}" ]
A container holding all samples of a given measurement over time. As an example, a counter series might measure the throughput of data sent over a USB connection, with each sample representing the instantaneous throughput of the connection. @constructor @extends {EventContainer}
[ "A", "container", "holding", "all", "samples", "of", "a", "given", "measurement", "over", "time", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/counter_series.js#L25-L37
23,706
googlearchive/node-big-rig
lib/third_party/tracing/model/model.js
function(callback) { this.kernel.iterateAllPersistableObjects(callback); for (var pid in this.processes) this.processes[pid].iterateAllPersistableObjects(callback); }
javascript
function(callback) { this.kernel.iterateAllPersistableObjects(callback); for (var pid in this.processes) this.processes[pid].iterateAllPersistableObjects(callback); }
[ "function", "(", "callback", ")", "{", "this", ".", "kernel", ".", "iterateAllPersistableObjects", "(", "callback", ")", ";", "for", "(", "var", "pid", "in", "this", ".", "processes", ")", "this", ".", "processes", "[", "pid", "]", ".", "iterateAllPersistableObjects", "(", "callback", ")", ";", "}" ]
Some objects in the model can persist their state in ModelSettings. This iterates through them.
[ "Some", "objects", "in", "the", "model", "can", "persist", "their", "state", "in", "ModelSettings", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/model.js#L145-L149
23,707
googlearchive/node-big-rig
lib/third_party/tracing/model/model.js
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
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); }
[ "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", ")", ";", "}" ]
Generates the set of categories from the slices and counters.
[ "Generates", "the", "set", "of", "categories", "from", "the", "slices", "and", "counters", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/model.js#L237-L248
23,708
googlearchive/node-big-rig
lib/third_party/tracing/model/model.js
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
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; }
[ "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", ";", "}" ]
Gets the user friendly category string from an event. Returns undefined if none is known.
[ "Gets", "the", "user", "friendly", "category", "string", "from", "an", "event", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/model.js#L323-L330
23,709
googlearchive/node-big-rig
lib/third_party/tracing/model/model.js
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
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; }
[ "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", ";", "}" ]
Saves a warning that happened during import. Warnings are typically logged to the console, and optionally, the more critical ones are shown to the user. @param {Object} data The import warning data. Data must provide two accessors: type, message. The types are used to determine if we should output the message, we'll only output one message of each type. The message is the actual warning content.
[ "Saves", "a", "warning", "that", "happened", "during", "import", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/model.js#L396-L410
23,710
googlearchive/node-big-rig
lib/third_party/tracing/model/sample.js
Sample
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
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 || {}; }
[ "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", "||", "{", "}", ";", "}" ]
A Sample represents a sample taken at an instant in time, plus its stack frame and parameters associated with that sample. @constructor
[ "A", "Sample", "represents", "a", "sample", "taken", "at", "an", "instant", "in", "time", "plus", "its", "stack", "frame", "and", "parameters", "associated", "with", "that", "sample", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/sample.js#L22-L32
23,711
googlearchive/node-big-rig
lib/third_party/tracing/model/object_snapshot.js
ObjectSnapshot
function ObjectSnapshot(objectInstance, ts, args) { tr.model.Event.call(this); this.objectInstance = objectInstance; this.ts = ts; this.args = args; }
javascript
function ObjectSnapshot(objectInstance, ts, args) { tr.model.Event.call(this); this.objectInstance = objectInstance; this.ts = ts; this.args = args; }
[ "function", "ObjectSnapshot", "(", "objectInstance", ",", "ts", ",", "args", ")", "{", "tr", ".", "model", ".", "Event", ".", "call", "(", "this", ")", ";", "this", ".", "objectInstance", "=", "objectInstance", ";", "this", ".", "ts", "=", "ts", ";", "this", ".", "args", "=", "args", ";", "}" ]
A snapshot of an object instance, at a given moment in time. Initialization of snapshots and instances is three phased: 1. Instances and snapshots are constructed. This happens during event importing. Little should be done here, because the object's data are still being used by the importer to reconstruct object references. 2. Instances and snapshtos are preinitialized. This happens after implicit objects have been found, but before any references have been found and switched to direct references. Thus, every snapshot stands on its own. This is a good time to do global field renaming and type conversion, e.g. recognizing domain-specific types and converting from C++ naming convention to JS. 3. Instances and snapshtos are initialized. At this point, {id_ref: '0x1000'} fields have been converted to snapshot references. This is a good time to generic initialization steps and argument verification. @constructor
[ "A", "snapshot", "of", "an", "object", "instance", "at", "a", "given", "moment", "in", "time", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/object_snapshot.js#L36-L41
23,712
googlearchive/node-big-rig
lib/third_party/tracing/model/power_series.js
function(ts, val) { var sample = new PowerSample(this, ts, val); this.samples_.push(sample); return sample; }
javascript
function(ts, val) { var sample = new PowerSample(this, ts, val); this.samples_.push(sample); return sample; }
[ "function", "(", "ts", ",", "val", ")", "{", "var", "sample", "=", "new", "PowerSample", "(", "this", ",", "ts", ",", "val", ")", ";", "this", ".", "samples_", ".", "push", "(", "sample", ")", ";", "return", "sample", ";", "}" ]
Adds a power sample to the series and returns it. Note: Samples must be added in chronological order.
[ "Adds", "a", "power", "sample", "to", "the", "series", "and", "returns", "it", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/power_series.js#L50-L54
23,713
googlearchive/node-big-rig
lib/third_party/tracing/model/device.js
Device
function Device(model) { if (!model) throw new Error('Must provide a model.'); tr.model.EventContainer.call(this); this.powerSeries_ = undefined; this.vSyncTimestamps_ = []; }
javascript
function Device(model) { if (!model) throw new Error('Must provide a model.'); tr.model.EventContainer.call(this); this.powerSeries_ = undefined; this.vSyncTimestamps_ = []; }
[ "function", "Device", "(", "model", ")", "{", "if", "(", "!", "model", ")", "throw", "new", "Error", "(", "'Must provide a model.'", ")", ";", "tr", ".", "model", ".", "EventContainer", ".", "call", "(", "this", ")", ";", "this", ".", "powerSeries_", "=", "undefined", ";", "this", ".", "vSyncTimestamps_", "=", "[", "]", ";", "}" ]
Device represents the device-level objects in the model. @constructor @extends {tr.model.EventContainer}
[ "Device", "represents", "the", "device", "-", "level", "objects", "in", "the", "model", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/device.js#L24-L32
23,714
googlearchive/node-big-rig
lib/third_party/tracing/model/slice.js
Slice
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
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; }
[ "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", ";", "}" ]
A Slice represents an interval of time plus parameters associated with that interval. @constructor
[ "A", "Slice", "represents", "an", "interval", "of", "time", "plus", "parameters", "associated", "with", "that", "interval", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice.js#L22-L62
23,715
googlearchive/node-big-rig
lib/third_party/tracing/model/slice.js
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
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]); } } }
[ "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", "]", ")", ";", "}", "}", "}" ]
Obtains all subsequent slices of this slice. Subsequent slices are slices that get executed after a particular slice, i.e., all the functions that are called after the current one. For instance, E.iterateAllSubsequentSlices() in the following example: [ A ] [ B][ D ][ G ] [C] [E][F] [H] will pass F, G, then H to the provided callback. The reason we need subsequent slices of a particular slice is that when there is flow event goes into, e.g., E, we only want to highlight E's subsequent slices to indicate the execution order. The idea to calculate the subsequent slices of slice E is to view the slice group as a tree where the top-level slice A is the root node. The preorder depth-first-search (DFS) order is naturally equivalent to the function call order. We just need to perform a DFS, and start recording the slices after we see the occurance of E.
[ "Obtains", "all", "subsequent", "slices", "of", "this", "slice", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice.js#L140-L161
23,716
googlearchive/node-big-rig
lib/third_party/tracing/model/slice.js
function(callback, opt_this) { var curSlice = this; while (curSlice.parentSlice) { curSlice = curSlice.parentSlice; callback.call(opt_this, curSlice); } }
javascript
function(callback, opt_this) { var curSlice = this; while (curSlice.parentSlice) { curSlice = curSlice.parentSlice; callback.call(opt_this, curSlice); } }
[ "function", "(", "callback", ",", "opt_this", ")", "{", "var", "curSlice", "=", "this", ";", "while", "(", "curSlice", ".", "parentSlice", ")", "{", "curSlice", "=", "curSlice", ".", "parentSlice", ";", "callback", ".", "call", "(", "opt_this", ",", "curSlice", ")", ";", "}", "}" ]
Obtains the parents of a slice, from the most immediate to the root. For instance, E.iterateAllAncestors() in the following example: [ A ] [ B][ D ][ G ] [C] [E][F] [H] will pass D, then A to the provided callback, in the order from the leaves to the root.
[ "Obtains", "the", "parents", "of", "a", "slice", "from", "the", "most", "immediate", "to", "the", "root", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice.js#L183-L190
23,717
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
function(slice) { this.haveTopLevelSlicesBeenBuilt = false; slice.parentContainer = this.parentContainer_; this.slices.push(slice); return slice; }
javascript
function(slice) { this.haveTopLevelSlicesBeenBuilt = false; slice.parentContainer = this.parentContainer_; this.slices.push(slice); return slice; }
[ "function", "(", "slice", ")", "{", "this", ".", "haveTopLevelSlicesBeenBuilt", "=", "false", ";", "slice", ".", "parentContainer", "=", "this", ".", "parentContainer_", ";", "this", ".", "slices", ".", "push", "(", "slice", ")", ";", "return", "slice", ";", "}" ]
Helper function that pushes the provided slice onto the slices array. @param {Slice} slice The slice to be added to the slices array.
[ "Helper", "function", "that", "pushes", "the", "provided", "slice", "onto", "the", "slices", "array", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L96-L101
23,718
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
function(slices) { this.haveTopLevelSlicesBeenBuilt = false; slices.forEach(function(slice) { slice.parentContainer = this.parentContainer_; this.slices.push(slice); }, this); }
javascript
function(slices) { this.haveTopLevelSlicesBeenBuilt = false; slices.forEach(function(slice) { slice.parentContainer = this.parentContainer_; this.slices.push(slice); }, this); }
[ "function", "(", "slices", ")", "{", "this", ".", "haveTopLevelSlicesBeenBuilt", "=", "false", ";", "slices", ".", "forEach", "(", "function", "(", "slice", ")", "{", "slice", ".", "parentContainer", "=", "this", ".", "parentContainer_", ";", "this", ".", "slices", ".", "push", "(", "slice", ")", ";", "}", ",", "this", ")", ";", "}" ]
Helper function that pushes the provided slices onto the slices array. @param {Array.<Slice>} slices An array of slices to be added.
[ "Helper", "function", "that", "pushes", "the", "provided", "slices", "onto", "the", "slices", "array", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L107-L113
23,719
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
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
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; }
[ "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", ";", "}" ]
Opens a new slice in the group's slices. Calls to beginSlice and endSlice must be made with non-monotonically-decreasing timestamps. @param {String} category Category name of the slice to add. @param {String} title Title of the slice to add. @param {Number} ts The timetsamp of the slice, in milliseconds. @param {Object.<string, Object>=} opt_args Arguments associated with the slice. @param {Number=} opt_colorId The color of the slice, defined by its palette id (see ui/base/color_scheme.html).
[ "Opens", "a", "new", "slice", "in", "the", "group", "s", "slices", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L129-L149
23,720
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
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
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; }
[ "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", ";", "}" ]
Ends the last begun slice in this group and pushes it onto the slice array. @param {Number} ts Timestamp when the slice ended @param {Number=} opt_colorId The color of the slice, defined by its palette id (see ui/base/color_scheme.html). @return {Slice} slice.
[ "Ends", "the", "last", "begun", "slice", "in", "this", "group", "and", "pushes", "it", "onto", "the", "slice", "array", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L181-L199
23,721
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
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
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; }
[ "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", ";", "}" ]
Push a complete event as a Slice into the slice list. The timestamp can be in any order. @param {String} category Category name of the slice to add. @param {String} title Title of the slice to add. @param {Number} ts The timetsamp of the slice, in milliseconds. @param {Number} duration The duration of the slice, in milliseconds. @param {Object.<string, Object>=} opt_args Arguments associated with the slice. @param {Number=} opt_colorId The color of the slice, as defined by its palette id (see ui/base/color_scheme.html).
[ "Push", "a", "complete", "event", "as", "a", "Slice", "into", "the", "slice", "list", ".", "The", "timestamp", "can", "be", "in", "any", "order", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L214-L227
23,722
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
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
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_ = []; }
[ "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_", "=", "[", "]", ";", "}" ]
Closes any open slices. @param {Number=} opt_maxTimestamp The end time to use for the closed slices. If not provided, the max timestamp for this slice is provided.
[ "Closes", "any", "open", "slices", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L235-L244
23,723
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) { var slice = this.slices[sI]; slice.start = (slice.start + amount); } }
javascript
function(amount) { for (var sI = 0; sI < this.slices.length; sI++) { var slice = this.slices[sI]; slice.start = (slice.start + amount); } }
[ "function", "(", "amount", ")", "{", "for", "(", "var", "sI", "=", "0", ";", "sI", "<", "this", ".", "slices", ".", "length", ";", "sI", "++", ")", "{", "var", "slice", "=", "this", ".", "slices", "[", "sI", "]", ";", "slice", ".", "start", "=", "(", "slice", ".", "start", "+", "amount", ")", ";", "}", "}" ]
Shifts all the timestamps inside this group forward by the amount specified.
[ "Shifts", "all", "the", "timestamps", "inside", "this", "group", "forward", "by", "the", "amount", "specified", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L250-L255
23,724
googlearchive/node-big-rig
lib/third_party/tracing/model/slice_group.js
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
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); } }
[ "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", ")", ";", "}", "}" ]
Updates the bounds for this group based on the slices it contains.
[ "Updates", "the", "bounds", "for", "this", "group", "based", "on", "the", "slices", "it", "contains", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/slice_group.js#L260-L266
23,725
googlearchive/node-big-rig
lib/third_party/tracing/model/location.js
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
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; } }
[ "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", ";", "}", "}" ]
Returns the first valid containing track based on the internal yComponents.
[ "Returns", "the", "first", "valid", "containing", "track", "based", "on", "the", "internal", "yComponents", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/location.js#L112-L120
23,726
googlearchive/node-big-rig
lib/third_party/tracing/model/location.js
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
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 }; }
[ "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", "}", ";", "}" ]
Calculates and returns x and y coordinates of the current location with respect to the timeline's canvas.
[ "Calculates", "and", "returns", "x", "and", "y", "coordinates", "of", "the", "current", "location", "with", "respect", "to", "the", "timeline", "s", "canvas", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/location.js#L126-L146
23,727
googlearchive/node-big-rig
lib/third_party/tracing/model/container_memory_dump.js
ContainerMemoryDump
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
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; }
[ "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", ";", "}" ]
The ContainerMemoryDump represents an abstract container memory dump. @constructor
[ "The", "ContainerMemoryDump", "represents", "an", "abstract", "container", "memory", "dump", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/container_memory_dump.js#L19-L29
23,728
googlearchive/node-big-rig
lib/third_party/tracing/model/process.js
Process
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
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 = []; }
[ "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", "=", "[", "]", ";", "}" ]
The Process represents a single userland process in the trace. @constructor
[ "The", "Process", "represents", "a", "single", "userland", "process", "in", "the", "trace", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/process.js#L26-L39
23,729
googlearchive/node-big-rig
lib/third_party/tracing/ui/base/ui.js
decorate
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
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); } }
[ "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", ")", ";", "}", "}" ]
Decorates elements as an instance of a class. @param {string|!Element} source The way to find the element(s) to decorate. If this is a string then {@code querySeletorAll} is used to find the elements to decorate. @param {!Function} constr The constructor to decorate with. The constr needs to have a {@code decorate} function.
[ "Decorates", "elements", "as", "an", "instance", "of", "a", "class", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/ui/base/ui.js#L21-L32
23,730
googlearchive/node-big-rig
lib/third_party/tracing/ui/base/ui.js
define
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
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; }
[ "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", ";", "}", "/**\n * Creates a new UI element constructor.\n * Arguments passed to the constuctor are provided to the decorate method.\n * You will need to call the parent elements decorate method from within\n * your decorate method and pass any required parameters.\n * @constructor\n */", "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", ";", "}", "/**\n * Decorates an element as a UI element class.\n * @param {!Element} el The element to decorate.\n */", "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", ";", "}" ]
Defines a tracing UI component, a function that can be called to construct the component. tr class: var List = tr.ui.b.define('list'); List.prototype = { __proto__: HTMLUListElement.prototype, decorate: function() { ... }, ... }; Derived class: var CustomList = tr.ui.b.define('custom-list', List); CustomList.prototype = { __proto__: List.prototype, decorate: function() { ... }, ... }; @param {string} className The className of the newly created subtype. If subclassing by passing in opt_parentConstructor, this is used for debugging. If not subclassing, then it is the tag name that will be created by the component. @param {function=} opt_parentConstructor The parent class for this new element, if subclassing is desired. If provided, the parent class must be also a function created by tr.ui.b.define. @param {string=} opt_tagNS The namespace in which to create the base element. Has no meaning when opt_parentConstructor is passed and must either be undefined or the same namespace as the parent class. @return {function(Object=):Element} The newly created component constructor.
[ "Defines", "a", "tracing", "UI", "component", "a", "function", "that", "can", "be", "called", "to", "construct", "the", "component", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/ui/base/ui.js#L74-L148
23,731
googlearchive/node-big-rig
lib/third_party/tracing/ui/base/ui.js
f
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
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; }
[ "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", ";", "}" ]
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
[ "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", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/ui/base/ui.js#L109-L124
23,732
googlearchive/node-big-rig
lib/third_party/tracing/ui/annotations/comment_box_annotation_view.js
CommentBoxAnnotationView
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
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; }
[ "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", ";", "}" ]
A view of a comment box consisting of a textarea and a line to the actual location. @extends {AnnotationView} @constructor
[ "A", "view", "of", "a", "comment", "box", "consisting", "of", "a", "textarea", "and", "a", "line", "to", "the", "actual", "location", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/ui/annotations/comment_box_annotation_view.js#L18-L28
23,733
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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(""); }
[ "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", "(", "\"\"", ")", ";", "}" ]
Create URL for bitcoin URI scheme payments. https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki#Examples http://bitcoin.stackexchange.com/questions/4987/bitcoin-url-scheme @param {String} address Receiving address @param {String} amount Amount as big decimal @param {String} label [description] @param {[type]} message [description] @return {[type]} [description]
[ "Create", "URL", "for", "bitcoin", "URI", "scheme", "payments", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L40-L61
23,734
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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); }
[ "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", ")", ";", "}" ]
Build special HTML for bitcoin address manipulation. @param {DOM} elem Templatized target @param {DOM} source Original source tree element with data attributes
[ "Build", "special", "HTML", "for", "bitcoin", "address", "manipulation", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L68-L92
23,735
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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; }
[ "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", ";", "}" ]
Get the template element defined in the options. @return {[type]} [description]
[ "Get", "the", "template", "element", "defined", "in", "the", "options", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L98-L113
23,736
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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); }
[ "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", ")", ";", "}" ]
Applies bitcoinaddress DOM template to a certain element. The `target` element must contain necessary data-attributes from where we scoop the info. Also builds bitcoin: URI. @param {jQuery} elem jQuery selection of target bitcoin address @param {jQuery} template (optional) Template element to be applied
[ "Applies", "bitcoinaddress", "DOM", "template", "to", "a", "certain", "element", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L126-L145
23,737
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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); }); }
[ "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", ")", ";", "}", ")", ";", "}" ]
Scan the page for bitcoin addresses. Create user interface for all bitcoin address elements on the page-. You can call this function multiple times if new bitcoin addresses become available.
[ "Scan", "the", "page", "for", "bitcoin", "addresses", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L153-L182
23,738
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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(); }
[ "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", "(", ")", ";", "}" ]
Prepare selection in .bitcoin-address-container for copy paste
[ "Prepare", "selection", "in", ".", "bitcoin", "-", "address", "-", "container", "for", "copy", "paste" ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L187-L192
23,739
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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(); }
[ "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", "(", ")", ";", "}" ]
Send payment action handler
[ "Send", "payment", "action", "handler" ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L197-L202
23,740
miohtama/bitcoinaddress.js
bitcoinaddress.js
function(e) { e.preventDefault(); var elem = $(e.target).parents(".bitcoin-address-container"); this.prepareCopySelection(elem); return false; }
javascript
function(e) { e.preventDefault(); var elem = $(e.target).parents(".bitcoin-address-container"); this.prepareCopySelection(elem); return false; }
[ "function", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "var", "elem", "=", "$", "(", "e", ".", "target", ")", ".", "parents", "(", "\".bitcoin-address-container\"", ")", ";", "this", ".", "prepareCopySelection", "(", "elem", ")", ";", "return", "false", ";", "}" ]
Copy action handler.
[ "Copy", "action", "handler", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L207-L212
23,741
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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); }
[ "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", ")", ";", "}" ]
Generates QR code inside the target element.
[ "Generates", "QR", "code", "inside", "the", "target", "element", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L218-L236
23,742
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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; }
[ "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", ";", "}" ]
QR code generation action.
[ "QR", "code", "generation", "action", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L241-L256
23,743
miohtama/bitcoinaddress.js
bitcoinaddress.js
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
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(); }
[ "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", "(", ")", ";", "}" ]
Call to initialize the detault bitcoinprices UI.
[ "Call", "to", "initialize", "the", "detault", "bitcoinprices", "UI", "." ]
a91bce47f0a04a6fc2dc256af0c1b30b14b46628
https://github.com/miohtama/bitcoinaddress.js/blob/a91bce47f0a04a6fc2dc256af0c1b30b14b46628/bitcoinaddress.js#L291-L301
23,744
googlearchive/node-big-rig
lib/third_party/tracing/importer/import.js
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
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; }
[ "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", ";", "}" ]
Imports a trace with the usual options from importTraces, but does so using idle callbacks, putting up an import dialog during the import process.
[ "Imports", "a", "trace", "with", "the", "usual", "options", "from", "importTraces", "but", "does", "so", "using", "idle", "callbacks", "putting", "up", "an", "import", "dialog", "during", "the", "import", "process", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/importer/import.js#L74-L96
23,745
googlearchive/node-big-rig
lib/third_party/tracing/model/event_container.js
EventContainer
function EventContainer() { this.guid_ = tr.b.GUID.allocate(); this.important = true; this.bounds_ = new tr.b.Range(); }
javascript
function EventContainer() { this.guid_ = tr.b.GUID.allocate(); this.important = true; this.bounds_ = new tr.b.Range(); }
[ "function", "EventContainer", "(", ")", "{", "this", ".", "guid_", "=", "tr", ".", "b", ".", "GUID", ".", "allocate", "(", ")", ";", "this", ".", "important", "=", "true", ";", "this", ".", "bounds_", "=", "new", "tr", ".", "b", ".", "Range", "(", ")", ";", "}" ]
EventContainer is a base class for any class in the trace model that contains child events or child EventContainers. For all EventContainers, updateBounds() must be called after modifying the container's events if an up-to-date bounds is expected. @constructor
[ "EventContainer", "is", "a", "base", "class", "for", "any", "class", "in", "the", "trace", "model", "that", "contains", "child", "events", "or", "child", "EventContainers", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/event_container.js#L24-L28
23,746
googlearchive/node-big-rig
lib/third_party/tracing/model/event_container.js
function(callback, opt_this) { this.iterateAllEventContainers(function(ec) { ec.iterateAllEventsInThisContainer( function(eventType) { return true; }, callback, opt_this); }); }
javascript
function(callback, opt_this) { this.iterateAllEventContainers(function(ec) { ec.iterateAllEventsInThisContainer( function(eventType) { return true; }, callback, opt_this); }); }
[ "function", "(", "callback", ",", "opt_this", ")", "{", "this", ".", "iterateAllEventContainers", "(", "function", "(", "ec", ")", "{", "ec", ".", "iterateAllEventsInThisContainer", "(", "function", "(", "eventType", ")", "{", "return", "true", ";", "}", ",", "callback", ",", "opt_this", ")", ";", "}", ")", ";", "}" ]
Iterates over all ancestor events.
[ "Iterates", "over", "all", "ancestor", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/event_container.js#L90-L96
23,747
googlearchive/node-big-rig
lib/third_party/tracing/model/event_container.js
function(callback, opt_this) { function visit(ec) { callback.call(opt_this, ec); ec.iterateAllChildEventContainers(visit); } visit(this); }
javascript
function(callback, opt_this) { function visit(ec) { callback.call(opt_this, ec); ec.iterateAllChildEventContainers(visit); } visit(this); }
[ "function", "(", "callback", ",", "opt_this", ")", "{", "function", "visit", "(", "ec", ")", "{", "callback", ".", "call", "(", "opt_this", ",", "ec", ")", ";", "ec", ".", "iterateAllChildEventContainers", "(", "visit", ")", ";", "}", "visit", "(", "this", ")", ";", "}" ]
Iterates over this container and all ancestor containers.
[ "Iterates", "over", "this", "container", "and", "all", "ancestor", "containers", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/event_container.js#L101-L107
23,748
googlearchive/node-big-rig
lib/third_party/tracing/model/event.js
Event
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
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; }
[ "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", ";", "}" ]
An Event is the base type for any non-container, selectable piece of data in the trace model. @constructor @extends {SelectableItem}
[ "An", "Event", "is", "the", "base", "type", "for", "any", "non", "-", "container", "selectable", "piece", "of", "data", "in", "the", "trace", "model", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/event.js#L28-L34
23,749
googlearchive/node-big-rig
lib/third_party/tracing/model/thread_time_slice.js
ThreadTimeSlice
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
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; }
[ "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", ";", "}" ]
A ThreadTimeSlice is a slice of time on a specific thread where that thread was running on a specific CPU, or in a specific sleep state. As a thread switches moves through its life, it sometimes goes to sleep and can't run. Other times, its runnable but isn't actually assigned to a CPU. Finally, sometimes it gets put on a CPU to actually execute. Each of these states is represented by a ThreadTimeSlice: Sleeping or runnable: cpuOnWhichThreadWasRunning is undefined Running: cpuOnWhichThreadWasRunning is set. @constructor
[ "A", "ThreadTimeSlice", "is", "a", "slice", "of", "time", "on", "a", "specific", "thread", "where", "that", "thread", "was", "running", "on", "a", "specific", "CPU", "or", "in", "a", "specific", "sleep", "state", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread_time_slice.js#L50-L58
23,750
googlearchive/node-big-rig
lib/third_party/tracing/base/range_utils.js
findEmptyRangesBetweenRanges
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
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; }
[ "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", ";", "}" ]
Pass in |opt_totalRange| in order to find empty ranges before the first of |inRanges| and after the last of |inRanges|.
[ "Pass", "in", "|opt_totalRange|", "in", "order", "to", "find", "empty", "ranges", "before", "the", "first", "of", "|inRanges|", "and", "after", "the", "last", "of", "|inRanges|", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/range_utils.js#L81-L130
23,751
googlearchive/node-big-rig
lib/third_party/tracing/model/async_slice.js
AsyncSlice
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
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; }
[ "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", ";", "}" ]
A AsyncSlice represents an interval of time during which an asynchronous operation is in progress. An AsyncSlice consumes no CPU time itself and so is only associated with Threads at its start and end point. @constructor
[ "A", "AsyncSlice", "represents", "an", "interval", "of", "time", "during", "which", "an", "asynchronous", "operation", "is", "in", "progress", ".", "An", "AsyncSlice", "consumes", "no", "CPU", "time", "itself", "and", "so", "is", "only", "associated", "with", "Threads", "at", "its", "start", "and", "end", "point", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/async_slice.js#L24-L67
23,752
googlearchive/node-big-rig
lib/third_party/tracing/base/task.js
Task
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
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_ = []; }
[ "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_", "=", "[", "]", ";", "}" ]
A task is a combination of a run callback, a set of subtasks, and an after task. When executed, a task does the following things: 1. Runs its callback 2. Runs its subtasks 3. Runs its after callback. The list of subtasks and after task can be mutated inside step #1 but as soon as the task's callback returns, the subtask list and after task is fixed and cannot be changed again. Use task.after().after().after() to describe the toplevel passes that make up your computation. Then, use subTasks to add detail to each subtask as it runs. For example: var pieces = []; taskA = new Task(function() { pieces = getPieces(); }); taskA.after(function(taskA) { pieces.forEach(function(piece) { taskA.subTask(function(taskB) { piece.process(); }, this); }); }); @constructor
[ "A", "task", "is", "a", "combination", "of", "a", "run", "callback", "a", "set", "of", "subtasks", "and", "an", "after", "task", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/task.js#L38-L45
23,753
googlearchive/node-big-rig
lib/third_party/tracing/base/task.js
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
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]; }
[ "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", "]", ";", "}" ]
Runs the current task and returns the task that should be executed next.
[ "Runs", "the", "current", "task", "and", "returns", "the", "task", "that", "should", "be", "executed", "next", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/task.js#L62-L80
23,754
googlearchive/node-big-rig
lib/third_party/tracing/model/object_instance.js
ObjectInstance
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
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; }
[ "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", ";", "}" ]
An object with a specific id, whose state has been snapshotted several times. @constructor
[ "An", "object", "with", "a", "specific", "id", "whose", "state", "has", "been", "snapshotted", "several", "times", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/object_instance.js#L27-L43
23,755
googlearchive/node-big-rig
lib/third_party/tracing/extras/rail/proto_ir.js
ProtoIR
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
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(); }
[ "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", "(", ")", ";", "}" ]
This is an intermediate data format between InputLatencyAsyncSlices and Response and Animation IRs.
[ "This", "is", "an", "intermediate", "data", "format", "between", "InputLatencyAsyncSlices", "and", "Response", "and", "Animation", "IRs", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/proto_ir.js#L23-L29
23,756
googlearchive/node-big-rig
lib/third_party/tracing/extras/rail/proto_ir.js
function(typeNames) { for (var i = 0; i < this.associatedEvents.length; ++i) { if (typeNames.indexOf(this.associatedEvents[i].typeName) >= 0) return true; } return false; }
javascript
function(typeNames) { for (var i = 0; i < this.associatedEvents.length; ++i) { if (typeNames.indexOf(this.associatedEvents[i].typeName) >= 0) return true; } return false; }
[ "function", "(", "typeNames", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "associatedEvents", ".", "length", ";", "++", "i", ")", "{", "if", "(", "typeNames", ".", "indexOf", "(", "this", ".", "associatedEvents", "[", "i", "]", ".", "typeName", ")", ">=", "0", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Return true if any associatedEvent's typeName is in typeNames.
[ "Return", "true", "if", "any", "associatedEvent", "s", "typeName", "is", "in", "typeNames", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/proto_ir.js#L45-L51
23,757
googlearchive/node-big-rig
lib/third_party/tracing/extras/rail/proto_ir.js
function() { var debugString = this.irType + '('; debugString += parseInt(this.start) + ' '; debugString += parseInt(this.end); this.associatedEvents.forEach(function(event) { debugString += ' ' + event.typeName; }); return debugString + ')'; }
javascript
function() { var debugString = this.irType + '('; debugString += parseInt(this.start) + ' '; debugString += parseInt(this.end); this.associatedEvents.forEach(function(event) { debugString += ' ' + event.typeName; }); return debugString + ')'; }
[ "function", "(", ")", "{", "var", "debugString", "=", "this", ".", "irType", "+", "'('", ";", "debugString", "+=", "parseInt", "(", "this", ".", "start", ")", "+", "' '", ";", "debugString", "+=", "parseInt", "(", "this", ".", "end", ")", ";", "this", ".", "associatedEvents", ".", "forEach", "(", "function", "(", "event", ")", "{", "debugString", "+=", "' '", "+", "event", ".", "typeName", ";", "}", ")", ";", "return", "debugString", "+", "')'", ";", "}" ]
Return a string describing this ProtoIR for debugging.
[ "Return", "a", "string", "describing", "this", "ProtoIR", "for", "debugging", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/proto_ir.js#L151-L159
23,758
googlearchive/node-big-rig
lib/third_party/tracing/model/object_collection.js
ObjectCollection
function ObjectCollection(parent) { tr.model.EventContainer.call(this); this.parent = parent; this.instanceMapsById_ = {}; // id -> TimeToObjectInstanceMap this.instancesByTypeName_ = {}; this.createObjectInstance_ = this.createObjectInstance_.bind(this); }
javascript
function ObjectCollection(parent) { tr.model.EventContainer.call(this); this.parent = parent; this.instanceMapsById_ = {}; // id -> TimeToObjectInstanceMap this.instancesByTypeName_ = {}; this.createObjectInstance_ = this.createObjectInstance_.bind(this); }
[ "function", "ObjectCollection", "(", "parent", ")", "{", "tr", ".", "model", ".", "EventContainer", ".", "call", "(", "this", ")", ";", "this", ".", "parent", "=", "parent", ";", "this", ".", "instanceMapsById_", "=", "{", "}", ";", "// id -> TimeToObjectInstanceMap", "this", ".", "instancesByTypeName_", "=", "{", "}", ";", "this", ".", "createObjectInstance_", "=", "this", ".", "createObjectInstance_", ".", "bind", "(", "this", ")", ";", "}" ]
A collection of object instances and their snapshots, accessible by id and time, or by object name. @constructor
[ "A", "collection", "of", "object", "instances", "and", "their", "snapshots", "accessible", "by", "id", "and", "time", "or", "by", "object", "name", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/object_collection.js#L29-L35
23,759
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/gesture_parser.js
GestureParser
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
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)); }
[ "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", ")", ")", ";", "}" ]
Parses trace events generated by gesture library for touchpad. @constructor
[ "Parses", "trace", "events", "generated", "by", "gesture", "library", "for", "touchpad", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/gesture_parser.js#L22-L30
23,760
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/gesture_parser.js
function(title, ts, opt_args) { var thread = this.importer.getOrCreatePseudoThread('gesture').thread; thread.sliceGroup.beginSlice( 'touchpad_gesture', title, ts, opt_args); }
javascript
function(title, ts, opt_args) { var thread = this.importer.getOrCreatePseudoThread('gesture').thread; thread.sliceGroup.beginSlice( 'touchpad_gesture', title, ts, opt_args); }
[ "function", "(", "title", ",", "ts", ",", "opt_args", ")", "{", "var", "thread", "=", "this", ".", "importer", ".", "getOrCreatePseudoThread", "(", "'gesture'", ")", ".", "thread", ";", "thread", ".", "sliceGroup", ".", "beginSlice", "(", "'touchpad_gesture'", ",", "title", ",", "ts", ",", "opt_args", ")", ";", "}" ]
Parse events generate by gesture library. gestureOpenSlice and gestureCloseSlice are two common functions to store the begin time and end time for all events in gesture library
[ "Parse", "events", "generate", "by", "gesture", "library", ".", "gestureOpenSlice", "and", "gestureCloseSlice", "are", "two", "common", "functions", "to", "store", "the", "begin", "time", "and", "end", "time", "for", "all", "events", "in", "gesture", "library" ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/gesture_parser.js#L41-L45
23,761
googlearchive/node-big-rig
lib/third_party/tracing/model/counter.js
Counter
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
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 = []; }
[ "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", "=", "[", "]", ";", "}" ]
A container holding all series of a given type of measurement. As an example, if we're measuring the throughput of data sent over several USB connections, the throughput of each cable might be added as a separate series to a single counter. @constructor @extends {EventContainer}
[ "A", "container", "holding", "all", "series", "of", "a", "given", "type", "of", "measurement", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/counter.js#L26-L36
23,762
googlearchive/node-big-rig
lib/third_party/tracing/model/counter.js
function(amount) { for (var i = 0; i < this.series_.length; ++i) this.series_[i].shiftTimestampsForward(amount); }
javascript
function(amount) { for (var i = 0; i < this.series_.length; ++i) this.series_[i].shiftTimestampsForward(amount); }
[ "function", "(", "amount", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "series_", ".", "length", ";", "++", "i", ")", "this", ".", "series_", "[", "i", "]", ".", "shiftTimestampsForward", "(", "amount", ")", ";", "}" ]
Shifts all the timestamps inside this counter forward by the amount specified.
[ "Shifts", "all", "the", "timestamps", "inside", "this", "counter", "forward", "by", "the", "amount", "specified", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/counter.js#L139-L142
23,763
googlearchive/node-big-rig
lib/third_party/tracing/model/counter.js
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
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); } }
[ "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", ")", ";", "}", "}" ]
Updates the bounds for this counter based on the samples it contains.
[ "Updates", "the", "bounds", "for", "this", "counter", "based", "on", "the", "samples", "it", "contains", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/counter.js#L147-L175
23,764
googlearchive/node-big-rig
lib/third_party/tracing/model/time_to_object_instance_map.js
TimeToObjectInstanceMap
function TimeToObjectInstanceMap(createObjectInstanceFunction, parent, id) { this.createObjectInstanceFunction_ = createObjectInstanceFunction; this.parent = parent; this.id = id; this.instances = []; }
javascript
function TimeToObjectInstanceMap(createObjectInstanceFunction, parent, id) { this.createObjectInstanceFunction_ = createObjectInstanceFunction; this.parent = parent; this.id = id; this.instances = []; }
[ "function", "TimeToObjectInstanceMap", "(", "createObjectInstanceFunction", ",", "parent", ",", "id", ")", "{", "this", ".", "createObjectInstanceFunction_", "=", "createObjectInstanceFunction", ";", "this", ".", "parent", "=", "parent", ";", "this", ".", "id", "=", "id", ";", "this", ".", "instances", "=", "[", "]", ";", "}" ]
Tracks all the instances associated with a given ID over its lifetime. An id can be used multiple times throughout a trace, referring to different objects at different times. This data structure does the bookkeeping to figure out what ObjectInstance is referred to at a given timestamp. @constructor
[ "Tracks", "all", "the", "instances", "associated", "with", "a", "given", "ID", "over", "its", "lifetime", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/time_to_object_instance_map.js#L25-L30
23,765
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/regulator_parser.js
RegulatorParser
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
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_; }
[ "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_", ";", "}" ]
Parses linux regulator trace events. @constructor
[ "Parses", "linux", "regulator", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/regulator_parser.js#L23-L42
23,766
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/regulator_parser.js
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
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; }
[ "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", ";", "}" ]
Get or create a counter with one series.
[ "Get", "or", "create", "a", "counter", "with", "one", "series", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/regulator_parser.js#L59-L69
23,767
googlearchive/node-big-rig
lib/third_party/tracing/model/timed_event.js
TimedEvent
function TimedEvent(start) { tr.model.Event.call(this); this.start = start; this.duration = 0; this.cpuStart = undefined; this.cpuDuration = undefined; }
javascript
function TimedEvent(start) { tr.model.Event.call(this); this.start = start; this.duration = 0; this.cpuStart = undefined; this.cpuDuration = undefined; }
[ "function", "TimedEvent", "(", "start", ")", "{", "tr", ".", "model", ".", "Event", ".", "call", "(", "this", ")", ";", "this", ".", "start", "=", "start", ";", "this", ".", "duration", "=", "0", ";", "this", ".", "cpuStart", "=", "undefined", ";", "this", ".", "cpuDuration", "=", "undefined", ";", "}" ]
A TimedEvent is the base type for any piece of data in the trace model with a specific start and duration. @constructor
[ "A", "TimedEvent", "is", "the", "base", "type", "for", "any", "piece", "of", "data", "in", "the", "trace", "model", "with", "a", "specific", "start", "and", "duration", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/timed_event.js#L23-L29
23,768
googlearchive/node-big-rig
lib/third_party/tracing/model/timed_event.js
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
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; }
[ "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", ";", "}" ]
bounds returns whether that TimedEvent happens within this timed event
[ "bounds", "returns", "whether", "that", "TimedEvent", "happens", "within", "this", "timed", "event" ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/timed_event.js#L44-L51
23,769
googlearchive/node-big-rig
lib/third_party/tracing/base/iteration_helpers.js
comparePossiblyUndefinedValues
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
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; }
[ "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", ";", "}" ]
Compares two values when one or both might be undefined. Undefined values are sorted after defined.
[ "Compares", "two", "values", "when", "one", "or", "both", "might", "be", "undefined", ".", "Undefined", "values", "are", "sorted", "after", "defined", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/iteration_helpers.js#L39-L47
23,770
googlearchive/node-big-rig
lib/third_party/tracing/base/iteration_helpers.js
group
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
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; }, {}); }
[ "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", ";", "}", ",", "{", "}", ")", ";", "}" ]
Returns a new dictionary with items grouped by the return value of the specified function being called on each item. @param {!Array.<Object>} ary The array being iterated through @param {!Function} fn The mapping function between the array value and the map key.
[ "Returns", "a", "new", "dictionary", "with", "items", "grouped", "by", "the", "return", "value", "of", "the", "specified", "function", "being", "called", "on", "each", "item", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/iteration_helpers.js#L119-L130
23,771
googlearchive/node-big-rig
lib/third_party/tracing/base/iteration_helpers.js
invertArrayOfDicts
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
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; }
[ "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", ";", "}" ]
Convert an array of dictionaries to a dictionary of arrays. The keys of the resulting dictionary are a union of the keys of all dictionaries in the provided array. Each array in the resulting dictionary has the same length as the provided array and contains the values of its key in the dictionaries in the provided array. Example: INPUT: [ {a: 6, b: 5 }, undefined, {a: 4, b: 3, c: 2}, { b: 1, c: 0} ] OUTPUT: { a: [6, undefined, 4, undefined], b: [5, undefined, 3, 1 ], c: [undefined, undefined, 2, 0 ] } @param {!Array} array Array of items to be inverted. If opt_dictGetter is not provided, all elements of the array must be either undefined, or dictionaries. @param {?(function(*): (!Object|undefined))=} opt_dictGetter Optional function mapping defined elements of array to dictionaries. @param {*=} opt_this Optional 'this' context for opt_dictGetter.
[ "Convert", "an", "array", "of", "dictionaries", "to", "a", "dictionary", "of", "arrays", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/iteration_helpers.js#L227-L245
23,772
googlearchive/node-big-rig
lib/third_party/tracing/base/iteration_helpers.js
arrayToDict
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
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; }
[ "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", ";", "}" ]
Convert an array to a dictionary. Every element in the array is mapped in the dictionary to the key returned by the provided function: dictionary[valueToKeyFn(element)] = element; @param {!Array} array Arbitrary array. @param {function(*): string} valueToKeyFn Function mapping array elements to dictionary keys. @param {*=} opt_this Optional 'this' context for valueToKeyFn.
[ "Convert", "an", "array", "to", "a", "dictionary", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/iteration_helpers.js#L260-L270
23,773
googlearchive/node-big-rig
lib/third_party/tracing/model/process_memory_dump.js
ProcessMemoryDump
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
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; }
[ "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", ";", "}" ]
The ProcessMemoryDump represents a memory dump of a single process. @constructor
[ "The", "ProcessMemoryDump", "represents", "a", "memory", "dump", "of", "a", "single", "process", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/process_memory_dump.js#L43-L65
23,774
googlearchive/node-big-rig
lib/third_party/tracing/model/thread_slice.js
ThreadSlice
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
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 = []; }
[ "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", "=", "[", "]", ";", "}" ]
A ThreadSlice represents an interval of time on a thread resource with associated nesting slice information. ThreadSlices are typically associated with a specific trace event pair on a specific thread. For example, TRACE_EVENT_BEGIN1("x","myArg", 7) at time=0.1ms TRACE_EVENT_END0() at time=0.3ms This results in a single slice from 0.1 with duration 0.2 on a specific thread. @constructor
[ "A", "ThreadSlice", "represents", "an", "interval", "of", "time", "on", "a", "thread", "resource", "with", "associated", "nesting", "slice", "information", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread_slice.js#L31-L39
23,775
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/trace_event_importer.js
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
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 }); }
[ "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", "}", ")", ";", "}" ]
Helper to process a flow event.
[ "Helper", "to", "process", "a", "flow", "event", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/trace_event_importer.js#L237-L247
23,776
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/trace_event_importer.js
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
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); }); }
[ "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", ")", ";", "}", ")", ";", "}" ]
Helper that creates and adds samples to a Counter object based on 'C' phase events.
[ "Helper", "that", "creates", "and", "adds", "samples", "to", "a", "Counter", "object", "based", "on", "C", "phase", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/trace_event_importer.js#L253-L290
23,777
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/trace_event_importer.js
function() { if (this.softwareMeasuredCpuCount_ !== undefined) { this.model_.kernel.softwareMeasuredCpuCount = this.softwareMeasuredCpuCount_; } this.createAsyncSlices_(); this.createFlowSlices_(); this.createExplicitObjects_(); this.createImplicitObjects_(); this.createMemoryDumps_(); }
javascript
function() { if (this.softwareMeasuredCpuCount_ !== undefined) { this.model_.kernel.softwareMeasuredCpuCount = this.softwareMeasuredCpuCount_; } this.createAsyncSlices_(); this.createFlowSlices_(); this.createExplicitObjects_(); this.createImplicitObjects_(); this.createMemoryDumps_(); }
[ "function", "(", ")", "{", "if", "(", "this", ".", "softwareMeasuredCpuCount_", "!==", "undefined", ")", "{", "this", ".", "model_", ".", "kernel", ".", "softwareMeasuredCpuCount", "=", "this", ".", "softwareMeasuredCpuCount_", ";", "}", "this", ".", "createAsyncSlices_", "(", ")", ";", "this", ".", "createFlowSlices_", "(", ")", ";", "this", ".", "createExplicitObjects_", "(", ")", ";", "this", ".", "createImplicitObjects_", "(", ")", ";", "this", ".", "createMemoryDumps_", "(", ")", ";", "}" ]
Called by the Model after all other importers have imported their events.
[ "Called", "by", "the", "Model", "after", "all", "other", "importers", "have", "imported", "their", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/trace_event_importer.js#L835-L845
23,778
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/trace_event_importer.js
concatenateArguments
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
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); }
[ "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", ")", ";", "}" ]
Include args for both END and BEGIN for a matched pair.
[ "Include", "args", "for", "both", "END", "and", "BEGIN", "for", "a", "matched", "pair", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/trace_event_importer.js#L1070-L1078
23,779
googlearchive/node-big-rig
lib/third_party/tracing/model/heap_dump.js
HeapEntry
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
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; }
[ "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", ";", "}" ]
HeapEntry represents a single value describing the state of the heap of an allocator in a single process. An entry specifies how much space (e.g. 19 MiB) was allocated in a particular context, which consists of a codepath (e.g. drawQuad <- draw <- MessageLoop::RunTask). @{constructor}
[ "HeapEntry", "represents", "a", "single", "value", "describing", "the", "state", "of", "the", "heap", "of", "an", "allocator", "in", "a", "single", "process", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/heap_dump.js#L23-L34
23,780
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/kfunc_parser.js
KernelFuncParser
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
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_ = {}; }
[ "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_", "=", "{", "}", ";", "}" ]
Parses graph_ent and graph_ret events that were inserted by the Linux kernel's function graph trace. @constructor
[ "Parses", "graph_ent", "and", "graph_ret", "events", "that", "were", "inserted", "by", "the", "Linux", "kernel", "s", "function", "graph", "trace", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/kfunc_parser.js#L24-L36
23,781
googlearchive/node-big-rig
lib/third_party/tracing/model/global_memory_dump.js
GlobalMemoryDump
function GlobalMemoryDump(model, start) { tr.model.ContainerMemoryDump.call(this, start); this.model = model; this.processMemoryDumps = {}; }
javascript
function GlobalMemoryDump(model, start) { tr.model.ContainerMemoryDump.call(this, start); this.model = model; this.processMemoryDumps = {}; }
[ "function", "GlobalMemoryDump", "(", "model", ",", "start", ")", "{", "tr", ".", "model", ".", "ContainerMemoryDump", ".", "call", "(", "this", ",", "start", ")", ";", "this", ".", "model", "=", "model", ";", "this", ".", "processMemoryDumps", "=", "{", "}", ";", "}" ]
The GlobalMemoryDump represents a simultaneous memory dump of all processes. @constructor
[ "The", "GlobalMemoryDump", "represents", "a", "simultaneous", "memory", "dump", "of", "all", "processes", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/global_memory_dump.js#L23-L27
23,782
googlearchive/node-big-rig
lib/third_party/tracing/model/global_memory_dump.js
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
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)); }
[ "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", ")", ")", ";", "}" ]
Calculate the effective size of all memory allocator dumps in the dump graph. The effective size refers to the amount of memory a particular component is using/consuming. In other words, every (reported) byte of used memory is uniquely attributed to exactly one component. Consequently, unlike size, effective size is cumulative, i.e. the sum of the effective sizes of (top-level) components is equal to the total amount of (reported) used memory. Metric motivation: "How much memory does a (sub)system use?" or "For how much memory should a (sub)system be 'charged'?" Please refer to the Memory Dump Graph Metric Calculation design document for more details (https://goo.gl/fKg0dt). This method assumes that the size of all contained memory allocator dumps has already been calculated [see calculateSizes()].
[ "Calculate", "the", "effective", "size", "of", "all", "memory", "allocator", "dumps", "in", "the", "dump", "graph", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/global_memory_dump.js#L303-L323
23,783
googlearchive/node-big-rig
lib/third_party/tracing/model/global_memory_dump.js
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
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; }
[ "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", ";", "}" ]
Calculate owned and owning coefficients of a memory allocator dump and its owners. The owning coefficient refers to the proportion of a dump's not-owning sub-size which is attributed to the dump (only relevant to owning MADs). Conversely, the owned coefficient is the proportion of a dump's not-owned sub-size, which is attributed to it (only relevant to owned MADs). The not-owned size of the owned dump is split among its owners in the order of the ownership importance as demonstrated by the following example: memory allocator dumps OWNED OWNER1 OWNER2 OWNER3 OWNER4 not-owned sub-size [given] 10 - - - - not-owning sub-size [given] - 6 7 5 8 importance [given] - 2 2 1 0 attributed not-owned sub-size 2 - - - - attributed not-owning sub-size - 3 4 0 1 owned coefficient 2/10 - - - - owning coefficient - 3/6 4/7 0/5 1/8 Explanation: Firstly, 6 bytes are split equally among OWNER1 and OWNER2 (highest importance). OWNER2 owns one more byte, so its attributed not-owning sub-size is 6/2 + 1 = 4 bytes. OWNER3 is attributed no size because it is smaller than the owners with higher priority. However, OWNER4 is larger, so it's attributed the difference 8 - 7 = 1 byte. Finally, 2 bytes remain unattributed and are hence kept in the OWNED dump as attributed not-owned sub-size. The coefficients are then directly calculated as fractions of the sub-sizes and corresponding attributed sub-sizes. Note that we always assume that all ownerships of a dump overlap (e.g. OWNER3 is subsumed by both OWNER1 and OWNER2). Hence, the table could be alternatively represented as follows: owned memory range 0 1 2 3 4 5 6 7 8 9 10 Priority 2 | OWNER1 + OWNER2 (split) | OWNER2 | Priority 1 | (already attributed) | Priority 0 | - - - (already attributed) - - - | OWNER4 | Remainder | - - - - - (already attributed) - - - - - - | OWNED | This method assumes that (1) the size of the dump [see calculateSizes()] and (2) the not-owned size of the dump and not-owning sub-sizes of its owners [see the first step of calculateEffectiveSizes()] have already been calculated. Note that the method doesn't make any assumptions about the order in which dumps are visited.
[ "Calculate", "owned", "and", "owning", "coefficients", "of", "a", "memory", "allocator", "dump", "and", "its", "owners", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/global_memory_dump.js#L454-L526
23,784
googlearchive/node-big-rig
lib/third_party/tracing/model/global_memory_dump.js
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
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)); } }
[ "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", ")", ")", ";", "}", "}" ]
Calculate the effective size of a memory allocator dump. In order to simplify the (already complex) calculation, we use the fact that effective size is cumulative (unlike regular size), i.e. the effective size of a non-leaf node is equal to the sum of effective sizes of its children. The effective size of a leaf MAD is calculated as: effectiveSize(M) = size(M) * cumulativeOwningC(M) * cumulativeOwnedC(M) This method assumes that (1) the size of the dump and its children [see calculateSizes()] and (2) the cumulative owning and owned coefficients of the dump (if it's a leaf node) [see the third step of calculateEffectiveSizes()] or the effective sizes of its children (if it's a non-leaf node) [depth-first post-order traversal] have already been calculated.
[ "Calculate", "the", "effective", "size", "of", "a", "memory", "allocator", "dump", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/global_memory_dump.js#L613-L675
23,785
googlearchive/node-big-rig
lib/third_party/tracing/model/global_memory_dump.js
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
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); }
[ "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", ")", ";", "}" ]
Traverse the memory dump graph in a depth first post-order, i.e. children and owners of a memory allocator dump are visited before the dump itself. This method will throw an exception if the graph contains a cycle.
[ "Traverse", "the", "memory", "dump", "graph", "in", "a", "depth", "first", "post", "-", "order", "i", ".", "e", ".", "children", "and", "owners", "of", "a", "memory", "allocator", "dump", "are", "visited", "before", "the", "dump", "itself", ".", "This", "method", "will", "throw", "an", "exception", "if", "the", "graph", "contains", "a", "cycle", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/global_memory_dump.js#L753-L781
23,786
googlearchive/node-big-rig
lib/third_party/tracing/model/global_memory_dump.js
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
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); }
[ "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", ")", ";", "}" ]
Traverse the memory dump graph in a depth first pre-order, i.e. children and owners of a memory allocator dump are visited after the dump itself. This method will not visit some dumps if the graph contains a cycle.
[ "Traverse", "the", "memory", "dump", "graph", "in", "a", "depth", "first", "pre", "-", "order", "i", ".", "e", ".", "children", "and", "owners", "of", "a", "memory", "allocator", "dump", "are", "visited", "after", "the", "dump", "itself", ".", "This", "method", "will", "not", "visit", "some", "dumps", "if", "the", "graph", "contains", "a", "cycle", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/global_memory_dump.js#L789-L820
23,787
googlearchive/node-big-rig
lib/third_party/tracing/model/model_indices.js
ModelIndices
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
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); }
[ "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", ")", ";", "}" ]
A Event Index maps an id to all the events that have that particular id @constructor
[ "A", "Event", "Index", "maps", "an", "id", "to", "all", "the", "events", "that", "have", "that", "particular", "id" ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/model_indices.js#L20-L31
23,788
googlearchive/node-big-rig
lib/third_party/tracing/model/async_slice_group.js
AsyncSliceGroup
function AsyncSliceGroup(parentContainer, opt_name) { tr.model.EventContainer.call(this); this.parentContainer_ = parentContainer; this.slices = []; this.name_ = opt_name; this.viewSubGroups_ = undefined; }
javascript
function AsyncSliceGroup(parentContainer, opt_name) { tr.model.EventContainer.call(this); this.parentContainer_ = parentContainer; this.slices = []; this.name_ = opt_name; this.viewSubGroups_ = undefined; }
[ "function", "AsyncSliceGroup", "(", "parentContainer", ",", "opt_name", ")", "{", "tr", ".", "model", ".", "EventContainer", ".", "call", "(", "this", ")", ";", "this", ".", "parentContainer_", "=", "parentContainer", ";", "this", ".", "slices", "=", "[", "]", ";", "this", ".", "name_", "=", "opt_name", ";", "this", ".", "viewSubGroups_", "=", "undefined", ";", "}" ]
A group of AsyncSlices associated with a thread. @constructor @extends {tr.model.EventContainer}
[ "A", "group", "of", "AsyncSlices", "associated", "with", "a", "thread", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/async_slice_group.js#L23-L29
23,789
googlearchive/node-big-rig
lib/third_party/tracing/model/async_slice_group.js
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
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); } }
[ "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", ")", ";", "}", "}" ]
Shifts all the timestamps inside this group forward by the amount specified, including all nested subSlices if there are any.
[ "Shifts", "all", "the", "timestamps", "inside", "this", "group", "forward", "by", "the", "amount", "specified", "including", "all", "nested", "subSlices", "if", "there", "are", "any", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/async_slice_group.js#L75-L90
23,790
googlearchive/node-big-rig
lib/third_party/tracing/model/async_slice_group.js
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
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); } }
[ "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", ")", ";", "}", "}" ]
Shift all nested subSlices recursively.
[ "Shift", "all", "nested", "subSlices", "recursively", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/async_slice_group.js#L80-L87
23,791
googlearchive/node-big-rig
lib/third_party/tracing/model/process_base.js
ProcessBase
function ProcessBase(model) { if (!model) throw new Error('Must provide a model'); tr.model.EventContainer.call(this); this.model = model; this.threads = {}; this.counters = {}; this.objects = new tr.model.ObjectCollection(this); this.sortIndex = 0; }
javascript
function ProcessBase(model) { if (!model) throw new Error('Must provide a model'); tr.model.EventContainer.call(this); this.model = model; this.threads = {}; this.counters = {}; this.objects = new tr.model.ObjectCollection(this); this.sortIndex = 0; }
[ "function", "ProcessBase", "(", "model", ")", "{", "if", "(", "!", "model", ")", "throw", "new", "Error", "(", "'Must provide a model'", ")", ";", "tr", ".", "model", ".", "EventContainer", ".", "call", "(", "this", ")", ";", "this", ".", "model", "=", "model", ";", "this", ".", "threads", "=", "{", "}", ";", "this", ".", "counters", "=", "{", "}", ";", "this", ".", "objects", "=", "new", "tr", ".", "model", ".", "ObjectCollection", "(", "this", ")", ";", "this", ".", "sortIndex", "=", "0", ";", "}" ]
The ProcessBase is a partial base class, upon which Kernel and Process are built. @constructor @extends {tr.model.EventContainer}
[ "The", "ProcessBase", "is", "a", "partial", "base", "class", "upon", "which", "Kernel", "and", "Process", "are", "built", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/process_base.js#L31-L40
23,792
googlearchive/node-big-rig
lib/third_party/tracing/model/process_base.js
function() { var threadsToKeep = {}; for (var tid in this.threads) { var thread = this.threads[tid]; if (!thread.isEmpty) threadsToKeep[tid] = thread; } this.threads = threadsToKeep; }
javascript
function() { var threadsToKeep = {}; for (var tid in this.threads) { var thread = this.threads[tid]; if (!thread.isEmpty) threadsToKeep[tid] = thread; } this.threads = threadsToKeep; }
[ "function", "(", ")", "{", "var", "threadsToKeep", "=", "{", "}", ";", "for", "(", "var", "tid", "in", "this", ".", "threads", ")", "{", "var", "thread", "=", "this", ".", "threads", "[", "tid", "]", ";", "if", "(", "!", "thread", ".", "isEmpty", ")", "threadsToKeep", "[", "tid", "]", "=", "thread", ";", "}", "this", ".", "threads", "=", "threadsToKeep", ";", "}" ]
Removes threads from the process that are fully empty.
[ "Removes", "threads", "from", "the", "process", "that", "are", "fully", "empty", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/process_base.js#L188-L196
23,793
googlearchive/node-big-rig
lib/third_party/tracing/model/thread.js
Thread
function Thread(parent, tid) { if (!parent) throw new Error('Parent must be provided.'); tr.model.EventContainer.call(this); this.parent = parent; this.sortIndex = 0; this.tid = tid; this.name = undefined; this.samples_ = undefined; // Set during createSubSlices var that = this; this.sliceGroup = new SliceGroup(this, ThreadSlice, 'slices'); this.timeSlices = undefined; this.kernelSliceGroup = new SliceGroup( this, ThreadSlice, 'kernel-slices'); this.asyncSliceGroup = new AsyncSliceGroup(this, 'async-slices'); }
javascript
function Thread(parent, tid) { if (!parent) throw new Error('Parent must be provided.'); tr.model.EventContainer.call(this); this.parent = parent; this.sortIndex = 0; this.tid = tid; this.name = undefined; this.samples_ = undefined; // Set during createSubSlices var that = this; this.sliceGroup = new SliceGroup(this, ThreadSlice, 'slices'); this.timeSlices = undefined; this.kernelSliceGroup = new SliceGroup( this, ThreadSlice, 'kernel-slices'); this.asyncSliceGroup = new AsyncSliceGroup(this, 'async-slices'); }
[ "function", "Thread", "(", "parent", ",", "tid", ")", "{", "if", "(", "!", "parent", ")", "throw", "new", "Error", "(", "'Parent must be provided.'", ")", ";", "tr", ".", "model", ".", "EventContainer", ".", "call", "(", "this", ")", ";", "this", ".", "parent", "=", "parent", ";", "this", ".", "sortIndex", "=", "0", ";", "this", ".", "tid", "=", "tid", ";", "this", ".", "name", "=", "undefined", ";", "this", ".", "samples_", "=", "undefined", ";", "// Set during createSubSlices", "var", "that", "=", "this", ";", "this", ".", "sliceGroup", "=", "new", "SliceGroup", "(", "this", ",", "ThreadSlice", ",", "'slices'", ")", ";", "this", ".", "timeSlices", "=", "undefined", ";", "this", ".", "kernelSliceGroup", "=", "new", "SliceGroup", "(", "this", ",", "ThreadSlice", ",", "'kernel-slices'", ")", ";", "this", ".", "asyncSliceGroup", "=", "new", "AsyncSliceGroup", "(", "this", ",", "'async-slices'", ")", ";", "}" ]
A Thread stores all the trace events collected for a particular thread. We organize the synchronous slices on a thread by "subrows," where subrow 0 has all the root slices, subrow 1 those nested 1 deep, and so on. The asynchronous slices are stored in an AsyncSliceGroup object. The slices stored on a Thread should be instances of ThreadSlice. @constructor @extends {tr.model.EventContainer}
[ "A", "Thread", "stores", "all", "the", "trace", "events", "collected", "for", "a", "particular", "thread", ".", "We", "organize", "the", "synchronous", "slices", "on", "a", "thread", "by", "subrows", "where", "subrow", "0", "has", "all", "the", "root", "slices", "subrow", "1", "those", "nested", "1", "deep", "and", "so", "on", ".", "The", "asynchronous", "slices", "are", "stored", "in", "an", "AsyncSliceGroup", "object", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread.js#L39-L57
23,794
googlearchive/node-big-rig
lib/third_party/tracing/model/thread.js
function(amount) { this.sliceGroup.shiftTimestampsForward(amount); if (this.timeSlices) { for (var i = 0; i < this.timeSlices.length; i++) { var slice = this.timeSlices[i]; slice.start += amount; } } this.kernelSliceGroup.shiftTimestampsForward(amount); this.asyncSliceGroup.shiftTimestampsForward(amount); }
javascript
function(amount) { this.sliceGroup.shiftTimestampsForward(amount); if (this.timeSlices) { for (var i = 0; i < this.timeSlices.length; i++) { var slice = this.timeSlices[i]; slice.start += amount; } } this.kernelSliceGroup.shiftTimestampsForward(amount); this.asyncSliceGroup.shiftTimestampsForward(amount); }
[ "function", "(", "amount", ")", "{", "this", ".", "sliceGroup", ".", "shiftTimestampsForward", "(", "amount", ")", ";", "if", "(", "this", ".", "timeSlices", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "timeSlices", ".", "length", ";", "i", "++", ")", "{", "var", "slice", "=", "this", ".", "timeSlices", "[", "i", "]", ";", "slice", ".", "start", "+=", "amount", ";", "}", "}", "this", ".", "kernelSliceGroup", ".", "shiftTimestampsForward", "(", "amount", ")", ";", "this", ".", "asyncSliceGroup", ".", "shiftTimestampsForward", "(", "amount", ")", ";", "}" ]
Shifts all the timestamps inside this thread forward by the amount specified.
[ "Shifts", "all", "the", "timestamps", "inside", "this", "thread", "forward", "by", "the", "amount", "specified", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread.js#L102-L114
23,795
googlearchive/node-big-rig
lib/third_party/tracing/model/thread.js
function() { this.bounds.reset(); this.sliceGroup.updateBounds(); this.bounds.addRange(this.sliceGroup.bounds); this.kernelSliceGroup.updateBounds(); this.bounds.addRange(this.kernelSliceGroup.bounds); this.asyncSliceGroup.updateBounds(); this.bounds.addRange(this.asyncSliceGroup.bounds); if (this.timeSlices && this.timeSlices.length) { this.bounds.addValue(this.timeSlices[0].start); this.bounds.addValue( this.timeSlices[this.timeSlices.length - 1].end); } if (this.samples_ && this.samples_.length) { this.bounds.addValue(this.samples_[0].start); this.bounds.addValue( this.samples_[this.samples_.length - 1].end); } }
javascript
function() { this.bounds.reset(); this.sliceGroup.updateBounds(); this.bounds.addRange(this.sliceGroup.bounds); this.kernelSliceGroup.updateBounds(); this.bounds.addRange(this.kernelSliceGroup.bounds); this.asyncSliceGroup.updateBounds(); this.bounds.addRange(this.asyncSliceGroup.bounds); if (this.timeSlices && this.timeSlices.length) { this.bounds.addValue(this.timeSlices[0].start); this.bounds.addValue( this.timeSlices[this.timeSlices.length - 1].end); } if (this.samples_ && this.samples_.length) { this.bounds.addValue(this.samples_[0].start); this.bounds.addValue( this.samples_[this.samples_.length - 1].end); } }
[ "function", "(", ")", "{", "this", ".", "bounds", ".", "reset", "(", ")", ";", "this", ".", "sliceGroup", ".", "updateBounds", "(", ")", ";", "this", ".", "bounds", ".", "addRange", "(", "this", ".", "sliceGroup", ".", "bounds", ")", ";", "this", ".", "kernelSliceGroup", ".", "updateBounds", "(", ")", ";", "this", ".", "bounds", ".", "addRange", "(", "this", ".", "kernelSliceGroup", ".", "bounds", ")", ";", "this", ".", "asyncSliceGroup", ".", "updateBounds", "(", ")", ";", "this", ".", "bounds", ".", "addRange", "(", "this", ".", "asyncSliceGroup", ".", "bounds", ")", ";", "if", "(", "this", ".", "timeSlices", "&&", "this", ".", "timeSlices", ".", "length", ")", "{", "this", ".", "bounds", ".", "addValue", "(", "this", ".", "timeSlices", "[", "0", "]", ".", "start", ")", ";", "this", ".", "bounds", ".", "addValue", "(", "this", ".", "timeSlices", "[", "this", ".", "timeSlices", ".", "length", "-", "1", "]", ".", "end", ")", ";", "}", "if", "(", "this", ".", "samples_", "&&", "this", ".", "samples_", ".", "length", ")", "{", "this", ".", "bounds", ".", "addValue", "(", "this", ".", "samples_", "[", "0", "]", ".", "start", ")", ";", "this", ".", "bounds", ".", "addValue", "(", "this", ".", "samples_", "[", "this", ".", "samples_", ".", "length", "-", "1", "]", ".", "end", ")", ";", "}", "}" ]
Updates the bounds based on the current objects associated with the thread.
[ "Updates", "the", "bounds", "based", "on", "the", "current", "objects", "associated", "with", "the", "thread", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread.js#L140-L163
23,796
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/v8/codemap.js
CodeMap
function CodeMap() { /** * Dynamic code entries. Used for JIT compiled code. */ this.dynamics_ = new tr.e.importer.v8.SplayTree(); /** * Name generator for entries having duplicate names. */ this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator(); /** * Static code entries. Used for statically compiled code. */ this.statics_ = new tr.e.importer.v8.SplayTree(); /** * Libraries entries. Used for the whole static code libraries. */ this.libraries_ = new tr.e.importer.v8.SplayTree(); /** * Map of memory pages occupied with static code. */ this.pages_ = []; }
javascript
function CodeMap() { /** * Dynamic code entries. Used for JIT compiled code. */ this.dynamics_ = new tr.e.importer.v8.SplayTree(); /** * Name generator for entries having duplicate names. */ this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator(); /** * Static code entries. Used for statically compiled code. */ this.statics_ = new tr.e.importer.v8.SplayTree(); /** * Libraries entries. Used for the whole static code libraries. */ this.libraries_ = new tr.e.importer.v8.SplayTree(); /** * Map of memory pages occupied with static code. */ this.pages_ = []; }
[ "function", "CodeMap", "(", ")", "{", "/**\n * Dynamic code entries. Used for JIT compiled code.\n */", "this", ".", "dynamics_", "=", "new", "tr", ".", "e", ".", "importer", ".", "v8", ".", "SplayTree", "(", ")", ";", "/**\n * Name generator for entries having duplicate names.\n */", "this", ".", "dynamicsNameGen_", "=", "new", "tr", ".", "e", ".", "importer", ".", "v8", ".", "CodeMap", ".", "NameGenerator", "(", ")", ";", "/**\n * Static code entries. Used for statically compiled code.\n */", "this", ".", "statics_", "=", "new", "tr", ".", "e", ".", "importer", ".", "v8", ".", "SplayTree", "(", ")", ";", "/**\n * Libraries entries. Used for the whole static code libraries.\n */", "this", ".", "libraries_", "=", "new", "tr", ".", "e", ".", "importer", ".", "v8", ".", "SplayTree", "(", ")", ";", "/**\n * Map of memory pages occupied with static code.\n */", "this", ".", "pages_", "=", "[", "]", ";", "}" ]
Constructs a mapper that maps addresses into code entries. @constructor
[ "Constructs", "a", "mapper", "that", "maps", "addresses", "into", "code", "entries", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/v8/codemap.js#L20-L45
23,797
googlearchive/node-big-rig
lib/third_party/tracing/model/counter_sample.js
CounterSample
function CounterSample(series, timestamp, value) { tr.model.Event.call(this); this.series_ = series; this.timestamp_ = timestamp; this.value_ = value; }
javascript
function CounterSample(series, timestamp, value) { tr.model.Event.call(this); this.series_ = series; this.timestamp_ = timestamp; this.value_ = value; }
[ "function", "CounterSample", "(", "series", ",", "timestamp", ",", "value", ")", "{", "tr", ".", "model", ".", "Event", ".", "call", "(", "this", ")", ";", "this", ".", "series_", "=", "series", ";", "this", ".", "timestamp_", "=", "timestamp", ";", "this", ".", "value_", "=", "value", ";", "}" ]
The value of a given measurement at a given time. As an example, if we're measuring the throughput of data sent over a USB connection, each counter sample might represent the instantaneous throughput of the connection at a given time. @constructor @extends {Event}
[ "The", "value", "of", "a", "given", "measurement", "at", "a", "given", "time", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/counter_sample.js#L26-L31
23,798
googlearchive/node-big-rig
lib/third_party/tracing/base/sorted_array_utils.js
findIndexInSortedIntervals
function findIndexInSortedIntervals(ary, mapLoFn, mapWidthFn, loVal) { var first = findLowIndexInSortedArray(ary, mapLoFn, loVal); if (first == 0) { if (loVal >= mapLoFn(ary[0]) && loVal < mapLoFn(ary[0]) + mapWidthFn(ary[0], 0)) { return 0; } else { return -1; } } else if (first < ary.length) { if (loVal >= mapLoFn(ary[first]) && loVal < mapLoFn(ary[first]) + mapWidthFn(ary[first], first)) { return first; } else if (loVal >= mapLoFn(ary[first - 1]) && loVal < mapLoFn(ary[first - 1]) + mapWidthFn(ary[first - 1], first - 1)) { return first - 1; } else { return ary.length; } } else if (first == ary.length) { if (loVal >= mapLoFn(ary[first - 1]) && loVal < mapLoFn(ary[first - 1]) + mapWidthFn(ary[first - 1], first - 1)) { return first - 1; } else { return ary.length; } } else { return ary.length; } }
javascript
function findIndexInSortedIntervals(ary, mapLoFn, mapWidthFn, loVal) { var first = findLowIndexInSortedArray(ary, mapLoFn, loVal); if (first == 0) { if (loVal >= mapLoFn(ary[0]) && loVal < mapLoFn(ary[0]) + mapWidthFn(ary[0], 0)) { return 0; } else { return -1; } } else if (first < ary.length) { if (loVal >= mapLoFn(ary[first]) && loVal < mapLoFn(ary[first]) + mapWidthFn(ary[first], first)) { return first; } else if (loVal >= mapLoFn(ary[first - 1]) && loVal < mapLoFn(ary[first - 1]) + mapWidthFn(ary[first - 1], first - 1)) { return first - 1; } else { return ary.length; } } else if (first == ary.length) { if (loVal >= mapLoFn(ary[first - 1]) && loVal < mapLoFn(ary[first - 1]) + mapWidthFn(ary[first - 1], first - 1)) { return first - 1; } else { return ary.length; } } else { return ary.length; } }
[ "function", "findIndexInSortedIntervals", "(", "ary", ",", "mapLoFn", ",", "mapWidthFn", ",", "loVal", ")", "{", "var", "first", "=", "findLowIndexInSortedArray", "(", "ary", ",", "mapLoFn", ",", "loVal", ")", ";", "if", "(", "first", "==", "0", ")", "{", "if", "(", "loVal", ">=", "mapLoFn", "(", "ary", "[", "0", "]", ")", "&&", "loVal", "<", "mapLoFn", "(", "ary", "[", "0", "]", ")", "+", "mapWidthFn", "(", "ary", "[", "0", "]", ",", "0", ")", ")", "{", "return", "0", ";", "}", "else", "{", "return", "-", "1", ";", "}", "}", "else", "if", "(", "first", "<", "ary", ".", "length", ")", "{", "if", "(", "loVal", ">=", "mapLoFn", "(", "ary", "[", "first", "]", ")", "&&", "loVal", "<", "mapLoFn", "(", "ary", "[", "first", "]", ")", "+", "mapWidthFn", "(", "ary", "[", "first", "]", ",", "first", ")", ")", "{", "return", "first", ";", "}", "else", "if", "(", "loVal", ">=", "mapLoFn", "(", "ary", "[", "first", "-", "1", "]", ")", "&&", "loVal", "<", "mapLoFn", "(", "ary", "[", "first", "-", "1", "]", ")", "+", "mapWidthFn", "(", "ary", "[", "first", "-", "1", "]", ",", "first", "-", "1", ")", ")", "{", "return", "first", "-", "1", ";", "}", "else", "{", "return", "ary", ".", "length", ";", "}", "}", "else", "if", "(", "first", "==", "ary", ".", "length", ")", "{", "if", "(", "loVal", ">=", "mapLoFn", "(", "ary", "[", "first", "-", "1", "]", ")", "&&", "loVal", "<", "mapLoFn", "(", "ary", "[", "first", "-", "1", "]", ")", "+", "mapWidthFn", "(", "ary", "[", "first", "-", "1", "]", ",", "first", "-", "1", ")", ")", "{", "return", "first", "-", "1", ";", "}", "else", "{", "return", "ary", ".", "length", ";", "}", "}", "else", "{", "return", "ary", ".", "length", ";", "}", "}" ]
Finds an index in an array of intervals that either intersects the provided loVal, or if no intersection is found, -1 or ary.length. The array of intervals is defined implicitly via two mapping functions over the provided ary. mapLoFn determines the lower value of the interval, mapWidthFn the width. Intersection is lower-inclusive, e.g. [lo,lo+w). The array of intervals formed by this mapping must be non-overlapping and sorted in ascending order by loVal. @param {Array} ary An array of objects that can be converted into sorted nonoverlapping ranges [x,y) using the mapLoFn and mapWidth. @param {function():*} mapLoFn Callback that produces the low value for the interval represented by an element in the array. @param {function():*} mapWidthFn Callback that produces the width for the interval represented by an element in the array. @param {number} loVal The low value for the search. @return {Number} An index in the array that intersects or is first-above loVal, -1 if none found and loVal is below than all the intervals, ary.length if loVal is greater than all the intervals.
[ "Finds", "an", "index", "in", "an", "array", "of", "intervals", "that", "either", "intersects", "the", "provided", "loVal", "or", "if", "no", "intersection", "is", "found", "-", "1", "or", "ary", ".", "length", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L92-L123
23,799
googlearchive/node-big-rig
lib/third_party/tracing/base/sorted_array_utils.js
findIndexInSortedClosedIntervals
function findIndexInSortedClosedIntervals(ary, mapLoFn, mapHiFn, val) { var i = findLowIndexInSortedArray(ary, mapLoFn, val); if (i === 0) { if (val >= mapLoFn(ary[0], 0) && val <= mapHiFn(ary[0], 0)) { return 0; } else { return -1; } } else if (i < ary.length) { if (val >= mapLoFn(ary[i - 1], i - 1) && val <= mapHiFn(ary[i - 1], i - 1)) { return i - 1; } else if (val >= mapLoFn(ary[i], i) && val <= mapHiFn(ary[i], i)) { return i; } else { return ary.length; } } else if (i == ary.length) { if (val >= mapLoFn(ary[i - 1], i - 1) && val <= mapHiFn(ary[i - 1], i - 1)) { return i - 1; } else { return ary.length; } } else { return ary.length; } }
javascript
function findIndexInSortedClosedIntervals(ary, mapLoFn, mapHiFn, val) { var i = findLowIndexInSortedArray(ary, mapLoFn, val); if (i === 0) { if (val >= mapLoFn(ary[0], 0) && val <= mapHiFn(ary[0], 0)) { return 0; } else { return -1; } } else if (i < ary.length) { if (val >= mapLoFn(ary[i - 1], i - 1) && val <= mapHiFn(ary[i - 1], i - 1)) { return i - 1; } else if (val >= mapLoFn(ary[i], i) && val <= mapHiFn(ary[i], i)) { return i; } else { return ary.length; } } else if (i == ary.length) { if (val >= mapLoFn(ary[i - 1], i - 1) && val <= mapHiFn(ary[i - 1], i - 1)) { return i - 1; } else { return ary.length; } } else { return ary.length; } }
[ "function", "findIndexInSortedClosedIntervals", "(", "ary", ",", "mapLoFn", ",", "mapHiFn", ",", "val", ")", "{", "var", "i", "=", "findLowIndexInSortedArray", "(", "ary", ",", "mapLoFn", ",", "val", ")", ";", "if", "(", "i", "===", "0", ")", "{", "if", "(", "val", ">=", "mapLoFn", "(", "ary", "[", "0", "]", ",", "0", ")", "&&", "val", "<=", "mapHiFn", "(", "ary", "[", "0", "]", ",", "0", ")", ")", "{", "return", "0", ";", "}", "else", "{", "return", "-", "1", ";", "}", "}", "else", "if", "(", "i", "<", "ary", ".", "length", ")", "{", "if", "(", "val", ">=", "mapLoFn", "(", "ary", "[", "i", "-", "1", "]", ",", "i", "-", "1", ")", "&&", "val", "<=", "mapHiFn", "(", "ary", "[", "i", "-", "1", "]", ",", "i", "-", "1", ")", ")", "{", "return", "i", "-", "1", ";", "}", "else", "if", "(", "val", ">=", "mapLoFn", "(", "ary", "[", "i", "]", ",", "i", ")", "&&", "val", "<=", "mapHiFn", "(", "ary", "[", "i", "]", ",", "i", ")", ")", "{", "return", "i", ";", "}", "else", "{", "return", "ary", ".", "length", ";", "}", "}", "else", "if", "(", "i", "==", "ary", ".", "length", ")", "{", "if", "(", "val", ">=", "mapLoFn", "(", "ary", "[", "i", "-", "1", "]", ",", "i", "-", "1", ")", "&&", "val", "<=", "mapHiFn", "(", "ary", "[", "i", "-", "1", "]", ",", "i", "-", "1", ")", ")", "{", "return", "i", "-", "1", ";", "}", "else", "{", "return", "ary", ".", "length", ";", "}", "}", "else", "{", "return", "ary", ".", "length", ";", "}", "}" ]
Finds an index in an array of sorted closed intervals that either intersects the provided val, or if no intersection is found, -1 or ary.length. The array of intervals is defined implicitly via two mapping functions over the provided ary. mapLoFn determines the lower value of the interval, mapHiFn the high. Intersection is closed, e.g. [lo,hi], unlike with findIndexInSortedIntervals, which is right-open. The array of intervals formed by this mapping must be non-overlapping, and sorted in ascending order by val. @param {Array} ary An array of objects that can be converted into sorted nonoverlapping ranges [x,y) using the mapLoFn and mapWidth. @param {function():*} mapLoFn Callback that produces the low value for the interval represented by an element in the array. @param {function():*} mapHiFn Callback that produces the high for the interval represented by an element in the array. @param {number} val The value for the search. @return {Number} An index in the array that intersects or is first-above val, -1 if none found and val is below than all the intervals, ary.length if val is greater than all the intervals.
[ "Finds", "an", "index", "in", "an", "array", "of", "sorted", "closed", "intervals", "that", "either", "intersects", "the", "provided", "val", "or", "if", "no", "intersection", "is", "found", "-", "1", "or", "ary", ".", "length", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L149-L178