42int main(
int argc,
char* argv[])
52 > cfg{
"TCPStandardBenchmark", argc, argv};
57 const auto numberOfMessages = cfg.numberOfMessages();
58 const auto warmupInterval = cfg.warmupInterval();
59 const auto intervalBetweenSending = (std::max)(cfg.intervalBetweenSending(), warmupInterval);
60 const auto storageType = cfg.storage();
72 .receiveSpinningTimeout(1000 * 1000)
74 .logBeforeSending(
false)
88 const auto bgwSession = std::make_unique<BgwSession>(stack, settings, &listener, cfg.storage());
90 const auto connected = bgwSession->connectAsync(bgwCredentials);
92 while(!connected.is_ready())
95 if(connected.has_exception())
100 std::clog <<
"\nWarm-up phase to make first calls faster..." << std::endl;
103 stack, *bgwSession, order, numberOfMessages, intervalBetweenSending, warmupInterval);
107 std::clog <<
"\nMeasurement phase..." << std::endl;
110 stack, *bgwSession, order, numberOfMessages, intervalBetweenSending, warmupInterval);
113 const auto disconnected = bgwSession->disconnectAsync();
115 while(!disconnected.is_ready())
118 if(disconnected.has_exception())
121 catch(
const std::exception& ex)
123 std::cerr <<
"\nEXCEPTION: " << ex.what() << std::endl;
133 std::clog <<
"Attention: packet grouping detected! Increase the interval between sending!" << std::endl;
138 catch (
const std::exception& ex)
140 std::cerr <<
"\nEXCEPTION: " << ex.what() << std::endl;
#define ONIXS_ICEBOE_NAMESPACE
#define ONIXS_ICEBOE_MESSAGING_NAMESPACE
int main(int argc, char *argv[])
const BenchmarkData::SendMarks * sendMarks() const noexcept
const BenchmarkData::ReceiveMarks * receiveMarks() const noexcept
const BenchmarkData::Overhead & overhead() const noexcept
bool packetGroupingDetected() const noexcept
A high-level wrapper over the TCP standard stack.
ONIXS_ICEBOE_FORCEINLINE void dispatchEvents() override
Processes events on a stack and performs the necessary handling.
ONIXS_ICEBOE_FORCEINLINE bool isQuiescent() const override
static void affinity(const CpuIndexes &cpuIndexes)
Sets the processor affinity mask for the current thread. The thread is rescheduled after this call.
bool receivedAllMessages() const noexcept
void collectSessionTimeMarks(Stack &stack, Session &session, MessageHolder< NewOrderRequest > &order, size_t numberOfMessages, size_t sendPeriod, size_t warmupPeriod)
static MessageHolder< NewOrderRequest > createOrder(const std::string &traderId)
std::shared_ptr< void > setPriorityAndPolicy(Session *session=nullptr)
std::pair< std::unique_ptr< GatewayEmulatorThread< BusSessionGatewayListener > >, std::unique_ptr< GatewayEmulatorThread< GatewayListener > > > createEmulator(const SessionSettings &settings, const ConnectivityConfiguration &cfg, bool tcpDirect=false)
BgwCredentials receiveBgwCredentials(SessionSettings settings, std::string host, Port port)
SessionSettings fillSettings(const LogonConfiguration &logonCfg, const ConnectivityConfiguration &connCfg, const SettingsConfiguration &settingsCfg)
void printBenchmarkSettings(std::ostream &o, size_t numberOfMessages, size_t intervalBetweenSending, size_t warmupInterval, SessionStorageType::Enum storageType)
static void reportResults(const std::string &name, const SendMarks *sendMarksArray, const ReceiveMarks *receiveMarksArray, std::size_t count, const Overhead &overhead)
@ External
Session events are handled by rolling an event loop in a user thread.
static void manageSignals() noexcept