本文整理汇总了C++中Slave::processData方法的典型用法代码示例。如果您正苦于以下问题:C++ Slave::processData方法的具体用法?C++ Slave::processData怎么用?C++ Slave::processData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slave
的用法示例。
在下文中一共展示了Slave::processData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SPEHandler
//.........这里部分代码省略.........
output.m_iBufSize = (size < 64000000) ? 64000000 : size;
output.m_pcResult = new char[output.m_iBufSize];
output.m_iIndSize = (totalrows < 640000) ? 640000 : totalrows + 2;
output.m_pllIndex = new int64_t[output.m_iIndSize];
output.m_piBucketID = new int[output.m_iIndSize];
SFile file;
file.m_strHomeDir = self->m_strHomeDir;
char path[64];
sprintf(path, "%d", key);
file.m_strLibDir = self->m_strHomeDir + ".sphere/" + path + "/";
file.m_strTempDir = self->m_strHomeDir + ".tmp/";
file.m_iSlaveID = self->m_iSlaveID;
file.m_pInMemoryObjects = &self->m_InMemoryObjects;
result.clear();
gettimeofday(&t3, 0);
int deliverystatus = 0;
int processstatus = 0;
// process data segments
for (int i = 0; i < totalrows; i += unitrows)
{
if (unitrows > totalrows - i)
unitrows = totalrows - i;
input.m_pcUnit = block + index[i] - index[0];
input.m_iRows = unitrows;
input.m_pllIndex = index + i;
output.m_iResSize = 0;
output.m_iRows = 0;
output.m_strError = "";
processstatus = self->processData(input, output, file, result, buckets, process, map, partition);
if (processstatus < 0)
{
progress = SectorError::E_SPEPROC;
break;
}
timeval t;
gettimeofday(&t, NULL);
unsigned int seed = t.tv_sec * 1000000 + t.tv_usec;
srand(seed);
int ds_thresh = 32000000 * ((rand() % 7) + 1);
if ((result.m_llTotalDataSize >= ds_thresh) && (buckets != 0))
deliverystatus = self->deliverResult(buckets, result, dest);
if (deliverystatus < 0)
{
progress = SectorError::E_SPEWRITE;
break;
}
gettimeofday(&t4, 0);
if (t4.tv_sec - t3.tv_sec > 1)
{
progress = i * 100 / totalrows;
msg.setData(4, (char*)&progress, 4);
msg.m_iDataLength = SectorMsg::m_iHdrSize + 8;
int id = 0;
self->m_GMP.sendto(ip.c_str(), ctrlport, id, &msg);
t3 = t4;
}
}