-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworker.h
More file actions
97 lines (97 loc) · 2.06 KB
/
worker.h
File metadata and controls
97 lines (97 loc) · 2.06 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
///*
// * worker.h
// *
// * Created on: Jun 2, 2017
// * Author: pnookala
// */
//#ifndef WORKER_H_
//#define WORKER_H_
//
//#include <stdio.h>
//#include <stdlib.h>
//#include <stdint.h>
//#include <unistd.h>
//#include <pthread.h>
//#include <sched.h>
//#include "basicqueue.h"
//
//#ifdef spsctest
//
//static int WORKERS;
//
//#define NUM_SAMPLES 262144//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;
//};
//
//#ifdef PHI
//
////get number of ticks, could be problematic on modern CPUs with out of order execution
//
//static __inline__ ticks getticks(void) {
// ticks tsc;
// __asm__ __volatile__(
// "rdtsc;"
// "shl $32, %%rdx;"
// "or %%rdx, %%rax"
// : "=a"(tsc)
// :
// : "%rcx", "%rdx");
//
// return tsc;
//}
//#else
//static __inline__ ticks getticks(void) {
// ticks tsc;
// __asm__ __volatile__(
// "rdtscp;"
// "shl $32, %%rdx;"
// "or %%rdx, %%rax"
// : "=a"(tsc)
// :
// : "%rcx", "%rdx");
//
// return tsc;
//}
//#endif
//
////static pthread_barrier_t barrier;
//
//struct task_desc *execute_task(struct task_desc *task);
//void *worker_handler(void *data);
//#endif
//#endif /* WORKER_H_ */