-
Notifications
You must be signed in to change notification settings - Fork 1
/
xtask_api.h
59 lines (50 loc) · 1.17 KB
/
xtask_api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* xtask_api.h
*
* Created on: Jun 2, 2017
* Author: pnookala
*/
#ifndef XTASK_API_H_
#define XTASK_API_H_
#include "worker.h"
#ifdef spsctest
#define NUM_SAMPLES 8388608 //2^23
#define QUEUE_SIZE NUM_SAMPLES // Define maximum length of the queue
#define NUM_CPUS 24
#define INITQUEUES(size) InitBasicQueue(size)
#define ENQUEUE(data) BasicEnqueue(data)
#define DEQUEUE() BasicDequeue()
#define ENQUEUE_RESULT(data) BasicEnqueue_rq(data)
#define DEQUEUE_RESULT() BasicDequeue_rq()
typedef long unsigned int ticks;
struct task_desc {
int task_id;
int task_type;
int num_threads;
void *params;
};
struct mproc_state {
//struct queue *incoming;
//struct queue *results;
pthread_t *worker_threads;
int *kill_master;
int workers;
pthread_barrier_t barrier;
cpu_set_t cpuset;
//For benchmarking purposes
double throughput;
ticks *timestamps;
long int totalsamples;
};
struct thread_local_data
{
struct mproc_state* mps;
int cpuID;
};
struct mproc_state *mps;
void xtask_setup(int queue_size, int workers);
void xtask_cleanup();
void xtask_push(struct task_desc* task);
void xtask_poll(void* task);
#endif
#endif /* XTASK_API_H_ */