MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / StartCommonGeneration

Method StartCommonGeneration

src/rpc/rpcblockchain.cpp:470–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468
469 template<typename F>
470 void StartCommonGeneration(const int64_t periodIn, const int64_t batchSizeIn, F generateFunc) {
471
472 Stop();
473
474 period = periodIn;
475 batchSize = batchSizeIn;
476 if (period == 0 || batchSize == 0)
477 return;
478
479 // reset message queue according to <period, batchSize>
480 // For example, generate 50(batchSize) transactions in 20(period), then
481 // we need to prepare 1000 * 10 / 20 * 50 = 25,000 transactions in 10 second.
482 // Actually, set the message queue's size to 50,000(double or up to 60,000).
483 GenTxQueue::SizeType size = 1000 * 10 * batchSize * 2 / period;
484 GenTxQueue::SizeType actualSize = size > MSG_QUEUE_MAX_LEN ? MSG_QUEUE_MAX_LEN : size;
485
486 generationQueue = std::make_unique<GenTxQueue>(actualSize);
487
488 generateThreads = new boost::thread_group();
489 generateThreads->create_thread(generateFunc);
490 generateThreads->create_thread(boost::bind(&TpsTester::SendTx, this));
491 }
492
493
494};

Callers 3

StartCommonGenerationFunction · 0.80
StartContractGenerationFunction · 0.80
startwasmtpstestFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected