Explorar o código

Enabling profiling resets the counters, even if the profiling was already enabled.

Cédric Augonnet %!s(int64=15) %!d(string=hai) anos
pai
achega
79a8173d16
Modificáronse 2 ficheiros con 7 adicións e 11 borrados
  1. 1 1
      include/starpu_profiling.h
  2. 6 10
      src/profiling/profiling.c

+ 1 - 1
include/starpu_profiling.h

@@ -46,7 +46,7 @@ struct starpu_worker_profiling_info {
  * - enable with STARPU_PROFILING_ENABLE
  * - disable with STARPU_PROFILING_DISABLE 
  * Negative return values indicate an error, otherwise the previous status is
- * returned. */
+ * returned. Calling this function resets the profiling measurements. */
 int starpu_profiling_status_set(int status);
 
 /* Return the current profiling status or a negative value in case there was an

+ 6 - 10
src/profiling/profiling.c

@@ -35,18 +35,14 @@ static int profiling = 0;
 int starpu_profiling_status_set(int status)
 {
 	int prev_value = profiling;
+	profiling = status;
 
-	if (prev_value != status)
+	/* If we enable profiling, we reset the counters. */
+	if (status == STARPU_PROFILING_ENABLE)
 	{
-		/* If we enable profiling, we reset the counters. */
-		if (status == STARPU_PROFILING_ENABLE)
-		{
-			int worker;
-			for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
-				_starpu_worker_reset_profiling_info(worker);
-		}
-	
-		profiling = status;
+		int worker;
+		for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
+			_starpu_worker_reset_profiling_info(worker);
 	}
 
 	return prev_value;