This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<order> | |
<timeInForce>ImmediateOrCancel</timeInForce> | |
<instructionId>1733844027851145216</instructionId> | |
<originalInstructionId>1733844027851145216</originalInstructionId> | |
<orderId>AAK8oAAAAAAAAAAF</orderId> | |
<accountId>1393236922</accountId> | |
<instrumentId>179361</instrumentId> | |
<quantity>30</quantity> | |
<matchedQuantity>30</matchedQuantity> | |
<matchedCost>22.1</matchedCost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExecutionTracking implements OrderEventListener, ExecutionEventListener | |
{ | |
private final Session tradingSession; | |
final Map<Long, Order> lastOrderStateByInstructionId = new HashMap<Long, Order>(); | |
Order currentOrder = null; | |
long currentFilledQuantity; | |
long currentCancelledQuantity; | |
public ExecutionTracking(final Session tradingSession) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public long incrementAndGet(AtomicLong atomic) { | |
long expected; | |
long updated | |
do { | |
expected = atomic.get(); | |
updated = expected + 1; | |
} | |
while (!atomic.compareAndSet(expected, updated)); | |
return updated; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void serialisePublishing(final long sequence, | |
final Sequence cursor, | |
final int batchSize) { | |
final long expectedSequence = sequence - batchSize; | |
while (expectedSequence != cursor.get()) { | |
// busy spin | |
} | |
cursor.set(sequence); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void serialisePublishing(final long sequence, | |
final Sequence cursor, | |
final int batchSize) { | |
// Guard condition, limit the number of pending publications | |
int counter = RETRIES; | |
while (sequence - cursor.get() > pendingPublication.length()) { | |
if (--counter == 0) { | |
Thread.yield(); | |
counter = RETRIES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
static void cpuid(int op1, int op2, int *data) { | |
asm("cpuid" | |
: "=a" (data[0]), "=b" (data[1]), "=c" (data[3]), "=d" (data[2]) | |
: "a"(op1), "c"(op2)); | |
} | |
int main(int argc, char** argv) { | |
int values[5]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
static void cpuid(int op1, int op2, int *data) { | |
asm("cpuid" | |
: "=a" (data[0]), "=b" (data[1]), "=c" (data[2]), "=d" (data[3]) | |
: "a"(op1), "c"(op2)); | |
} | |
int main (int argc, const char * argv[]) { | |
int values[4]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern "C" { | |
/* from sys/osfmk/i386/mp.c */ | |
extern void mp_rendezvous(void (*setup_func)(void *), | |
void (*action_func)(void *), | |
void (*teardown_func)(void *), | |
void *arg); | |
extern int cpu_number(void); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lmax.disruptor; | |
import java.util.concurrent.BrokenBarrierException; | |
import java.util.concurrent.CyclicBarrier; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PopCntTest | |
{ | |
public static void main(String[] args) | |
{ | |
int result = 0; | |
for (int i = 0; i < 1000000000; i++) | |
{ | |
result += Integer.bitCount(i); | |
} | |
OlderNewer