本文整理汇总了C++中TimeSpan::AddTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSpan::AddTarget方法的具体用法?C++ TimeSpan::AddTarget怎么用?C++ TimeSpan::AddTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSpan
的用法示例。
在下文中一共展示了TimeSpan::AddTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ReadParametersFromCmdLine
//.........这里部分代码省略.........
if (!SetEvent(hEvent))
{
fprintf(stderr, "Error setting event '%s'\n", arg + 2);
exit(1); // TODO: this class shouldn't terminate the process
}
CloseHandle(hEvent);
printf("Succesfully set event: '%s'\n", arg + 2);
bExit = true;
break;
}
default:
fError = true;
}
case 'z': //random seed
if (*(arg + 1) == '\0')
{
timeSpan.SetRandSeed((ULONG)GetTickCount64());
}
else
{
int c = atoi(arg + 1);
if (c >= 0)
{
timeSpan.SetRandSeed(c);
}
else
{
fError = true;
}
}
break;
case 'Z': //zero write buffers
if (*(arg + 1) == '\0')
{
for (auto i = vTargets.begin(); i != vTargets.end(); i++)
{
i->SetZeroWriteBuffers(true);
}
}
else
{
UINT64 cb = 0;
string sPath;
if (_GetRandomDataWriteBufferData(string(arg + 1), cb, sPath) && (cb > 0))
{
for (auto i = vTargets.begin(); i != vTargets.end(); i++)
{
i->SetRandomDataWriteBufferSize(cb);
i->SetRandomDataWriteBufferSourcePath(sPath);
}
}
else
{
fprintf(stderr, "Invalid size passed to -Z\n");
fError = true;
}
}
break;
default:
fprintf(stderr, "Invalid option: '%s'\n", arg);
exit(1); // TODO: this class shouldn't terminate the process
}
if (fError)
{
fprintf(stderr, "Incorrectly provided option: '%s'\n", arg);
exit(1); // TODO: this class shouldn't terminate the process
}
--nParamCnt;
++args;
}
//
// exit if a user specified an action which was already satisfied and doesn't require running test
//
if (bExit)
{
printf("Now exiting...\n");
exit(1); // TODO: this class shouldn't terminate the process
}
if (vTargets.size() < 1)
{
fprintf(stderr, "You need to provide at least one filename\n");
return false;
}
for (auto i = vTargets.begin(); i != vTargets.end(); i++)
{
timeSpan.AddTarget(*i);
}
pProfile->AddTimeSpan(timeSpan);
return true;
}