Explorar o código

Initialize buffer to be written for testing disk bandwidth, to avoid any page fault cost, and please valgrind

Samuel Thibault %!s(int64=11) %!d(string=hai) anos
pai
achega
b74c9583ff
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/core/disk_ops/disk_stdio.c

+ 3 - 1
src/core/disk_ops/disk_stdio.c

@@ -293,7 +293,7 @@ get_stdio_bandwidth_between_disk_and_main_ram(unsigned node)
 	struct timeval end;
 	
 	srand (time (NULL)); 
-	char * buf = malloc(SIZE_DISK_MIN*sizeof(char));
+	char * buf = malloc(SIZE_DISK_MIN);
 	STARPU_ASSERT(buf != NULL);
 	
 	/* allocate memory */
@@ -303,6 +303,8 @@ get_stdio_bandwidth_between_disk_and_main_ram(unsigned node)
 		return 0;
 	struct starpu_stdio_obj * tmp = (struct starpu_stdio_obj *) mem;
 
+	memset(buf, 0, SIZE_DISK_MIN);
+
 	/* Measure upload slowness */
 	gettimeofday(&start, NULL);
 	for (iter = 0; iter < NITER; ++iter)