Page tree
Skip to end of metadata
Go to start of metadata

Overview

FIX Antenna HFT provides abilities to configure CPU affinity programmatically. This article gives a description on how to do that.

Configuration

On initialization each thread goes to the callback Engine::ThreadsPoolListener::onNewThreadCreated(ThreadAttrs& threadAttrs), where user is able to define the affinity for the thread. If user doesn't specify the affinity for thread, all CPUs will be used.

Affinity is specified as a bit mask where serial number of the bit is serial number of the core if read from the right to the left. Mask should be presented in the decimal system.

E.g. to specify second, third and fourth cores, the affinity in bytes will look like "1110". It is "14" in the decimal system. So, for proper use the affinity should be set to 14.

In order Engine knows exactly what code to call, user should register on the mentioned callback on HFT Antenna start. Below is the snippet from the "Router" sample for reference:

Engine::FixEngine::InitParameters params;
params.threadPoolListener_ = listener;
FixEngine::init( params );


The way described above works for all the threads except async logger thread.

Аsync logger thread affinity is configured in a different way by means of g_platformProps.logger_CPUMask, which is parameter of the global settings object platformProps. Below is the snippet from the "Router" sample for reference:

g_platformProps.logger_CPUMask = mask;
platform_initialize(...);
launch_logger_thread();



  • No labels