[commtech] Make BUF_SIZE definition be per tech

Don't define BUF_SIZE globally anymore, but per communication technique
This commit is contained in:
Thomas Preud'homme 2011-03-02 12:20:47 +01:00
parent 7c515200e7
commit 22c97ab418
8 changed files with 19 additions and 4 deletions

View File

@ -4,6 +4,10 @@
/* Non standard include */
#include <commtech.h>
#ifndef BUF_SIZE
#define BUF_SIZE (32 * CACHE_LINE_SIZE)
#endif
/* This is not an error, we need this two-macro system */
#define toString(x) doStringification(x)
#define doStringification(x) #x

View File

@ -2,7 +2,6 @@
#define _COMMTECH_H_ 1
#define CACHE_LINE_SIZE 64
#define BUF_SIZE CACHE_LINE_SIZE
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect((x), 0)

View File

@ -4,6 +4,10 @@
/* Non standard include */
#include <commtech.h>
#ifndef BUF_SIZE
#define BUF_SIZE CACHE_LINE_SIZE
#endif
#ifndef SLOTS
#define SLOTS 64 /* Value used in the article, section V.A */
#endif

View File

@ -8,6 +8,10 @@
#define SHARED_SPACE_SIZE (16 * BUF_SIZE)
#define SHARED_SPACE_VOIDPTR (SHARED_SPACE_SIZE / sizeof(void *))
#ifndef BUF_SIZE
#define BUF_SIZE CACHE_LINE_SIZE
#endif
#define DANGER (2 * BUF_SIZE / sizeof(void *))
#define GOOD (6 * BUF_SIZE / sizeof(void *))
#define ADJUST_FREQ 64

View File

@ -4,6 +4,10 @@
/* Non standard include */
#include <commtech.h>
#ifndef BUF_SIZE
#define BUF_SIZE CACHE_LINE_SIZE
#endif
#define SHARED_SPACE_SIZE (2 * BUF_SIZE)
#define SHARED_SPACE_VOIDPTR (SHARED_SPACE_SIZE / sizeof(void *))

View File

@ -4,7 +4,7 @@
/* Non standard include */
#include <commtech.h>
#define SHARED_SPACE_SIZE (2 * BUF_SIZE)
#define SHARED_SPACE_SIZE (250 * CACHE_LINE_SIZE) // Check with batchSize
#define SHARED_SPACE_VOIDPTR (SHARED_SPACE_SIZE / sizeof(void *))
struct control

View File

@ -4,7 +4,7 @@
/* Non standard include */
#include <commtech.h>
#define SHARED_SPACE_SIZE (2 * BUF_SIZE)
#define SHARED_SPACE_SIZE (2 * CACHE_LINE_SIZE)
#define SHARED_SPACE_VOIDPTR (SHARED_SPACE_SIZE / sizeof(void *))
struct comm

View File

@ -9,7 +9,7 @@
__thread struct comm *comm;
const int batchSize = BUF_SIZE / sizeof(void *);
const int batchSize = 50; // Check with SHARED_SPACE_SIZE
int init_library(void)
{