Lines Matching refs:option

142 USED_FUNCTION void LoopFunction(milliseconds timeOutMS, const Option &option)
148 if (option.sleepms > 0) {
151 std::this_thread::sleep_for(std::chrono::milliseconds(option.sleepms));
154 if (option.mmap) {
157 if (option.iowait) {
160 if (option.branch) {
174 if (!option.nonew) {
181 if (!option.nofunc) {
188 inline void Loop(milliseconds timeOutMS, const Option &option)
191 LoopFunction(timeOutMS, option);
195 USED_FUNCTION void CallStack10(int currentStack, const Option &option)
197 if (option.stack > 0) {
198 Loop(option.second * msDuartion, option);
202 USED_FUNCTION void CallStack9(int currentStack, const Option &option)
204 if (option.stack > 0) {
205 if (option.dynamicStack) {
206 Loop(eachStackFunRunTime, option); // loop 100 ms
208 CallStack10(currentStack - 1, option);
210 Loop(option.second * msDuartion, option);
214 USED_FUNCTION void CallStack8(int currentStack, const Option &option)
216 if (option.stack > 0) {
217 if (option.dynamicStack) {
218 Loop(eachStackFunRunTime, option); // loop 100 ms
220 CallStack9(currentStack - 1, option);
222 Loop(option.second * msDuartion, option);
226 USED_FUNCTION void CallStack7(int currentStack, const Option &option)
228 if (option.stack > 0) {
229 if (option.dynamicStack) {
230 Loop(eachStackFunRunTime, option); // loop 100 ms
232 CallStack8(currentStack - 1, option);
234 Loop(option.second * msDuartion, option);
238 USED_FUNCTION void CallStack6(int currentStack, const Option &option)
240 if (option.stack > 0) {
241 if (option.dynamicStack) {
242 Loop(eachStackFunRunTime, option); // loop 100 ms
244 CallStack7(currentStack - 1, option);
246 Loop(option.second * msDuartion, option);
250 USED_FUNCTION void CallStack5(int currentStack, const Option &option)
252 if (option.stack > 0) {
253 if (option.dynamicStack) {
254 Loop(eachStackFunRunTime, option); // loop 100 ms
256 CallStack6(currentStack - 1, option);
258 Loop(option.second * msDuartion, option);
262 USED_FUNCTION void CallStack4(int currentStack, const Option &option)
264 if (option.stack > 0) {
265 if (option.dynamicStack) {
266 Loop(eachStackFunRunTime, option); // loop 100 ms
268 CallStack5(currentStack - 1, option);
270 Loop(option.second * msDuartion, option);
274 USED_FUNCTION void CallStack3(int currentStack, const Option &option)
276 if (option.stack > 0) {
277 if (option.dynamicStack) {
278 Loop(eachStackFunRunTime, option); // loop 100 ms
280 CallStack4(currentStack - 1, option);
282 Loop(option.second * msDuartion, option);
286 USED_FUNCTION void CallStack2(int currentStack, const Option &option)
288 if (option.stack > 0) {
289 if (option.dynamicStack) {
290 Loop(eachStackFunRunTime, option); // loop 100 ms
292 CallStack3(currentStack - 1, option);
294 Loop(option.second * msDuartion, option);
298 USED_FUNCTION void CallStack1(int currentStack, const Option &option)
300 if (option.stack > 0) {
301 if (option.dynamicStack) {
302 Loop(eachStackFunRunTime, option); // loop 100 ms
304 CallStack2(currentStack - 1, option);
306 Loop(option.second * msDuartion, option);
310 USED_FUNCTION void CallStack0(int currentStack, const Option &option)
312 if (option.stack > 0) {
313 if (option.dynamicStack) {
314 Loop(eachStackFunRunTime, option); // loop 100 ms
316 CallStack1(currentStack - 1, option);
318 Loop(option.second * msDuartion, option);
322 USED_FUNCTION void ExampleThread(const Option &option)
324 printf("thread %d ++ with %d %d \n", GetTid(), option.second, option.stack);
325 CallStack0(option.stack, option);
331 USED_FUNCTION void RunSampleThread(const Option &option)
333 printf("run %d threads for %d second with %d stack level\n", option.numThreads, option.second,
334 option.stack);
337 std::thread threads[option.numThreads];
338 for (int count = 0; count < option.numThreads; ++count) {
339 threads[count] = std::thread(ExampleThread, option);
341 for (int count = 0; count < option.numThreads; ++count) {
407 bool MatchArgs(std::vector<std::string> &args, const std::string &option)
409 if (args[0] == option) {
415 bool GetBoolFromArg(std::vector<std::string> &args, const std::string &option, bool &value)
417 if (MatchArgs(args, option)) {
432 Option option;
439 if (!GetIntFromArg(args, option.boundCpu)) {
443 if (!GetIntFromArg(args, option.sleepms)) {
447 if (!GetIntFromArg(args, option.numThreads)) {
451 if (!GetIntFromArg(args, option.second)) {
455 if (!GetIntFromArg(args, option.stack)) {
458 } else if (GetBoolFromArg(args, "--dynamic", option.dynamicStack)) {
460 } else if (GetBoolFromArg(args, "--nowait", option.noWait)) {
462 } else if (GetBoolFromArg(args, "--mmap", option.mmap)) {
464 } else if (GetBoolFromArg(args, "--iowait", option.iowait)) {
466 } else if (GetBoolFromArg(args, "--branch", option.branch)) {
468 } else if (GetBoolFromArg(args, "--nonew", option.nonew)) {
470 } else if (GetBoolFromArg(args, "--nofunc", option.nofunc)) {
478 if (option.boundCpu > -1) {
481 CPU_SET(option.boundCpu, &mask);
485 printf("Set CPU(%d) affinity failure, ERROR:%s\n", option.boundCpu, errInfo);
488 if (!option.noWait) {
492 RunSampleThread(option);