Explorar o código

Do not include worker initialization in profiling

Samuel Thibault %!s(int64=9) %!d(string=hai) anos
pai
achega
95628fd942
Modificáronse 3 ficheiros con 11 adicións e 3 borrados
  1. 2 0
      src/core/workers.c
  2. 5 2
      src/profiling/profiling.c
  3. 4 1
      src/profiling/profiling.h

+ 2 - 0
src/core/workers.c

@@ -1248,6 +1248,8 @@ int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)
 
 	_starpu_watchdog_init();
 
+	_starpu_profiling_start();
+
 	STARPU_PTHREAD_MUTEX_LOCK(&init_mutex);
 	initialized = INITIALIZED;
 	/* Tell everybody that we initialized */

+ 5 - 2
src/profiling/profiling.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2013  Université de Bordeaux
+ * Copyright (C) 2010-2013, 2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -109,14 +109,17 @@ int starpu_profiling_status_set(int status)
 
 void _starpu_profiling_init(void)
 {
-	const char *env;
 	int worker;
 
 	for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
 	{
 		STARPU_PTHREAD_MUTEX_INIT(&worker_info_mutex[worker], NULL);
 	}
+}
 
+void _starpu_profiling_start(void)
+{
+	const char *env;
 	if ((env = starpu_getenv("STARPU_PROFILING")) && atoi(env))
 	{
 		starpu_profiling_status_set(STARPU_PROFILING_ENABLE);

+ 4 - 1
src/profiling/profiling.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012, 2014  Université de Bordeaux
+ * Copyright (C) 2010-2012, 2014, 2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -68,6 +68,9 @@ void _starpu_profiling_set_task_push_end_time(struct starpu_task *task);
 /* This function needs to be called before other starpu_profile_* functions */
 void _starpu_profiling_init(void);
 
+/* This function starts profiling if the STARPU_PROFILING environment variable was set */
+void _starpu_profiling_start(void);
+
 void _starpu_profiling_terminate(void);
 void _starpu_profiling_reset_counters();