B2BITS FIX Antenna HFT
1.0.16
|
#include <time.h>
#include <sched.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/types.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <memory.h>
#include <stdio.h>
#include <ctype.h>
#include <pthread.h>
#include <stdint.h>
#include <sys/mman.h>
#include "extensions.h"
#include <cstring>
Macros | |
#define | __USE_GNU |
#define | _SNPRINTF snprintf |
#define | ALLOC_BIG_CHUNK malloc |
#define | atomic_bool_compare_swap32(ptr, oldval, newval) __sync_bool_compare_and_swap( (ptr), (oldval), (newval) ) |
#define | atomic_bool_compare_swap64(ptr, oldval, newval) __sync_bool_compare_and_swap( (ptr), (oldval), (newval) ) |
#define | atomic_clear_bit(ptr, bit) __sync_and_and_fetch((ptr), ~(1<<(bit))) |
#define | atomic_decr32(ptr) __sync_sub_and_fetch( (ptr), 1 ) |
#define | atomic_incr32(ptr) __sync_add_and_fetch( (ptr), 1 ) |
#define | atomic_incr64(ptr) __sync_add_and_fetch( (ptr), 1 ) |
#define | atomic_set_bit(ptr, bit) __sync_or_and_fetch((ptr), 1<<(bit)) |
#define | ATOMIC_T long |
#define | atomic_test_and_clear_bit(ptr, bit) ( !! (__sync_fetch_and_and((ptr), ~(1<<(bit))) & (1<<(bit))) ) |
#define | ATOMIC_TEST_AND_SET(x) (!__sync_lock_test_and_set((x), 1)) |
#define | atomic_test_and_set_bit(ptr, bit) ( ! (__sync_fetch_and_or((ptr), 1<<(bit)) & (1<<(bit))) ) |
#define | BARRIER() asm volatile ("" : : : "memory") |
#define | CALLOC calloc |
#define | CLOSESOCKET close |
#define | cpu_relax() asm volatile("pause\n": : :"memory") |
#define | ERRNO errno |
#define | FLATTEN __attribute__ ((flatten)) |
#define | FREE free |
#define | HOT __attribute__ ((hot)) |
#define | MALLOC malloc |
#define | MB() __sync_synchronize() |
#define | MEMCPY memcpy |
#define | MEMMOVE memmove |
#define | MEMSET memset |
#define | popcnt64 __builtin_popcountll |
#define | PRAGMA_SIMD |
#define | prefetch(x) __builtin_prefetch((const void *) (x)) |
#define | PREFETCH_STRIDE 32 |
#define | RD_LOCK pthread_rwlock_rdlock |
#define | RD_UNLOCK pthread_rwlock_unlock |
#define | read_prefetch(x) __builtin_prefetch((const void *) (x), 0) |
#define | REALLOC realloc |
#define | RWLOCK_FINI(x) pthread_rwlock_destroy(x) |
#define | RWLOCK_INIT(x) pthread_rwlock_init((x), 0) |
#define | RWLOCK_T pthread_rwlock_t |
#define | SPIN_LOCK sharp_spin_lock |
#define | SPIN_TRYLOCK sharp_spin_trylock |
#define | SPIN_UNLOCK sharp_spin_unlock |
#define | SPINLOCK_FINI(x) sharp_spin_destroy(x) |
#define | SPINLOCK_INIT(x) sharp_spin_init((x), 0) |
#define | SPINLOCK_T sharp_spinlock_t |
#define | test_bit(ptr, bit) (!!(*(ptr) & (1<<(bit)))) |
#define | test_mask(ptr, mask) (!!(*(ptr) & (mask))) |
#define | WR_LOCK pthread_rwlock_wrlock |
#define | WR_UNLOCK pthread_rwlock_unlock |
#define | write_prefetch(x) __builtin_prefetch((const void *) (x), 1) |
Typedefs | |
typedef volatile unsigned | ATOMIC32_T |
typedef volatile unsigned long long | ATOMIC64_T |
typedef atom_t | sharp_spinlock_t |
typedef int(* | SOCKET_accept )(int fd, struct sockaddr *addr, socklen_t *addrlen) |
typedef int(* | SOCKET_bind )(int fd, const struct sockaddr *addr, socklen_t addrlen) |
typedef int(* | SOCKET_close )(int fd) |
typedef int(* | SOCKET_connect )(int fd, const struct sockaddr *addr, socklen_t addrlen) |
typedef int(* | SOCKET_getsockopt )(int s, int level, int optname, void *optval, socklen_t *optlen) |
typedef int(* | SOCKET_listen )(int fd, int backlog) |
typedef ssize_t(* | SOCKET_recv )(int fd, void *buf, size_t size, int flags) |
typedef int(* | SOCKET_select )(int n, fd_set_t *inp, fd_set_t *outp, fd_set_t *exp, struct timeval *tvp) |
typedef ssize_t(* | SOCKET_send )(int fd, const void *buf, size_t len, int flags) |
typedef int(* | SOCKET_setsockopt )(int s, int level, int optname, const void *optval, socklen_t optlen) |
Functions | |
static uint64_t | cheap_rdtsc () throw () |
static uint64_t | get_nanosec_stable () throw () |
static time_t | get_seconds () throw () |
void | install_signal_handlers (int traceOnFailts, int traceOnSigUSR2) |
void | ipc_socket_init (void) |
template<typename T > | |
long | likely (const T &x) |
static void | prefetch_range (void *addr, size_t len) |
static uint64_t | rdtsc () throw () |
static int | sharp_spin_destroy (sharp_spinlock_t *) throw () |
static int | sharp_spin_init (sharp_spinlock_t *l, int) throw () |
static int | sharp_spin_lock (sharp_spinlock_t *l) throw () |
static int | sharp_spin_trylock (sharp_spinlock_t *l) throw () |
static int | sharp_spin_unlock (sharp_spinlock_t *l) throw () |
static void | sleepms (int ms) throw () |
template<typename T > | |
long | unlikely (const T &x) |
#define __USE_GNU |
#define _SNPRINTF snprintf |
#define ALLOC_BIG_CHUNK malloc |
#define atomic_bool_compare_swap32 | ( | ptr, | |
oldval, | |||
newval | |||
) | __sync_bool_compare_and_swap( (ptr), (oldval), (newval) ) |
Referenced by __attribute__(), sharp_spin_lock(), and sharp_spin_trylock().
#define atomic_bool_compare_swap64 | ( | ptr, | |
oldval, | |||
newval | |||
) | __sync_bool_compare_and_swap( (ptr), (oldval), (newval) ) |
#define atomic_clear_bit | ( | ptr, | |
bit | |||
) | __sync_and_and_fetch((ptr), ~(1<<(bit))) |
#define atomic_decr32 | ( | ptr | ) | __sync_sub_and_fetch( (ptr), 1 ) |
Referenced by __attribute__().
#define atomic_incr32 | ( | ptr | ) | __sync_add_and_fetch( (ptr), 1 ) |
Referenced by __attribute__().
#define atomic_incr64 | ( | ptr | ) | __sync_add_and_fetch( (ptr), 1 ) |
Referenced by Engine::GlobalMsgIdGen::newValue().
#define atomic_set_bit | ( | ptr, | |
bit | |||
) | __sync_or_and_fetch((ptr), 1<<(bit)) |
#define ATOMIC_T long |
#define atomic_test_and_clear_bit | ( | ptr, | |
bit | |||
) | ( !! (__sync_fetch_and_and((ptr), ~(1<<(bit))) & (1<<(bit))) ) |
#define ATOMIC_TEST_AND_SET | ( | x | ) | (!__sync_lock_test_and_set((x), 1)) |
#define atomic_test_and_set_bit | ( | ptr, | |
bit | |||
) | ( ! (__sync_fetch_and_or((ptr), 1<<(bit)) & (1<<(bit))) ) |
#define BARRIER | ( | ) | asm volatile ("" : : : "memory") |
#define CALLOC calloc |
#define CLOSESOCKET close |
#define cpu_relax | ( | ) | asm volatile("pause\n": : :"memory") |
#define ERRNO errno |
int FLATTEN __attribute__ ((flatten)) |
#define FREE free |
#define HOT __attribute__ ((hot)) |
#define MALLOC malloc |
#define MB | ( | ) | __sync_synchronize() |
#define MEMCPY memcpy |
Referenced by tape_allocator::allocAndCopy(), ShortStr< OPT_MATURITY_LEN+CALLPUT_LEN+MAX_STRIKE_LEN >::append(), ShortStrCtor< StringLength >::append(), ShortStr< OPT_MATURITY_LEN+CALLPUT_LEN+MAX_STRIKE_LEN >::assign(), ShortStrCtor< StringLength >::assign(), DynShortStr< StringLength >::assign(), fifo_pop(), fifo_push(), message_queue_pop(), message_queue_push(), and Parser::LiteFixMessage::updateValueAtIndex().
#define MEMMOVE memmove |
#define MEMSET memset |
#define popcnt64 __builtin_popcountll |
#define PRAGMA_SIMD |
#define prefetch | ( | x | ) | __builtin_prefetch((const void *) (x)) |
Referenced by prefetch_range().
#define PREFETCH_STRIDE 32 |
Referenced by prefetch_range().
#define RD_LOCK pthread_rwlock_rdlock |
#define RD_UNLOCK pthread_rwlock_unlock |
#define read_prefetch | ( | x | ) | __builtin_prefetch((const void *) (x), 0) |
#define REALLOC realloc |
#define RWLOCK_FINI | ( | x | ) | pthread_rwlock_destroy(x) |
#define RWLOCK_INIT | ( | x | ) | pthread_rwlock_init((x), 0) |
#define RWLOCK_T pthread_rwlock_t |
#define SPIN_LOCK sharp_spin_lock |
#define SPIN_TRYLOCK sharp_spin_trylock |
Referenced by spinlock::try_lock(), spinlock_reentrant::try_lock(), and auto_lock_t2< SPINLOCK_T >::try_lock().
#define SPIN_UNLOCK sharp_spin_unlock |
Referenced by fifo_is_full(), fifo_pop(), fifo_push(), message_queue_claim_space_for_push(), message_queue_commit_push(), message_queue_is_full(), message_queue_pop(), message_queue_push(), spinlock::unlock(), spinlock_reentrant::unlock(), auto_lock_t2< SPINLOCK_T >::unlock(), and auto_lock_t< SPINLOCK_T >::~auto_lock_t().
#define SPINLOCK_FINI | ( | x | ) | sharp_spin_destroy(x) |
#define SPINLOCK_INIT | ( | x | ) | sharp_spin_init((x), 0) |
#define SPINLOCK_T sharp_spinlock_t |
#define test_bit | ( | ptr, | |
bit | |||
) | (!!(*(ptr) & (1<<(bit)))) |
#define test_mask | ( | ptr, | |
mask | |||
) | (!!(*(ptr) & (mask))) |
#define WR_LOCK pthread_rwlock_wrlock |
#define WR_UNLOCK pthread_rwlock_unlock |
#define write_prefetch | ( | x | ) | __builtin_prefetch((const void *) (x), 1) |
typedef volatile unsigned ATOMIC32_T |
typedef volatile unsigned long long ATOMIC64_T |
typedef atom_t sharp_spinlock_t |
typedef int(* SOCKET_accept)(int fd, struct sockaddr *addr, socklen_t *addrlen) |
typedef int(* SOCKET_bind)(int fd, const struct sockaddr *addr, socklen_t addrlen) |
typedef int(* SOCKET_close)(int fd) |
typedef int(* SOCKET_connect)(int fd, const struct sockaddr *addr, socklen_t addrlen) |
typedef int(* SOCKET_getsockopt)(int s, int level, int optname, void *optval, socklen_t *optlen) |
typedef int(* SOCKET_listen)(int fd, int backlog) |
typedef ssize_t(* SOCKET_recv)(int fd, void *buf, size_t size, int flags) |
typedef int(* SOCKET_select)(int n, fd_set_t *inp, fd_set_t *outp, fd_set_t *exp, struct timeval *tvp) |
typedef ssize_t(* SOCKET_send)(int fd, const void *buf, size_t len, int flags) |
typedef int(* SOCKET_setsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen) |
|
inlinestatic |
Referenced by get_cheap_nanosec().
|
inlinestatic |
Referenced by get_cheap_nanosec(), get_millisec(), and get_nanosec().
|
inlinestatic |
void install_signal_handlers | ( | int | traceOnFailts, |
int | traceOnSigUSR2 | ||
) |
void ipc_socket_init | ( | void | ) |
|
inline |
|
inlinestatic |
References prefetch, and PREFETCH_STRIDE.
|
inlinestatic |
Referenced by get_nanosec().
|
static |
|
static |
References atom_write.
|
static |
References atom_read, atomic_bool_compare_swap32, BARRIER, and cpu_relax.
|
static |
References atomic_bool_compare_swap32.
|
static |
References atom_write, and BARRIER.
|
inlinestatic |
References usleep().
Referenced by sleepUntil().
|
inline |
Referenced by __attribute__(), HashTable< ElementType, ElementKeyType, ElementKeyHashFunction, ElementEQComparator, ElementKeyCopier >::addReplace(), HashTable< ElementType, ElementKeyType, ElementKeyHashFunction, ElementEQComparator, ElementKeyCopier >::addReplace_CleanElem(), ShortStr< OPT_MATURITY_LEN+CALLPUT_LEN+MAX_STRIKE_LEN >::append(), ShortStrCtor< StringLength >::append(), DynShortStr< StringLength >::assign(), dbl2int64_scaleup(), fifo_claim_continuous_space_for_push(), fifo_is_full(), fifo_peek_continuous_buf(), fifo_pop(), fifo_push(), HashTable< ElementType, ElementKeyType, ElementKeyHashFunction, ElementEQComparator, ElementKeyCopier >::findOrAdd_CleanElem(), get_thread_specific_store(), Parser::LiteFixMessage::getFieldStorage_canthrow(), Parser::LiteFixMessage::getTagAsBool_nothrow(), Parser::LiteFixMessage::getTagAsInt(), Parser::LiteFixMessage::getTagAsIntAtIndex(), Parser::LiteFixMessage::getTagAsStringAtIndex(), Parser::LiteFixMessage::getTagAtIndex(), message_queue_claim_space_for_push(), message_queue_is_full(), message_queue_peek(), message_queue_pop(), message_queue_push(), return_object(), return_object_NOLOCK(), and Parser::LiteFixMessage::updateValue().