function gmailProfile(opt) {
var profile = [];
// create cycle counter
var cycleCounter = [];
cycleCounter.push({
"name": 'Cycle number: ' + opt.cycle,
"functionName": 'currCycle',
"options": {}
});
// create count loop
var countThreads = [];
for(var i = 0; i < opt.chunk; i++) {
var counter = i + (opt.chunk * opt.cycle);
countThreads.push({
"name": 'Gmail count: ' + counter,
"functionName":'getAllEmails',
"options": {
"query": 'label: ' + opt.query,
"start": counter * opt.max,
"max": opt.max
}
});
}
// next reduce the test data to one
var threadsReduction = [];
threadsReduction.push({
"name": 'Reduction: ',
"functionName":'reduceTheResults',
"options": {}
});
// finally log the results
var profileLog = [];
profileLog.push({
"name": 'Logging: ',
"functionName": 'logTheResults',
"skip": false,
"options": {
"cycle": opt.cycle,
"sum": opt.sum,
"starttime": opt.starttime,
"driver": 'cDriverSheet',
"clear": false,
"parameters": {
"siloid": 'Sheet1',
"dbid": '1KfIbrosGeeXzUTWjyjny2HUhTEMz4fDHmxfMbP-_FlE',
"peanut": 'jacobjan'
}
}
});
// put it all together
profile.push(
cycleCounter,
countThreads,
threadsReduction,
profileLog
);
return profile;
}