aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/dma-memcpy/dma_memcpy_main.c
blob: 029b22c6a24fa6d0428197be910884dd43a8ac78 (plain)
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
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "dma_memcpy.h"

#define MAX_SIZE 256 * 1024
#define START_SIZE 1024

int a[MAX_SIZE / sizeof(int)];
int b[MAX_SIZE / sizeof(int)];

void thread_entry(int cid, int nc)
{

	int copy_size = START_SIZE;

	fill(a, MAX_SIZE / sizeof(uint64_t));

	while (copy_size <= MAX_SIZE) {
		memcpy(b, a, MAX_SIZE);
		memset(b, 0, MAX_SIZE);
		printf("%d: ", copy_size);
		stats(asm volatile ("fence"); dma_memcpy(b, a, copy_size) ; asm volatile ("fence"), 3);
		verify(copy_size / sizeof(int), b, a);
		copy_size *= 2;
	}

	exit(0);
}