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

#define MAX_SIZE 256 * 1024
#define START_SIZE 1024

void thread_entry(int cid, int nc)
{
	int a[MAX_SIZE / sizeof(int)];
	int b[MAX_SIZE / sizeof(int)];

	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);
}