|
B2BITS FIX Antenna HFT
1.0.17
|
#include "platform_align.h"#include <memory.h>#include "printf.h"#include <float.h>#include <stdexcept>#include "B2BITS_V12_Defines.h"#include <B2BITS_String.h>#include <B2BITS_FIXFieldValue.h>#include "thread_specific_iface.h"
Include dependency graph for b2b_platform.h:
This graph shows which files directly or indirectly include this file:Classes | |
| struct | AppStatus |
| The user application status struct. More... | |
| class | auto_lock_knock_t2< lock_t > |
| class | auto_lock_t< lock_t > |
| class | auto_lock_t2< lock_t > |
| class | auto_lock_t2< SPINLOCK_T > |
| class | auto_lock_t< SPINLOCK_T > |
| class | auto_plock_t2< lock_t > |
| class | auto_read_lock_t< rwlock_t > |
| class | auto_read_lock_t2< rwlock_t > |
| class | auto_write_lock_t< rwlock_t > |
| class | auto_write_lock_t2< rwlock_t > |
| struct | Bilist |
| struct | DynShortStr< StringLength > |
| struct | DynShortStrWrapper< StringLength > |
| struct | PlatformProps |
| Platform configuration parameters. More... | |
| class | rwlock_t< lock_t > |
| struct | ShortStr< StringLength > |
| struct | ShortStrCtor< StringLength > |
| struct | ShortStrRef |
| struct | ShortStrRefCtor |
| class | spinlock |
| class | spinlock_reentrant |
| struct | StrRef |
| struct | StrRefCtor |
| class | Switchable< ObjT > |
Namespaces | |
| Utils | |
| Utils namespace. | |
| Utils::Log | |
| Logging system namespace. | |
Macros | |
| #define | _LONG32 |
| #define | APICALL |
| #define | BILISTOF(Bilist_member_ptr, T_Container) CONTAINEROF(Bilist_member_ptr, T_Container, bilist) |
| #define | CONTAINEROF(Member_ptr, T_Container, member_name) ((T_Container*)(((char*) (Member_ptr)) - OFFSETOF(T_Container, member_name))) |
| #define | DEBUG_OUTPUT(x) |
| #define | DO_DBG(_thetext) _thetext |
| #define | FD_CLR_OP FD_CLR |
| #define | FD_ISSET_OP FD_ISSET |
| #define | FD_SET_OP FD_SET |
| #define | fd_set_t fd_set |
| #define | FD_ZERO_OP(x, srv) FD_ZERO(x) |
| #define | LOG_FILE_MAX_SIZE 100000000 |
| #define | OFFSETOF(T_struct, member_name) ((size_t) &((T_struct*)0)->member_name) |
| #define | SAFE_SNPRINTF(ptr, sz, fmt,...) handle_snprintf_error( _SNPRINTF(ptr, sz, fmt, ##__VA_ARGS__), ptr, sz ) |
| #define | SAFE_VSNPRINTF(ptr, sz, fmt, args) handle_snprintf_error( vsnprintf(ptr, sz, fmt, args), ptr, sz ) |
| #define | SCALE_MULTIPLIER 10000 |
| #define | scaled_to_int_pair(v) ((int) ((v) / SCALE_MULTIPLIER)), ((unsigned) ((std::abs(v)) % SCALE_MULTIPLIER)) |
| #define | scaled_to_int_triple(v) ( v < 0 ? "-" : ""), ((int) ((std::abs(v)) / SCALE_MULTIPLIER)), ((unsigned) ((std::abs(v)) % SCALE_MULTIPLIER)) |
| #define | SOCKET_T SOCKET |
| #define | SVN_REVISION 307 |
Typedefs | |
| typedef auto_lock_t< spinlock > | AutoLock |
| typedef auto_lock_t2< spinlock > | AutoLock2 |
| typedef auto_lock_t < spinlock_reentrant > | AutoLockRe |
| typedef auto_lock_knock_t2 < spinlock_reentrant > | AutoLockRe2 |
| typedef auto_lock_t< SPINLOCK_T > | AutoLockT |
| typedef auto_lock_t2< SPINLOCK_T > | AutoLockT2 |
| typedef auto_plock_t2< spinlock > | AutoPLock2 |
| typedef struct Bilist | Bilist |
| typedef void(* | EXIT_HANDLER_CB )() |
| typedef void(* | HANDLE_CMD_CB )(void *sock, char *cmd_buf) |
| typedef int | long32 |
| typedef scaled64_t | price_scaled_t |
| typedef auto_read_lock_t< rwlock > | ReadLock |
| typedef auto_read_lock_t2< rwlock > | ReadLock2 |
| typedef rwlock_t< spinlock > | rwlock |
| typedef int64_t | scaled64_t |
| typedef auto_write_lock_t< rwlock > | WriteLock |
| typedef auto_write_lock_t2 < rwlock > | WriteLock2 |
Enumerations | |
| enum | PlatformLogLevel { LOG_LEVEL_ALWAYS = 0, LOG_LEVEL_FATAL, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG } |
Functions | |
| struct | __attribute__ ((aligned(64))) CachelineAtomic |
| _Pragma ("pack(1)") | |
| _Pragma ("pack()") | |
| static int | bitCount (uint64_t mask) |
| static void | clearEvenBits (uint64_t *mask) |
| static void | clearOddBits (uint64_t *mask) |
| static scaled64_t | dbl2int64_scaleup (double dbl) |
| DECLARE_PER_CPU (thread_id_t, __this_thread_id) | |
| void | disable_onload_in_current_thread () |
| void | disable_onload_spin_in_current_thread () |
| static scaled64_t | double_to_scaled64 (double v) |
| static uint64_t | get_cheap_nanosec () throw () |
| static uint64_t | get_millisec () throw () |
| static uint64_t | get_nanosec () throw () |
| static int | get_seconds_from_nanosec () |
| enum PlatformLogLevel | getLogLevel (const char *param) |
| static int | getUTCTimestampWithMs (char *out) |
| static void | halt () |
| static int | handle_snprintf_error (int snprintf_retval, char *ptr, int sz) |
| void | init_thread (const char *name, bool useAsyncLogger=true, bool setWin32ThreadName=true) |
| void | initHandlers (bool traceOnFaults, bool traceOnAbort, bool traceOnSigUSR2) |
| void | initialize_on_start (uint64_t timeCalibrationCPUMask, uint64_t assignCPUMaskAfterCalib) |
| Performs the startup early initialization. More... | |
| void | initialize_on_start (ThreadAffMgr *threadAffMgr) |
| void | initialize_on_start_engine (void) |
| static scaled64_t | int_to_scaled64 (int v) |
| int | isRiskCheckThreadsReady () |
| static uint64_t | nextBit (uint64_t *mask) |
| static uint64_t | nextBitReversed (uint64_t *mask) |
| void | platform_initialize (Utils::Log::LogCategory *engineLog, const char *logLevel="FOLLOW_FIXENGINE", EXIT_HANDLER_CB exitHandlerCb=NULL, HANDLE_CMD_CB handlerCmdCb=NULL) |
| Performs the platform initialization using g_platformProps. More... | |
| void | print_sys_time_info () |
| static void | printUTCTimestampWithMs (FILE *f) |
| static scaled64_t | round_scaled64 (scaled64_t v) |
| static double | scaled64_to_double (scaled64_t v) |
| template<typename SCALED_T > | |
| static double | scaled_to_double (SCALED_T v) |
| void | setProcessAffinityCPUMask (uint64_t mask) |
| void | setProcessAffinityCPUMask_Verbose (uint64_t mask) |
| void | setThreadAffinityCPUMask (uint64_t mask, pthread_t thread=0) |
| void | setThreadAffinityCPUMask_Verbose (uint64_t mask, pthread_t thread, const char *thread_name) |
| void | setThreadAffinityCPUs (int *cpuNumArray) |
| void | setThreadRealtimePrio_Verbose (int realtimePrio, const char *thread_name) |
| static void | sleepns (uint64_t delta_ns) throw () |
| static void | sleepUntil (uint64_t ns, uint64_t delta) throw () |
| static int | sprintfTimeStamp (int year, int month, int day, int hour, int minute, int second, char *buf) throw () |
| static int | sprintfTimeStampWithMSec (int year, int month, int day, int hour, int minute, int second, int msecond, char *buf) throw () |
| static void | terminateApp () |
| static thread_id_t | thread_id () throw () |
| static void | ull_memcpy (void *dst, const void *src, int size) throw () |
Variables | |
| PlatformProps | g_platformProps |
| static const int64_t | MAX_SCALED64_INT_PART = 0x7fffffffffffffffULL / 10000 |
| static const int64_t | MAX_SCALED64_VALUE = 0x7fffffffffffffffULL |
| pthread_t | riskCheckThreadId |
| uint64_t | times [20] |
| #define _LONG32 |
| #define APICALL |
| #define BILISTOF | ( | Bilist_member_ptr, | |
| T_Container | |||
| ) | CONTAINEROF(Bilist_member_ptr, T_Container, bilist) |
| #define CONTAINEROF | ( | Member_ptr, | |
| T_Container, | |||
| member_name | |||
| ) | ((T_Container*)(((char*) (Member_ptr)) - OFFSETOF(T_Container, member_name))) |
| #define DEBUG_OUTPUT | ( | x | ) |
| #define DO_DBG | ( | _thetext | ) | _thetext |
| #define FD_CLR_OP FD_CLR |
| #define FD_ISSET_OP FD_ISSET |
| #define FD_SET_OP FD_SET |
| #define fd_set_t fd_set |
| #define FD_ZERO_OP | ( | x, | |
| srv | |||
| ) | FD_ZERO(x) |
| #define LOG_FILE_MAX_SIZE 100000000 |
| #define OFFSETOF | ( | T_struct, | |
| member_name | |||
| ) | ((size_t) &((T_struct*)0)->member_name) |
| #define SAFE_SNPRINTF | ( | ptr, | |
| sz, | |||
| fmt, | |||
| ... | |||
| ) | handle_snprintf_error( _SNPRINTF(ptr, sz, fmt, ##__VA_ARGS__), ptr, sz ) |
| #define SAFE_VSNPRINTF | ( | ptr, | |
| sz, | |||
| fmt, | |||
| args | |||
| ) | handle_snprintf_error( vsnprintf(ptr, sz, fmt, args), ptr, sz ) |
| #define SCALE_MULTIPLIER 10000 |
| #define scaled_to_int_pair | ( | v | ) | ((int) ((v) / SCALE_MULTIPLIER)), ((unsigned) ((std::abs(v)) % SCALE_MULTIPLIER)) |
| #define scaled_to_int_triple | ( | v | ) | ( v < 0 ? "-" : ""), ((int) ((std::abs(v)) / SCALE_MULTIPLIER)), ((unsigned) ((std::abs(v)) % SCALE_MULTIPLIER)) |
| #define SOCKET_T SOCKET |
| #define SVN_REVISION 307 |
| typedef auto_lock_t< spinlock > AutoLock |
| typedef auto_lock_t2< spinlock > AutoLock2 |
| typedef auto_lock_t<spinlock_reentrant> AutoLockRe |
| typedef auto_lock_t<SPINLOCK_T> AutoLockT |
| typedef auto_lock_t2<SPINLOCK_T> AutoLockT2 |
| typedef auto_plock_t2<spinlock> AutoPLock2 |
| typedef void(* EXIT_HANDLER_CB)() |
| typedef void(* HANDLE_CMD_CB)(void *sock, char *cmd_buf) |
| typedef int long32 |
| typedef scaled64_t price_scaled_t |
| typedef auto_read_lock_t<rwlock> ReadLock |
| typedef auto_read_lock_t2<rwlock> ReadLock2 |
| typedef int64_t scaled64_t |
| typedef auto_write_lock_t<rwlock> WriteLock |
| typedef auto_write_lock_t2<rwlock> WriteLock2 |
| enum PlatformLogLevel |
| __attribute__ | ( | (aligned(64)) | ) |
| _Pragma | ( | "pack(1)" | ) |
| _Pragma | ( | "pack()" | ) |
|
inlinestatic |
|
inlinestatic |
References MAX_SCALED64_VALUE, SCALE_MULTIPLIER, and unlikely().
| DECLARE_PER_CPU | ( | thread_id_t | , |
| __this_thread_id | |||
| ) |
| void disable_onload_in_current_thread | ( | ) |
| void disable_onload_spin_in_current_thread | ( | ) |
|
inlinestatic |
References SCALE_MULTIPLIER.
|
inlinestatic | |||||||||||||
References cheap_rdtsc(), and get_nanosec_stable().
|
inlinestatic | |||||||||||||
References get_nanosec_stable().
Referenced by _throttle_log(), and CmiProductCatalog::saveToFile().
|
inlinestatic | |||||||||||||
References get_nanosec_stable(), and rdtsc().
Referenced by NanosTimeConvertRecalib::calcDiff1(), get_currentTimeUsec1970(), get_seconds_from_nanosec(), sleepns(), and sleepUntil().
|
inlinestatic |
References get_nanosec().
Referenced by CmiProductCatalog::addSymbol().
| enum PlatformLogLevel getLogLevel | ( | const char * | param | ) |
|
inlinestatic |
References sprintfTimeStampWithMSec().
Referenced by printUTCTimestampWithMs().
|
inlinestatic |
Referenced by fifo_create().
|
inlinestatic |
| void init_thread | ( | const char * | name, |
| bool | useAsyncLogger = true, |
||
| bool | setWin32ThreadName = true |
||
| ) |
| void initHandlers | ( | bool | traceOnFaults, |
| bool | traceOnAbort, | ||
| bool | traceOnSigUSR2 | ||
| ) |
Performs the startup early initialization.
Should be called before the platform and the engine initialization.
| timeCalibrationCPUMask | the CPU affinity mask applied for rdtsc time calibration must be non-zero to perform the calibration. |
| assignCPUMaskAfterCalib | the CPU affinity mask applied after rdtsc time calibration must be non-zero to perform the calibration. |
| void initialize_on_start | ( | ThreadAffMgr * | threadAffMgr | ) |
| void initialize_on_start_engine | ( | void | ) |
|
inlinestatic |
References SCALE_MULTIPLIER.
| int isRiskCheckThreadsReady | ( | ) |
Referenced by clearEvenBits(), and clearOddBits().
| void platform_initialize | ( | Utils::Log::LogCategory * | engineLog, |
| const char * | logLevel = "FOLLOW_FIXENGINE", |
||
| EXIT_HANDLER_CB | exitHandlerCb = NULL, |
||
| HANDLE_CMD_CB | handlerCmdCb = NULL |
||
| ) |
Performs the platform initialization using g_platformProps.
Should be called before the engine initialization.
| engineLog | the log category that will be used by the platform logging functions. See sockets_logging.h |
| logLevel,the | log level name, its valid values are: "FOLLOW_FIXENGINE", "ALWAYS", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG" |
| exitHandlerCb | the exit handler callback. It is invoked by the platform when the signal (Linux: SIGTERM,SIGINT; Windows: CTRL_C,CTRL_BREAK,other) is received. |
| handlerCmdCb | the command handler callback of the command shell. It is invoked by the platform when a command is received. |
| void print_sys_time_info | ( | ) |
|
inlinestatic |
References getUTCTimestampWithMs().
|
inlinestatic |
|
inlinestatic |
References SCALE_MULTIPLIER.
|
inlinestatic |
References SCALE_MULTIPLIER.
| void setProcessAffinityCPUMask | ( | uint64_t | mask | ) |
| void setProcessAffinityCPUMask_Verbose | ( | uint64_t | mask | ) |
| void setThreadAffinityCPUMask | ( | uint64_t | mask, |
| pthread_t | thread = 0 |
||
| ) |
| void setThreadAffinityCPUMask_Verbose | ( | uint64_t | mask, |
| pthread_t | thread, | ||
| const char * | thread_name | ||
| ) |
| void setThreadAffinityCPUs | ( | int * | cpuNumArray | ) |
| void setThreadRealtimePrio_Verbose | ( | int | realtimePrio, |
| const char * | thread_name | ||
| ) |
|
inlinestatic | ||||||||||||||
References get_nanosec(), and sleepUntil().
References cpu_relax, get_nanosec(), and sleepms().
Referenced by sleepns().
|
inlinestatic | ||||||||||||||||||||||||||||||||||||||||
Referenced by sprintfTimeStampWithMSec().
|
inlinestatic | ||||||||||||||||||||||||||||||||||||||||||||
References sprintfTimeStamp().
Referenced by getUTCTimestampWithMs().
|
inlinestatic |
|
inlinestatic | |||||||||||||
|
inlinestatic | ||||||||||||||||||||||||
| PlatformProps g_platformProps |
Referenced by get_currentTimeUsec1970(), and get_thread_specific_store().
|
static |
|
static |
Referenced by dbl2int64_scaleup().
| pthread_t riskCheckThreadId |
| uint64_t times[20] |
1.8.5