_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q53100 | train | function () {
var self = this,
options = this.options,
csv = options.csv,
columns = this.columns,
startRow = options.startRow || 0,
endRow = options.endRow || Number.MAX_VALUE,
startColumn = options.startColumn || 0,
endColumn = options.endColumn || Number.MAX_VALUE,
lines,
activeRowNo = 0;... | javascript | {
"resource": ""
} | |
q53101 | train | function () {
var options = this.options,
table = options.table,
columns = this.columns,
startRow = options.startRow || 0,
endRow = options.endRow || Number.MAX_VALUE,
startColumn = options.startColumn || 0,
endColumn = options.endColumn || Number.MAX_VALUE,
colNo;
if (table) {
if (t... | javascript | {
"resource": ""
} | |
q53102 | train | function (rows) {
var row,
rowsLength,
col,
colsLength,
columns;
if (rows) {
columns = [];
rowsLength = rows.length;
for (row = 0; row < rowsLength; row++) {
colsLength = rows[row].length;
for (col = 0; col < colsLength; col++) {
if (!columns[col]) {
columns[col] = [];
... | javascript | {
"resource": ""
} | |
q53103 | closeness | train | function closeness(graph, oriented) {
var Q = [];
// list of predecessors on shortest paths from source
// distance from source
var dist = Object.create(null);
var currentNode;
var centrality = Object.create(null);
graph.forEachNode(setCentralityToZero);
graph.forEachNode(calculateCentrality... | javascript | {
"resource": ""
} |
q53104 | eccentricity | train | function eccentricity(graph, oriented) {
var Q = [];
// distance from source
var dist = Object.create(null);
var currentNode;
var centrality = Object.create(null);
graph.forEachNode(setCentralityToZero);
graph.forEachNode(calculateCentrality);
return centrality;
function setCentrality... | javascript | {
"resource": ""
} |
q53105 | initPerfMonitor | train | function initPerfMonitor(options) {
if (!initialized) {
if (options.container) {
container = options.container;
}
initialized = true;
}
} | javascript | {
"resource": ""
} |
q53106 | checkInit | train | function checkInit() {
if (!container) {
container = document.createElement("div");
container.style.cssText = "position: fixed;" + "opacity: 0.9;" + "right: 0;" + "bottom: 0";
document.body.appendChild(container);
}
initialized = true;
} | javascript | {
"resource": ""
} |
q53107 | scheduleTask | train | function scheduleTask(task) {
frameTasks.push(task);
if (rafId === -1) {
requestAnimationFrame(function (t) {
rafId = -1;
var tasks = frameTasks;
frameTasks = [];
for (var i = 0; i < tasks.length; i++) {
task... | javascript | {
"resource": ""
} |
q53108 | startFPSMonitor | train | function startFPSMonitor() {
checkInit();
var data = new Data();
var w = new MonitorWidget("FPS", "", 2 /* HideMax */ | 1 /* HideMin */ | 4 /* HideMean */ | 32 /* RoundValues */);
container.appendChild(w.element);
var samples = [];
var last = 0;
function update(no... | javascript | {
"resource": ""
} |
q53109 | startMemMonitor | train | function startMemMonitor() {
checkInit();
if (performance.memory !== void 0) {
(function () {
var update = function update() {
data.addSample(Math.round(mem.usedJSHeapSize / (1024 * 1024)));
w.addResult(data.calc());
... | javascript | {
"resource": ""
} |
q53110 | initProfiler | train | function initProfiler(name) {
checkInit();
var profiler = profilerInstances[name];
if (profiler === void 0) {
profilerInstances[name] = profiler = new Profiler(name, "ms");
container.appendChild(profiler.widget.element);
}
} | javascript | {
"resource": ""
} |
q53111 | train | function (evt) {
var threshold = 30;
if (!this.pressed) {
this.pressed = true;
this.emit('touchdown');
var self = this;
this.interval = setInterval(function() {
var delta = performance.now() - self.lastTime;
if (delta > threshold) {
self.pressed = false;
... | javascript | {
"resource": ""
} | |
q53112 | readDir | train | function readDir (dir, regex = /^(?:)$/) {
return new Promise((resolve, reject) =>
fs.readdir(dir, (err, files) => err
? reject(err)
: resolve(Promise.all(files.map(checkFileName.bind(null, dir, regex))))))
.then(values =>
[].concat(...values)
.filter(i => i))
} | javascript | {
"resource": ""
} |
q53113 | check | train | function check(filename) {
this.filename = filename && path.resolve(filename) || '';
this.types = [];
this.valid = null;
} | javascript | {
"resource": ""
} |
q53114 | handler | train | function handler(req, res) {
var parsedUrl = url.parse(req.url)
var callback = qs.parse(parsedUrl.query).callback
var filename = decodeURI(parsedUrl.path.substr(1).split('?')[0])
var basename = path.basename(filename.split('?')[0])
var extname = path.extname(basename)
var response = reswrap(res);
var not... | javascript | {
"resource": ""
} |
q53115 | compileFile | train | function compileFile(module, filename) {
const templateString = fs.readFileSync(filename, 'utf8');
module.exports = handlebars.compile(templateString);
} | javascript | {
"resource": ""
} |
q53116 | cal_arrayPush | train | function cal_arrayPush(n) {
function toFib(x, y, z) {
x.push((z < 2) ? z : x[z - 1] + x[z - 2])
return x
}
var arr = Array.apply(null, new Array(n)).reduce(toFib, [])
var len = arr.length
return arr[len - 1] + arr[len - 2]
} | javascript | {
"resource": ""
} |
q53117 | convert | train | function convert(trace, opts) {
opts = opts || {}
this._map = opts.map
this._opts = xtend({ v8gc: true }, opts, { map: this._map ? 'was supplied' : 'was not supplied' })
this.emit('info', 'Options: %j', this._opts)
this._trace = trace
this._traceLen = trace.length
if (!this._traceLen) {
this.emit('... | javascript | {
"resource": ""
} |
q53118 | LocalTransport | train | function LocalTransport(config) {
this.id = config && config.id || null;
this.networkId = this.id || null;
this['default'] = config && config['default'] || false;
this.agents = {};
} | javascript | {
"resource": ""
} |
q53119 | PubNubConnection | train | function PubNubConnection(transport, id, receive) {
this.id = id;
this.transport = transport;
// ready state
var me = this;
this.ready = new Promise(function (resolve, reject) {
transport.pubnub.subscribe({
channel: id,
message: function (message) {
receive(message.from, message.messa... | javascript | {
"resource": ""
} |
q53120 | PubNubTransport | train | function PubNubTransport(config) {
this.id = config.id || null;
this.networkId = config.publish_key || null;
this['default'] = config['default'] || false;
this.pubnub = PUBNUB().init(config);
} | javascript | {
"resource": ""
} |
q53121 | DistribusTransport | train | function DistribusTransport(config) {
this.id = config && config.id || null;
this['default'] = config && config['default'] || false;
this.host = config && config.host || new distribus.Host(config);
this.networkId = this.host.networkId; // FIXME: networkId can change when host connects to another host.
} | javascript | {
"resource": ""
} |
q53122 | PatternModule | train | function PatternModule(agent, options) {
this.agent = agent;
this.stopPropagation = options && options.stopPropagation || false;
this.receiveOriginal = agent._receive;
this.listeners = [];
} | javascript | {
"resource": ""
} |
q53123 | _getModuleConstructor | train | function _getModuleConstructor(name) {
var constructor = Agent.modules[name];
if (!constructor) {
throw new Error('Unknown module "' + name + '". ' +
'Choose from: ' + Object.keys(Agent.modules).map(JSON.stringify).join(', '));
}
return constructor;
} | javascript | {
"resource": ""
} |
q53124 | Transport | train | function Transport(config) {
this.id = config && config.id || null;
this['default'] = config && config['default'] || false;
} | javascript | {
"resource": ""
} |
q53125 | RequestModule | train | function RequestModule(agent, options) {
this.agent = agent;
this.receiveOriginal = agent._receive;
this.timeout = options && options.timeout || TIMEOUT;
this.queue = [];
} | javascript | {
"resource": ""
} |
q53126 | WebSocketConnection | train | function WebSocketConnection(transport, url, receive) {
this.transport = transport;
this.url = url ? util.normalizeURL(url) : uuid();
this.receive = receive;
this.sockets = {};
this.closed = false;
this.reconnectTimers = {};
// ready state
this.ready = Promise.resolve(this);
} | javascript | {
"resource": ""
} |
q53127 | BabbleModule | train | function BabbleModule(agent, options) {
// create a new babbler
var babbler = babble.babbler(agent.id);
babbler.connect({
connect: function (params) {},
disconnect: function(token) {},
send: function (to, message) {
agent.send(to, message);
}
});
this.babbler = babbler;
// create a re... | javascript | {
"resource": ""
} |
q53128 | WebSocketTransport | train | function WebSocketTransport(config) {
this.id = config && config.id || null;
this.networkId = this.id || null;
this['default'] = config && config['default'] || false;
this.localShortcut = (config && config.localShortcut === false) ? false : true;
this.reconnectDelay = config && config.reconnectDelay || 10000;... | javascript | {
"resource": ""
} |
q53129 | PlanningAgent | train | function PlanningAgent(id) {
// execute super constructor
eve.Agent.call(this, id);
// connect to all transports configured by the system
this.connect(eve.system.transports.getAll());
} | javascript | {
"resource": ""
} |
q53130 | AMQPTransport | train | function AMQPTransport(config) {
this.id = config.id || null;
this.url = config.url || (config.host && "amqp://" + config.host) || null;
this['default'] = config['default'] || false;
this.networkId = this.url;
this.connection = null;
this.config = config;
} | javascript | {
"resource": ""
} |
q53131 | train | function(name, data){
var self = this;
var eventCalls = function eventCalls(name, data){
if(events[name] instanceof Array){
events[name].forEach(function(event){
event.call(self, data);
});
... | javascript | {
"resource": ""
} | |
q53132 | train | function(){
var type = data.type || (data.into ? 'html' : 'json');
var url = _buildQuery();
//delegates to ajaGo
if(typeof ajaGo[type] === 'function'){
return ajaGo[type].call(this, url);
}
} | javascript | {
"resource": ""
} | |
q53133 | train | function(url){
var self = this;
ajaGo._xhr.call(this, url, function processRes(res){
if(res){
try {
res = JSON.parse(res);
} catch(e){
self.trigger('error', e);
... | javascript | {
"resource": ""
} | |
q53134 | train | function(url){
ajaGo._xhr.call(this, url, function processRes(res){
if(data.into && data.into.length){
[].forEach.call(data.into, function(elt){
elt.innerHTML = res;
});
}
... | javascript | {
"resource": ""
} | |
q53135 | train | function(url, processRes){
var self = this;
//iterators
var key, header;
var method = data.method || 'get';
var async = data.sync !== true;
var request = new XMLHttpRequest();
var _data ... | javascript | {
"resource": ""
} | |
q53136 | train | function(url){
var self = this;
var head = document.querySelector('head') || document.querySelector('body');
var async = data.sync !== true;
var script;
if(!head){
throw new Error('Ok, wait a second, you want t... | javascript | {
"resource": ""
} | |
q53137 | _buildQuery | train | function _buildQuery(){
var url = data.url;
var cache = typeof data.cache !== 'undefined' ? !!data.cache : true;
var queryString = data.queryString || '';
var _data = data.data;
//add a cache buster
if(cache === false){
... | javascript | {
"resource": ""
} |
q53138 | train | function(params){
var object = {};
if(typeof params === 'string'){
params.replace('?', '').split('&').forEach(function(kv){
var pair = kv.split('=');
if(pair.length === 2){
object[decodeURIComponent(pair[0])] = deco... | javascript | {
"resource": ""
} | |
q53139 | train | function(functionName){
functionName = this.string(functionName);
if(!/^([a-zA-Z_])([a-zA-Z0-9_\-])+$/.test(functionName)){
throw new TypeError('a valid function name is expected, ' + functionName + ' [' + (typeof functionName) + '] given');
}
return funct... | javascript | {
"resource": ""
} | |
q53140 | train | function(req, res, next) {
if (/aja\.js$/.test(req.url)) {
return res.end(grunt.file.read(coverageDir + '/instrument/src/aja.js'));
}
return next();
} | javascript | {
"resource": ""
} | |
q53141 | get | train | function get (url, callback) {
// https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_get_options_callback
http.get(url, (result) => {
const contentType = result.headers['content-type']
const statusCode = result.statusCode
let error
if (statusCode !== 200) {
error = new Error(`U... | javascript | {
"resource": ""
} |
q53142 | difference | train | function difference(a, b) {
var oldHashes = {};
var errors = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = b.errors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorN... | javascript | {
"resource": ""
} |
q53143 | train | function(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset) {
this.initialize(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset);
} | javascript | {
"resource": ""
} | |
q53144 | resolveClient | train | function resolveClient(c,arg)
{
if(typeof c.y === "function")
{
try {
var yret = c.y.call(_undefined,arg);
c.p.resolve(yret);
}
catch(err) { c.p.reject(err) }
}
else
c.p.resolve(arg); // pass this along...
} | javascript | {
"resource": ""
} |
q53145 | rp | train | function rp(p,i)
{
if(!p || typeof p.then !== "function")
p = Zousan.resolve(p);
p.then(
function(yv) { results[i] = yv; rc++; if(rc == pa.length) retP.resolve(results); },
function(nv) { retP.reject(nv); }
);
} | javascript | {
"resource": ""
} |
q53146 | train | function(workingDir, elmPackage){
elmPackage['native-modules'] = true;
var sources = elmPackage['source-directories'].map(function(dir){
return path.join(workingDir, dir);
});
sources.push('.');
elmPackage['source-directories'] = sources;
elmPackage['dependencies']["eeue56/elm-html-in-e... | javascript | {
"resource": ""
} | |
q53147 | has | train | function has(obj, val) {
val = arrayify(val);
var len = val.length;
if (isObject(obj)) {
for (var key in obj) {
if (val.indexOf(key) > -1) {
return true;
}
}
var keys = nativeKeys(obj);
return has(keys, val);
}
if (Array.isArray(obj)) {
var arr = obj;
while (len-... | javascript | {
"resource": ""
} |
q53148 | setupTempDir | train | function setupTempDir(tmpDir) {
var rpmStructure = ['BUILD', 'BUILDROOT', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS'];
// If the tmpDir exists (probably from previous build), delete it first
if (fsx.existsSync(tmpDir)) {
logger(chalk.cyan('Removing old temporary directory.'));
fsx.removeSync(tmpDir);
}
// ... | javascript | {
"resource": ""
} |
q53149 | buildRpm | train | function buildRpm(buildRoot, specFile, rpmDest, execOpts, cb) {
// Build the RPM package.
var cmd = [
'rpmbuild',
'-bb',
'-vv',
'--buildroot',
buildRoot,
specFile
].join(' ');
logger(chalk.cyan('Executing:'), cmd);
execOpts = execOpts || {};
exec(cmd, execOpts, function rpmbuild(e... | javascript | {
"resource": ""
} |
q53150 | parseIgnoreFile | train | function parseIgnoreFile(ignoreFile) {
// At first we'll try to determine line endings for ignore file.
// For this we will count \n and \r\n occurrences and choose the one
// which dominates. If we don't have line endings at all we will keep
// default OS line endings.
var lfCount = countOccurrence... | javascript | {
"resource": ""
} |
q53151 | getCleanTargets | train | function getCleanTargets() {
var directDeps = targets.map(function (pattern) {
return '*/' + pattern;
}),
indirectDeps = targets.map(function (pattern) {
return '**/node_modules/*/' + pattern;
});
return directDeps.concat(indirectDeps);
} | javascript | {
"resource": ""
} |
q53152 | logFatal | train | function logFatal(message) {
console.log(os.EOL + chalk.red.bold('Fatal error : ' + message));
process.exit(1);
} | javascript | {
"resource": ""
} |
q53153 | logDebug | train | function logDebug(message) {
if (!debug) {
return;
}
if (!enabled) return;
console.log(os.EOL + chalk.cyan(message));
} | javascript | {
"resource": ""
} |
q53154 | countTrailingZeros | train | function countTrailingZeros(v) {
var c = 32;
v &= -v;
if (v) c--;
if (v & 0x0000FFFF) c -= 16;
if (v & 0x00FF00FF) c -= 8;
if (v & 0x0F0F0F0F) c -= 4;
if (v & 0x33333333) c -= 2;
if (v & 0x55555555) c -= 1;
return c;
} | javascript | {
"resource": ""
} |
q53155 | generate | train | function generate(options) {
options = options || {};
if (typeof options === 'string') options = { type: options };
var type = paramDefault(options.type, 'base64');
var additional = paramDefault(options.additional, 0);
var count = paramDefault(options.countNumber, parseInt(Math.ra... | javascript | {
"resource": ""
} |
q53156 | Message | train | function Message(messageId) {
if (util.isNullOrUndefined(messageId) || "string" !== typeof(messageId)) {
throw new IllegalArgumentException();
}
/**
* This parameter uniquely identifies a message in an XMPP connection.
*/
this.mMessageId = messageId;
this.mCollapseKey =... | javascript | {
"resource": ""
} |
q53157 | getTagLength | train | function getTagLength(tag) {
var lenTag = 4;
while(lenTag > 1) {
var tmpTag = tag >>> ((lenTag - 1) * 8);
if ((tmpTag & 0xFF) != 0x00) {
break;
}
lenTag--;
}
return lenTag;
} | javascript | {
"resource": ""
} |
q53158 | getValueLength | train | function getValueLength(value, constructed) {
var lenValue = 0;
if (constructed) {
for (var i = 0; i < value.length; i++) {
lenValue = lenValue + value[i].byteLength;
}
} else {
lenValue = value.length;
}
return lenValue;
} | javascript | {
"resource": ""
} |
q53159 | getLengthOfLength | train | function getLengthOfLength(lenValue, indefiniteLength) {
var lenOfLen;
if (indefiniteLength) {
lenOfLen = 3;
} else if (lenValue > 0x00FFFFFF) {
lenOfLen = 5;
} else if (lenValue > 0x0000FFFF) {
lenOfLen = 4;
} else if (lenValue > 0x000000FF) {
lenOfLen = 3;
} else if (lenValue > 0x000000... | javascript | {
"resource": ""
} |
q53160 | encodeNumber | train | function encodeNumber(buf, value, len) {
var index = 0;
while (len > 0) {
var tmpValue = value >>> ((len - 1) * 8);
buf[index++] = tmpValue & 0xFF;
len--;
}
} | javascript | {
"resource": ""
} |
q53161 | parseTag | train | function parseTag(buf) {
var index = 0;
var tag = buf[index++];
var constructed = (tag & 0x20) == 0x20;
if ((tag & 0x1F) == 0x1F) {
do {
tag = tag << 8;
tag = tag | buf[index++];
} while((tag & 0x80) == 0x80);
if (index > 4) {
throw new RangeError("The length of the tag c... | javascript | {
"resource": ""
} |
q53162 | parseAllTags | train | function parseAllTags(buf) {
var result = [];
var element;
while (buf.length > 0) {
element = parseTag(buf);
buf = buf.slice(element.length);
result.push(element.tag);
}
return result;
} | javascript | {
"resource": ""
} |
q53163 | encodeTags | train | function encodeTags(tags) {
var bufLength = 0;
var tagLengths = []
for (var i = 0; i < tags.length; i++) {
var tagLength = getTagLength(tags[i]);
tagLengths.push(tagLength);
bufLength += tagLength;
}
var buf = new Buffer(bufLength);
var slicedBuf = buf;
for (var i = 0; i < tags.length... | javascript | {
"resource": ""
} |
q53164 | Notification | train | function Notification(icon) {
if (util.isNullOrUndefined(icon)) {
throw new IllegalArgumentException();
}
this.mTitle = null;
this.mBody = null;
this.mIcon = icon;
this.mSound = "default"; // the only currently supported value
this.mBadge = null;
this.mTag = null;
... | javascript | {
"resource": ""
} |
q53165 | run | train | function run (answers) {
ls(['LICENSE', 'package.json', 'README.md', 'index.js', 'index.html', 'examples/basic/index.html', 'tests/index.test.js']).forEach(function (file) {
answers.aframeVersion = aframeVersion;
answers.npmName = `aframe-${answers.shortName}-component`;
fs.writeFileSync(file, nun... | javascript | {
"resource": ""
} |
q53166 | loadFileData | train | function loadFileData(fileName) {
var testConfig = this.testConfig;
if (!testConfig) {
throw new Error('No test configuration found.\n' +
'You can add one by adding a property called `testConfig` to the word object.');
}
var testDataRoot = testConfig.testDataRoot;
if (!testDataRo... | javascript | {
"resource": ""
} |
q53167 | TimeStamp | train | function TimeStamp(timestamp) {
tr.b.u.Scalar.call(this, timestamp, tr.b.u.Units.timeStampInMs);
} | javascript | {
"resource": ""
} |
q53168 | train | function(slice, flowEvents) {
var fromOtherInputs = false;
slice.iterateEntireHierarchy(function(subsequentSlice) {
if (fromOtherInputs)
return;
subsequentSlice.inFlowEvents.forEach(function(inflow) {
if (fromOtherInputs)
return;
if (inflow.catego... | javascript | {
"resource": ""
} | |
q53169 | train | function(event, flowEvents) {
if (event.outFlowEvents === undefined ||
event.outFlowEvents.length === 0)
return false;
// Once we fix the bug of flow event binding, there should exist one and
// only one outgoing flow (PostTask) from ScheduleBeginImplFrameDeadline
// and PostC... | javascript | {
"resource": ""
} | |
q53170 | train | function(event, queue, visited, flowEvents) {
var stopFollowing = false;
var inputAck = false;
event.iterateAllSubsequentSlices(function(slice) {
if (stopFollowing)
return;
// Do not follow TaskQueueManager::RunTask because it causes
// many false events to be inclu... | javascript | {
"resource": ""
} | |
q53171 | train | function(event, queue, visited) {
event.outFlowEvents.forEach(function(outflow) {
if ((outflow.category === POSTTASK_FLOW_EVENT ||
outflow.category === IPC_FLOW_EVENT) &&
outflow.endSlice) {
this.associatedEvents_.push(outflow);
var nextEvent = outflow.endSlice... | javascript | {
"resource": ""
} | |
q53172 | SchedParser | train | function SchedParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('sched_switch',
SchedParser.prototype.schedSwitchEvent.bind(this));
importer.registerEventHandler('sched_wakeup',
SchedParser.prototype.schedWakeupEvent.bind(this));
importer.registerEventHandler... | javascript | {
"resource": ""
} |
q53173 | train | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = schedSwitchRE.exec(eventBase.details);
if (!event)
return false;
var prevState = event[4];
var nextComm = event[5];
var nextPid = parseInt(event[6]);
var nextPrio = parseInt(event[7]);
var nextThread = t... | javascript | {
"resource": ""
} | |
q53174 | train | function(array, opt_keyFunc, opt_this) {
if (this.isEmpty_)
return [];
// Binary search. |test| is a function that should return true when we
// need to explore the left branch and false to explore the right branch.
function binSearch(test) {
var i0 = 0;
var i1 = array.le... | javascript | {
"resource": ""
} | |
q53175 | binSearch | train | function binSearch(test) {
var i0 = 0;
var i1 = array.length;
while (i0 < i1 - 1) {
var i = Math.trunc((i0 + i1) / 2);
if (test(i))
i1 = i; // Explore the left branch.
else
i0 = i; // Explore the right branch.
}
return i1;
... | javascript | {
"resource": ""
} |
q53176 | DrmParser | train | function DrmParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('drm_vblank_event',
DrmParser.prototype.vblankEvent.bind(this));
} | javascript | {
"resource": ""
} |
q53177 | train | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /crtc=(\d+), seq=(\d+)/.exec(eventBase.details);
if (!event)
return false;
var crtc = parseInt(event[1]);
var seq = parseInt(event[2]);
this.drmVblankSlice(ts, 'vblank:' + crtc,
{
crtc: crtc,
... | javascript | {
"resource": ""
} | |
q53178 | CpufreqParser | train | function CpufreqParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('cpufreq_interactive_up',
CpufreqParser.prototype.cpufreqUpDownEvent.bind(this));
importer.registerEventHandler('cpufreq_interactive_down',
CpufreqParser.prototype.cpufreqUpDownEvent.bind(this));
... | javascript | {
"resource": ""
} |
q53179 | train | function(eventName, cpuNumber, pid, ts, eventBase) {
var data = splitData(eventBase.details);
this.cpufreqSlice(ts, eventName, data.cpu, data);
return true;
} | javascript | {
"resource": ""
} | |
q53180 | PowerParser | train | function PowerParser(importer) {
Parser.call(this, importer);
// NB: old-style power events, deprecated
importer.registerEventHandler('power_start',
PowerParser.prototype.powerStartEvent.bind(this));
importer.registerEventHandler('power_frequency',
PowerParser.prototype.powerFrequencyEv... | javascript | {
"resource": ""
} |
q53181 | train | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /type=(\d+) state=(\d) cpu_id=(\d+)/.exec(eventBase.details);
if (!event)
return false;
var targetCpuNumber = parseInt(event[3]);
var cpuState = parseInt(event[2]);
this.cpuStateSlice(ts, targetCpuNumber, event[1], c... | javascript | {
"resource": ""
} | |
q53182 | DiskParser | train | function DiskParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('f2fs_write_begin',
DiskParser.prototype.f2fsWriteBeginEvent.bind(this));
importer.registerEventHandler('f2fs_write_end',
DiskParser.prototype.f2fsWriteEndEvent.bind(this));
importer.registerEvent... | javascript | {
"resource": ""
} |
q53183 | train | function(datum) {
var startPosition = this.beginPositionCb_(datum);
var endPosition = this.endPositionCb_(datum);
var node = new IntervalTreeNode(datum,
startPosition, endPosition);
this.size_++;
this.root_ = this.insertNode_(this.root_, node);
... | javascript | {
"resource": ""
} | |
q53184 | train | function(queryLow, queryHigh) {
this.validateFindArguments_(queryLow, queryHigh);
if (this.root_ === undefined)
return [];
var ret = [];
this.root_.appendIntersectionsInto_(ret, queryLow, queryHigh);
return ret;
} | javascript | {
"resource": ""
} | |
q53185 | train | function() {
this.classList.add('overlay');
this.parentEl_ = this.ownerDocument.body;
this.visible_ = false;
this.userCanClose_ = true;
this.onKeyDown_ = this.onKeyDown_.bind(this);
this.onClick_ = this.onClick_.bind(this);
this.onFocusIn_ = this.onFocusIn_.bind(this);
... | javascript | {
"resource": ""
} | |
q53186 | userFriendlyRailTypeName | train | function userFriendlyRailTypeName(railTypeName) {
if (railTypeName.length < 6 || railTypeName.indexOf('rail_') != 0)
return railTypeName;
return railTypeName[5].toUpperCase() + railTypeName.slice(6);
} | javascript | {
"resource": ""
} |
q53187 | railCompare | train | function railCompare(name1, name2) {
var i1 = RAIL_ORDER.indexOf(name1.toUpperCase());
var i2 = RAIL_ORDER.indexOf(name2.toUpperCase());
if (i1 == -1 && i2 == -1)
return name1.localeCompare(name2);
if (i1 == -1)
return 1; // i2 is a RAIL name but not i1.
if (i2 == -1)
return -1; ... | javascript | {
"resource": ""
} |
q53188 | WorkqueueParser | train | function WorkqueueParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('workqueue_execute_start',
WorkqueueParser.prototype.executeStartEvent.bind(this));
importer.registerEventHandler('workqueue_execute_end',
WorkqueueParser.prototype.executeEndEvent.bind(this));
... | javascript | {
"resource": ""
} |
q53189 | train | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = workqueueExecuteStartRE.exec(eventBase.details);
if (!event)
return false;
var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName,
pid, pid);
kthread.openSliceTS = ts;
kthread.openSlice = ... | javascript | {
"resource": ""
} | |
q53190 | LinuxPerfImporter | train | function LinuxPerfImporter(model, events) {
this.importPriority = 2;
this.model_ = model;
this.events_ = events;
this.newlyAddedClockSyncRecords_ = [];
this.wakeups_ = [];
this.blocked_reasons_ = [];
this.kernelThreadStates_ = {};
this.buildMapFromLinuxPidsToThreads();
this.lines_ = ... | javascript | {
"resource": ""
} |
q53191 | train | function() {
this.threadsByLinuxPid = {};
this.model_.getAllThreads().forEach(
function(thread) {
this.threadsByLinuxPid[thread.tid] = thread;
}.bind(this));
} | javascript | {
"resource": ""
} | |
q53192 | train | function(isSecondaryImport) {
this.parsers_ = this.createParsers_();
this.registerDefaultHandlers_();
this.parseLines();
this.importClockSyncRecords();
var timeShift = this.computeTimeTransform();
if (timeShift === undefined) {
this.model_.importWarning({
type: 'clo... | javascript | {
"resource": ""
} | |
q53193 | train | function(state) {
if (wakeup !== undefined) {
midDuration = wakeup.ts - prevSlice.end;
}
if (blocked_reason !== undefined) {
var args = {
'kernel callsite when blocked:' : blocked_reason.caller
};
if (blocked_re... | javascript | {
"resource": ""
} | |
q53194 | train | function() {
var isSecondaryImport = this.model.getClockSyncRecordsNamed(
'ftrace_importer').length !== 0;
var mSyncs = this.model_.getClockSyncRecordsNamed('monotonic');
// If this is a secondary import, and no clock syncing records were
// found, then abort the import. Otherwise, ju... | javascript | {
"resource": ""
} | |
q53195 | train | function(ts, pid, comm, prio, fromPid) {
// The the pids that get passed in to this function are Linux kernel
// pids, which identify threads. The rest of trace-viewer refers to
// these as tids, so the change of nomenclature happens in the following
// construction of the wakeup object.
... | javascript | {
"resource": ""
} | |
q53196 | train | function(ts, pid, iowait, caller) {
// The the pids that get passed in to this function are Linux kernel
// pids, which identify threads. The rest of trace-viewer refers to
// these as tids, so the change of nomenclature happens in the following
// construction of the wakeup object.
this.... | javascript | {
"resource": ""
} | |
q53197 | train | function(eventName, cpuNumber, pid, ts, eventBase) {
// Check for new-style clock sync records.
var event = /name=(\w+?)\s(.+)/.exec(eventBase.details);
if (event) {
var name = event[1];
var pieces = event[2].split(' ');
var args = {
perfTS: ts
};
for ... | javascript | {
"resource": ""
} | |
q53198 | train | function(eventName, cpuNumber, pid, ts, eventBase,
threadName) {
// Some profiles end up with a \n\ on the end of each line. Strip it
// before we do the comparisons.
eventBase.details = eventBase.details.replace(/\\n.*$/, '');
var event = /^\s*(\w+):\s*(.*... | javascript | {
"resource": ""
} | |
q53199 | train | function() {
this.forEachLine(function(text, eventBase, cpuNumber, pid, ts) {
var eventName = eventBase.eventName;
if (eventName !== 'tracing_mark_write' && eventName !== '0')
return;
if (traceEventClockSyncRE.exec(eventBase.details))
this.traceClockSyncEvent(eventName,... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.