[commtech] Make WORDS_PER_BUF indep of BUF_SIZE.
The number of data sent must be independent of the buffer size chosen by each algorithm.
This commit is contained in:
parent
b1316fb8a4
commit
7d7ad0c46a
|
@ -21,7 +21,7 @@
|
|||
#define MAX_BLOCK_ENTRIES (page_size / sizeof(void *))
|
||||
#define toString(x) doStringification(x)
|
||||
#define doStringification(x) #x
|
||||
#define WORDS_PER_BUF (BUF_SIZE / sizeof(uintptr_t))
|
||||
#define WORDS_PER_LINE (CACHE_LINE_SIZE / sizeof(uintptr_t))
|
||||
|
||||
|
||||
static long nb_bufs_sent = 0;
|
||||
|
@ -233,7 +233,7 @@ int analyse_options(int argc, char *argv[])
|
|||
do_calc = do_nocalc;
|
||||
end_calc = do_noend;
|
||||
}
|
||||
printf("buf size: %lu\n", WORDS_PER_BUF);
|
||||
printf("buf size: %lu\n", WORDS_PER_LINE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ void *producer(void *channel)
|
|||
}
|
||||
for(i = 0; i < nb_bufs_sent; i++) {
|
||||
//printf("[%p] Send %d new CACHE_LINE\n", (void *) pthread_self(), BUF_SIZE / CACHE_LINE_SIZE);
|
||||
for(j = 0; j < WORDS_PER_BUF; j++)
|
||||
for(j = 0; j < WORDS_PER_LINE; j++)
|
||||
send(do_calc());
|
||||
}
|
||||
if (end_calc())
|
||||
|
@ -333,7 +333,7 @@ void *consumer(void *channel)
|
|||
long long total_data_received = 0;
|
||||
void *data_buf[MAX_BLOCK_ENTRIES];
|
||||
|
||||
while (total_data_received < nb_bufs_sent * WORDS_PER_BUF)
|
||||
while (total_data_received < nb_bufs_sent * WORDS_PER_LINE)
|
||||
{
|
||||
int i;
|
||||
ssize_t nb_data_received;
|
||||
|
@ -351,7 +351,7 @@ void *consumer(void *channel)
|
|||
|
||||
for(i = 0; i < nb_bufs_sent; i++) {
|
||||
//printf("[%p] About to receive %d new cache line%s\n", (void *) pthread_self(), BUF_SIZE / CACHE_LINE_SIZE, (BUF_SIZE / CACHE_LINE_SIZE > 1) ? "s" : "");
|
||||
for(j = 0; j < WORDS_PER_BUF; j++)
|
||||
for(j = 0; j < WORDS_PER_LINE; j++)
|
||||
on_message(recv_one_data());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue