1 #ifndef testQueueMAIN_h_
2 #define testQueueMAIN_h_
12 static const int CHNUM = 2;
14 static const int buffer_size = 131072;
15 static const int m_num = 100*buffer_size;
16 static const int push_max = 65536;
23 int try_push(
int chan, T *
data,
int n,
int index);
25 void push(
int chan, T *
data,
int n);
27 int try_pull(
int chan, T *&
data);
30 int pull(
int chan, T *&
data);
32 std::atomic<int64_t> write[CHNUM];
34 std::atomic<int64_t> read[CHNUM];
36 std::atomic<int64_t> numInBuffer[CHNUM];
38 int64_t current_tail[CHNUM];
40 int64_t next_tail[CHNUM];
42 int64_t current_head[CHNUM];
44 int64_t writeNum[CHNUM];
46 int64_t readNum[CHNUM];
48 int64_t writeNumInBuffer[CHNUM];
50 int64_t readNumInBuffer[CHNUM];
52 static const int64_t size = buffer_size;
60 int64_t increment(
int n,
int x){
61 return (n + x) % (size);
63 int64_t memPercent(
int n,
int x){
66 bool startOfRun[CHNUM] = {
true,
true};