exchange
Low-latency exchange in C++
Loading...
Searching...
No Matches
exchange::common Namespace Reference

Classes

class  Universe
class  LogService

Enumerations

enum class  LogProducer : uint8_t {
  ARCHIVER , CANDLESTICK_PUBLISHER , CLIENT , EXECUTION_PUBLISHER ,
  GATEWAY , MATCHING_ENGINE , ORDER_MANAGER , ORDERBOOK_PUBLISHER ,
  BENCHMARK
}

Functions

bool pinToCore () noexcept
void reportException (const std::shared_ptr< spdlog::logger > &logger, const std::exception &err) noexcept
void reportUnknownException (const std::shared_ptr< spdlog::logger > &logger) noexcept

Variables

constexpr uint32_t PREFERRED_CORE = 2

Enumeration Type Documentation

◆ LogProducer

enum class exchange::common::LogProducer : uint8_t
strong

The components where logs can come from.

Enumerator
ARCHIVER 
CANDLESTICK_PUBLISHER 
CLIENT 
EXECUTION_PUBLISHER 
GATEWAY 
MATCHING_ENGINE 
ORDER_MANAGER 
ORDERBOOK_PUBLISHER 
BENCHMARK 

Function Documentation

◆ pinToCore()

bool exchange::common::pinToCore ( )
noexcept

Attempts to pin the current thread to a single CPU core by changing the CPU affinity settings. It picks the first core the process is allowed to run on that is at least core 2, which is likely to be a different physical core than 0/1, which are often used for interrupts. If only cores 0/1 are allowed, it picks the highest one.

Returns
True if pinning succeeded, false otherwise.
Here is the caller graph for this function:

◆ reportException()

void exchange::common::reportException ( const std::shared_ptr< spdlog::logger > & logger,
const std::exception & err )
noexcept

Tries to log that an exception occurred. Falls back to writing to stderr manually if the logger itself fails.

Parameters
loggerThe logger to attempt to write to.
errThe exception to log.
Here is the caller graph for this function:

◆ reportUnknownException()

void exchange::common::reportUnknownException ( const std::shared_ptr< spdlog::logger > & logger)
noexcept

Tries to log that an unknown exception occurred. Falls back to writing to stderr manually if the logger itself fails.

Parameters
loggerThe logger to attempt to write to.
Here is the caller graph for this function:

Variable Documentation

◆ PREFERRED_CORE

uint32_t exchange::common::PREFERRED_CORE = 2
constexpr