Bläddra i källkod

starpu-top: rename types following coding conventions

Nathalie Furmento 13 år sedan
förälder
incheckning
d2ab227daa

+ 1 - 1
doc/chapters/perf-feedback.texi

@@ -165,7 +165,7 @@ starpu_top_register_parameter_float("alpha", &alpha, 0, 10, modif_hook);
 @code{modif_hook} is a function which will be called when the parameter is being modified, it can for instance print the new value:
 
 @example
-void modif_hook(struct starpu_top_param_t *d) @{
+void modif_hook(struct starpu_top_param *d) @{
     fprintf(stderr,"%s has been modified: %f\n", d->name, alpha);
 @}
 @end example

+ 2 - 2
examples/stencil/stencil.c

@@ -37,8 +37,8 @@ static unsigned sizez = 64*SIZE;
 unsigned nbz = 64;
 
 /* StarPU top variables */
-starpu_top_data* starpu_top_init_loop;
-starpu_top_data* starpu_top_achieved_loop;
+struct starpu_top_data* starpu_top_init_loop;
+struct starpu_top_data* starpu_top_achieved_loop;
 
 /*
  *	Initialization

+ 2 - 2
examples/stencil/stencil.h

@@ -45,8 +45,8 @@ extern void life_update(int bz, const TYPE *old, TYPE *newp, int nx, int ny, int
 #define K	1
 
 #define NDIRS 2
-extern starpu_top_data* starpu_top_init_loop;
-extern starpu_top_data* starpu_top_achieved_loop;
+extern struct starpu_top_data* starpu_top_init_loop;
+extern struct starpu_top_data* starpu_top_achieved_loop;
 
 
 /* Split only on the z axis to make things simple */

+ 24 - 24
examples/top/hello_world_top.c

@@ -80,14 +80,14 @@ void cpu_func(void *buffers[], void *cl_arg)
 			sum);
 }
 
-void callback_name_changed(starpu_top_param* param)
+void callback_name_changed(struct starpu_top_param* param)
 {
 	char* message = (char *) malloc(256);
 	sprintf(message, "Name have been changed to %s", names[name_selected]);
 	starpu_top_debug_log(message);
 }
 
-void callback_number_addition_changed(starpu_top_param* param)
+void callback_number_addition_changed(struct starpu_top_param* param)
 {
 	char* message = (char *) malloc(256);
 	sprintf(message, "Number of addition is now %d", number_of_addition);
@@ -116,30 +116,30 @@ int main(int argc, char **argv)
 
 
 	/*init starpu_top*/
-	starpu_top_data * loop_count =
-			starpu_top_add_data_integer("Loop count", 0,124,1);
-	starpu_top_data * remain_count =
-			starpu_top_add_data_integer("Remaining loop", 0,124,1);
-	starpu_top_data * midle_reach =
-			starpu_top_add_data_boolean("Midle reached", 1);
-	starpu_top_param* name =
-			starpu_top_register_parameter_enum("Your name : ",
-											&name_selected,
-											names,
-											names_len,
-											callback_name_changed);
-	starpu_top_param * number_of_addition_param =
-			starpu_top_register_parameter_integer("Number of Millions of addition",
-							     &number_of_addition,
-							     0,
-							     50,
-							     callback_number_addition_changed);
+	struct starpu_top_data * loop_count =
+		starpu_top_add_data_integer("Loop count", 0,124,1);
+	struct starpu_top_data * remain_count =
+		starpu_top_add_data_integer("Remaining loop", 0,124,1);
+	struct starpu_top_data * midle_reach =
+		starpu_top_add_data_boolean("Midle reached", 1);
+	struct starpu_top_param* name =
+		starpu_top_register_parameter_enum("Your name : ",
+						   &name_selected,
+						   names,
+						   names_len,
+						   callback_name_changed);
+	struct starpu_top_param * number_of_addition_param =
+		starpu_top_register_parameter_integer("Number of Millions of addition",
+						      &number_of_addition,
+						      0,
+						      50,
+						      callback_number_addition_changed);
 	STARPU_ASSERT(number_of_addition_param != NULL);
 
-	starpu_top_param * stop5_param =
-			starpu_top_register_parameter_boolean("Stop after 5 task ?",
-							     &stop_after_5_task,
-							     NULL);
+	struct starpu_top_param * stop5_param =
+		starpu_top_register_parameter_boolean("Stop after 5 task ?",
+						      &stop_after_5_task,
+						      NULL);
 	STARPU_ASSERT(stop5_param != NULL);
 
 

+ 75 - 94
include/starpu_top.h

@@ -26,16 +26,13 @@
 extern "C" {
 #endif
 
- 
-typedef enum
-{
+enum starpu_top_data_type {
 	STARPU_TOP_DATA_BOOLEAN,
 	STARPU_TOP_DATA_INTEGER,
 	STARPU_TOP_DATA_FLOAT
-} starpu_top_data_type;
+};
 
-typedef struct starpu_top_data_t
-{
+struct starpu_top_data {
 	unsigned int id;
 	const char* name;
 	int int_min_value;
@@ -43,47 +40,43 @@ typedef struct starpu_top_data_t
 	double double_min_value;
 	double double_max_value;
 	int active;
-	starpu_top_data_type type;
-	struct starpu_top_data_t * next;
-} starpu_top_data;
+	enum starpu_top_data_type type;
+	struct starpu_top_data * next;
+};
 
-typedef enum
-{
+enum starpu_top_param_type {
 	STARPU_TOP_PARAM_BOOLEAN,
 	STARPU_TOP_PARAM_INTEGER,
 	STARPU_TOP_PARAM_FLOAT,
 	STARPU_TOP_PARAM_ENUM
-} starpu_top_param_type;
+};
 
-typedef struct starpu_top_param_t
-{
+struct starpu_top_param {
 	unsigned int id;
 	const char* name;
-	starpu_top_param_type type;
+	enum starpu_top_param_type type;
 	void* value;
 	char** enum_values; /* only for enum type can be NULL */
 	int nb_values;
-	void (*callback)(struct starpu_top_param_t*);
+	void (*callback)(struct starpu_top_param*);
 	int int_min_value; /* only for integer type */
 	int int_max_value;
 	double double_min_value; /*only for double type */
 	double double_max_value;
-	struct starpu_top_param_t * next;
-} starpu_top_param;
+	struct starpu_top_param * next;
+};
 
-typedef enum
-{
+enum starpu_top_message_type {
 	TOP_TYPE_GO,
 	TOP_TYPE_SET,
 	TOP_TYPE_CONTINUE,
 	TOP_TYPE_ENABLE,
 	TOP_TYPE_DISABLE,
 	TOP_TYPE_DEBUG,
-	TOP_TYPE_UNKNOW	
-} starpu_top_message_type;
+	TOP_TYPE_UNKNOW
+};
 
-
-/* 
+/*
  * This function returns 1 if starpu_top is initialized. 0 otherwise.
  */
 int starpu_top_status_get();
@@ -96,52 +89,49 @@ int starpu_top_status_get();
  * If active=0, the value will NOT be displayed to user by default.
  * Any other value will make the value displayed by default.
 */
-starpu_top_data * starpu_top_add_data_boolean(
-			const char* data_name,
-			int active);
+struct starpu_top_data *starpu_top_add_data_boolean(const char* data_name,
+						    int active);
 /*
  * This fonction register a data named data_name of type integer
  * The minimum and maximum value will be usefull to define the scale in UI
  * If active=0, the value will NOT be displayed to user by default.
  * Any other value will make the value displayed by default.
 */
-starpu_top_data * starpu_top_add_data_integer(
-			const char* data_name, 
-			int minimum_value, 
-			int maximum_value, 
-			int active);
+struct starpu_top_data * starpu_top_add_data_integer(const char* data_name,
+						     int minimum_value,
+						     int maximum_value,
+						     int active);
 /*
  * This fonction register a data named data_name of type float
  * The minimum and maximum value will be usefull to define the scale in UI
  * If active=0, the value will NOT be displayed to user by default.
  * Any other value will make the value displayed by default.
 */
-starpu_top_data* starpu_top_add_data_float(const char* data_name, 
-			double minimum_value, 
-			double maximum_value, 
-			int active);
+struct starpu_top_data* starpu_top_add_data_float(const char* data_name,
+						  double minimum_value,
+						  double maximum_value,
+						  int active);
 
 /*
  * This fonction register a parameter named parameter_name, of type boolean.
- * The callback fonction will be called when the parameter is modified by UI, 
+ * The callback fonction will be called when the parameter is modified by UI,
  * and can be null.
 */
-starpu_top_param* starpu_top_register_parameter_boolean(
-			const char* param_name, 
-			int* parameter_field, 
-			void (*callback)(struct starpu_top_param_t*));
+struct starpu_top_param* starpu_top_register_parameter_boolean(const char* param_name,
+							       int* parameter_field,
+							       void (*callback)(struct starpu_top_param*));
 /*
  * This fonction register a parameter named param_name, of type integer.
  * Minimum and maximum value will be used to prevent user seting incorrect
  * value.
- * The callback fonction will be called when the parameter is modified by UI, 
+ * The callback fonction will be called when the parameter is modified by UI,
  * and can be null.
 */
-starpu_top_param* starpu_top_register_parameter_integer(const char* param_name, 
-			int* parameter_field, 
-			int minimum_value, 
-			int maximum_value,
-			void (*callback)(struct starpu_top_param_t*));
+struct starpu_top_param* starpu_top_register_parameter_integer(const char* param_name,
+							       int* parameter_field,
+							       int minimum_value,
+							       int maximum_value,
+							       void (*callback)(struct starpu_top_param*));
 /*
  * This fonction register a parameter named param_name, of type float.
  * Minimum and maximum value will be used to prevent user seting incorrect
@@ -149,12 +139,11 @@ starpu_top_param* starpu_top_register_parameter_integer(const char* param_name,
  * The callback fonction will be called when the parameter is modified by UI,
  * and can be null.
 */
-starpu_top_param* starpu_top_register_parameter_float(
-			const char* param_name, 
-			double* parameter_field, 
-			double minimum_value, 
-			double maximum_value, 
-			void (*callback)(struct starpu_top_param_t*));
+struct starpu_top_param* starpu_top_register_parameter_float(const char* param_name,
+							     double* parameter_field,
+							     double minimum_value,
+							     double maximum_value,
+							     void (*callback)(struct starpu_top_param*));
 
 /*
  * This fonction register a parameter named param_name, of type enum.
@@ -163,12 +152,11 @@ starpu_top_param* starpu_top_register_parameter_float(
  * The callback fonction will be called when the parameter is modified by UI,
  * and can be null.
 */
-starpu_top_param* starpu_top_register_parameter_enum(
-			const char* param_name, 
-			int* parameter_field, 
-			char** values,
-			int nb_values, 
-			void (*callback)(struct starpu_top_param_t*));
+struct starpu_top_param* starpu_top_register_parameter_enum(const char* param_name,
+							    int* parameter_field,
+							    char** values,
+							    int nb_values,
+							    void (*callback)(struct starpu_top_param*));
 
 
 
@@ -192,57 +180,50 @@ void starpu_top_init_and_wait(const char* server_name);
  * This function should be called after every modification
  * of a parameter from something other than starpu_top.
  * This fonction notice UI that the configuration changed
- */ 
-void starpu_top_update_parameter(const starpu_top_param* param);
+ */
+void starpu_top_update_parameter(const struct starpu_top_param* param);
 
 /*
  * This functions update the value of the starpu_top_data on UI
  */
-void starpu_top_update_data_boolean(
-			const starpu_top_data* data, 
-			int value);
-void starpu_top_update_data_integer(
-			const starpu_top_data* data, 
-			int value);
-void starpu_top_update_data_float(
-			const starpu_top_data* data, 
-			double value);
+void starpu_top_update_data_boolean(const struct starpu_top_data* data,
+				    int value);
+void starpu_top_update_data_integer(const struct starpu_top_data* data,
+				    int value);
+void starpu_top_update_data_float(const struct starpu_top_data* data,
+				  double value);
 
 /*
  * This functions notify UI than the task has started or ended
  */
-void starpu_top_task_started(
-			struct starpu_task *task, 
-			int devid, 
-			const struct timespec* ts);
-void starpu_top_task_ended(
-			struct starpu_task *task, 
-			int devid, 
-			const struct timespec* ts );
+void starpu_top_task_started(struct starpu_task *task,
+			     int devid,
+			     const struct timespec* ts);
+void starpu_top_task_ended(struct starpu_task *task,
+			   int devid,
+			   const struct timespec* ts );
 /*
- * This functions notify UI than the task have been planed to 
+ * This functions notify UI than the task have been planed to
  * run from timestamp_begin to timestamp_end, on computation-core
  */
-void starpu_top_task_prevision_timespec(
-			struct starpu_task *task, 
-			int devid, 
-			const struct timespec* start, 
-			const struct timespec* end);
-void starpu_top_task_prevision(
-			struct starpu_task *task, 
-			int devid, unsigned long long start, 
-			unsigned long long end);
+void starpu_top_task_prevision_timespec(struct starpu_task *task,
+					int devid,
+					const struct timespec* start,
+					const struct timespec* end);
+void starpu_top_task_prevision(struct starpu_task *task,
+			       int devid, unsigned long long start,
+			       unsigned long long end);
+
 
- 
 /*
  * This functions are usefull in debug mode. The starpu developper doesn't need
  * to check if the debug mode is active.
  * This is checked by starpu_top itsefl.
- * 
+ *
  * top_debug_log just send a message to display by UI
- * top_debug_lock send a message and wait for a continue message from UI 
+ * top_debug_lock send a message and wait for a continue message from UI
  * to return
- * 
+ *
  * The lock (wich create a stop-point) should be called only by the main thread.
  * Calling it from more than one thread is not supported.
  */
@@ -254,8 +235,8 @@ void starpu_top_debug_lock(const char* message);
 *****************************************************/
 
 void starpu_top_process_input_message(char *message);
-	
-	
+
+
 
 
 #ifdef __cplusplus

+ 1 - 1
src/sched_policies/heft.c

@@ -51,7 +51,7 @@ const float gamma_maximum=10000.0;
 const float idle_power_minimum=0;
 const float idle_power_maximum=10000.0;
 
-static void param_modified(struct starpu_top_param_t* d){
+static void param_modified(struct starpu_top_param* d){
 	//just to show parameter modification
 	fprintf(stderr,"%s has been modified : alpha=%f|beta=%f|gamma=%f|idle_power=%f !\n", 
 		d->name, alpha,beta,_gamma,idle_power);

+ 97 - 99
src/top/starpu_top.c

@@ -27,15 +27,15 @@
 #include <pthread.h>
 #include <common/timing.h>
 
-extern starpu_top_message_queue_t*  starpu_top_mt;
+extern struct starpu_top_message_queue*  starpu_top_mt;
 int starpu_top = 0;
 int starpu_top_debug_on = 0;
 unsigned int starpu_top_data_cpt = 0;
 unsigned int starpu_top_param_cpt = 0;
-starpu_top_data* starpu_top_first_data = NULL;
-starpu_top_param* starpu_top_first_param = NULL;
-starpu_top_data** starpu_top_datas;
-starpu_top_param** starpu_top_params;
+struct starpu_top_data* starpu_top_first_data = NULL;
+struct starpu_top_param* starpu_top_first_param = NULL;
+struct starpu_top_data** starpu_top_datas;
+struct starpu_top_param** starpu_top_params;
 
 sem_t starpu_top_wait_for_go;
 pthread_mutex_t starpu_top_wait_for_continue_mutex;
@@ -53,8 +53,8 @@ unsigned long long int current_timestamp();
 *****************INIT FUNC********************
 **********************************************/
 
-char *message_for_topdata_init(starpu_top_data* data);
-char *message_for_topparam_init(starpu_top_param* param);
+char *message_for_topdata_init(struct starpu_top_data* data);
+char *message_for_topparam_init(struct starpu_top_param* param);
 
 /*
  * we store data and param in a tab to offer a O(1) access when the program  is
@@ -64,8 +64,8 @@ void copy_data_and_param()
 {
 	printf("%s:%d trace\n", __FILE__, __LINE__);
 	//copying datas
-	starpu_top_datas = (starpu_top_data **) malloc(starpu_top_data_cpt*sizeof(starpu_top_data*));
-	starpu_top_data* cur = starpu_top_first_data;
+	starpu_top_datas = (struct starpu_top_data **) malloc(starpu_top_data_cpt*sizeof(struct starpu_top_data*));
+	struct starpu_top_data* cur = starpu_top_first_data;
 	unsigned int i = 0;
 	for(i = 0; i < starpu_top_data_cpt; i++)
 	{
@@ -73,8 +73,8 @@ void copy_data_and_param()
 		cur = cur->next;
 	}
 	//copying params
-	starpu_top_params = (starpu_top_param **) malloc(starpu_top_param_cpt*sizeof(starpu_top_param*));
-	starpu_top_param* cur2 = starpu_top_first_param;
+	starpu_top_params = (struct starpu_top_param **) malloc(starpu_top_param_cpt*sizeof(struct starpu_top_param*));
+	struct starpu_top_param* cur2 = starpu_top_first_param;
 	for(i = 0; i < starpu_top_param_cpt; i++)
 	{
 		starpu_top_params[i] = cur2;
@@ -98,7 +98,7 @@ static void starpu_top_get_device_type(int id, char* type){
 	case STARPU_GORDON_WORKER:
 		strncpy(type, "GORDON",9);
 		break;
-	}  
+	}
 }
 
 static void starpu_top_send_devices_info()
@@ -116,21 +116,21 @@ static void starpu_top_send_devices_info()
 		starpu_top_get_device_type(i,dev_type);
 		starpu_worker_get_name(i, dev_name,64);
 		snprintf(message, 128, "%u;%s;%s\n", i, dev_type, dev_name);
-		starpu_top_message_add(starpu_top_mt,message);    
+		starpu_top_message_add(starpu_top_mt,message);
 	}
 
-	message=(char*)malloc(6*sizeof(char));                             
-	snprintf(message,6,"/DEV\n");                
-	starpu_top_message_add(starpu_top_mt,message);  
+	message=(char*)malloc(6*sizeof(char));
+	snprintf(message,6,"/DEV\n");
+	starpu_top_message_add(starpu_top_mt,message);
 }
 
 
 void starpu_top_init_and_wait(const char* server_name){
 	starpu_top=1;
 	sem_init(&starpu_top_wait_for_go,0,0);
-	
+
 	pthread_mutex_init(&starpu_top_wait_for_continue_mutex, NULL);
-	
+
 	//profiling activation
 	starpu_profiling_status_set(STARPU_PROFILING_ENABLE);
 
@@ -144,7 +144,7 @@ void starpu_top_init_and_wait(const char* server_name){
 
 	//sending server information (report to protocol)
 	char* message = (char *) malloc(strlen("SERVERINFO\n")+1);
-	sprintf(message, "%s", "SERVERINFO\n");  
+	sprintf(message, "%s", "SERVERINFO\n");
 	starpu_top_message_add(starpu_top_mt,message);
 	message = (char *) malloc(strlen(server_name)+2);
 	sprintf(message, "%s\n", server_name);
@@ -161,7 +161,7 @@ void starpu_top_init_and_wait(const char* server_name){
 	message = (char *) malloc(strlen("DATA\n")+1);
 	sprintf(message, "%s", "DATA\n");
 	starpu_top_message_add(starpu_top_mt,message);
-	starpu_top_data * cur_data = starpu_top_first_data;
+	struct starpu_top_data * cur_data = starpu_top_first_data;
 	while(cur_data != NULL)
 	{
 		starpu_top_message_add(starpu_top_mt,message_for_topdata_init(cur_data));
@@ -170,12 +170,12 @@ void starpu_top_init_and_wait(const char* server_name){
 	message = (char *) malloc(strlen("/DATA\n")+1);
 	sprintf(message, "%s", "/DATA\n");
 	starpu_top_message_add(starpu_top_mt,message);
-	
+
 	//sending parameter list
 	message = (char *) malloc(strlen("PARAMS\n")+1);
 	sprintf(message, "%s", "PARAMS\n");
 	starpu_top_message_add(starpu_top_mt,message);
-	starpu_top_param * cur_param = starpu_top_first_param;
+	struct starpu_top_param * cur_param = starpu_top_first_param;
 	printf("%s:%d sending parameters\n", __FILE__, __LINE__);
 	while(cur_param != NULL){
 	  starpu_top_message_add(starpu_top_mt,message_for_topparam_init(cur_param));
@@ -185,26 +185,26 @@ void starpu_top_init_and_wait(const char* server_name){
 	message = (char *) malloc(strlen("/PARAMS\n")+1);
 	sprintf(message, "%s", "/PARAMS\n");
 	starpu_top_message_add(starpu_top_mt,message);
-	
-	
+
+
 	//sending DEVICE list
 	printf("%s:%d sending devices info\n", __FILE__, __LINE__);
 	starpu_top_send_devices_info();
 	printf("%s:%d devices_info sended\n", __FILE__, __LINE__);
 	//copying data and params
 	copy_data_and_param();
-	
+
 	//sending READY message
 	message = (char *) malloc(strlen("READY\n")+1);
 	sprintf(message, "%s", "READY\n");
 	starpu_top_message_add(starpu_top_mt,message);
-	
+
 	//This threads keeps locked while we don't receive an GO message from UI
 	printf("%s:%d waiting for GO message\n", __FILE__, __LINE__);
 	sem_wait(&starpu_top_wait_for_go);
 }
 
-void starpu_top_enqueue_data(starpu_top_data * data)
+void starpu_top_enqueue_data(struct starpu_top_data * data)
 {
 	if(starpu_top_first_data == NULL)
 	{
@@ -212,18 +212,17 @@ void starpu_top_enqueue_data(starpu_top_data * data)
 	}
 	else
 	{
-		starpu_top_data * cur = starpu_top_first_data;
+		struct starpu_top_data * cur = starpu_top_first_data;
 		while(cur->next != NULL)
 			cur = cur->next;
 		cur->next = data;
 	}
 }
 
-starpu_top_data * starpu_top_add_data_boolean(
-			const char* data_name,
-			int active)
-{		
-	starpu_top_data * data = (starpu_top_data *) malloc(sizeof(starpu_top_data));
+struct starpu_top_data * starpu_top_add_data_boolean(const char* data_name,
+						     int active)
+{
+	struct starpu_top_data * data = (struct starpu_top_data *) malloc(sizeof(struct starpu_top_data));
 	data->id = starpu_top_data_cpt++;
 	data->name = data_name;
 	data->type = STARPU_TOP_DATA_BOOLEAN;
@@ -235,15 +234,14 @@ starpu_top_data * starpu_top_add_data_boolean(
 	return data;
 }
 
-starpu_top_data * starpu_top_add_data_integer(
-			const char* data_name,
-			int minimum_value,
-			int maximum_value,
-			int active)
-{	
-	starpu_top_data * data = (starpu_top_data *) malloc(sizeof(starpu_top_data));
+struct starpu_top_data * starpu_top_add_data_integer(const char* data_name,
+						     int minimum_value,
+						     int maximum_value,
+						     int active)
+{
+	struct starpu_top_data * data = (struct starpu_top_data *) malloc(sizeof(struct starpu_top_data));
 	data->id = starpu_top_data_cpt++;
-	data->name = data_name; 
+	data->name = data_name;
 	data->type = STARPU_TOP_DATA_INTEGER;
 	data->int_min_value = minimum_value;
 	data->int_max_value = maximum_value;
@@ -255,13 +253,12 @@ starpu_top_data * starpu_top_add_data_integer(
 	return data;
 }
 
-starpu_top_data* starpu_top_add_data_float(
-			const char* data_name,
-			double minimum_value,
-			double maximum_value,
-			int active)
+struct starpu_top_data* starpu_top_add_data_float(const char* data_name,
+						  double minimum_value,
+						  double maximum_value,
+						  int active)
 {
-	starpu_top_data * data = (starpu_top_data *) malloc(sizeof(starpu_top_data));
+	struct starpu_top_data * data = (struct starpu_top_data *) malloc(sizeof(struct starpu_top_data));
 	data->id = starpu_top_data_cpt++;
 	data->name = data_name;
 	data->type = STARPU_TOP_DATA_FLOAT;
@@ -275,7 +272,7 @@ starpu_top_data* starpu_top_add_data_float(
 	return data;
 }
 
-char *message_for_topdata_init(starpu_top_data* data)
+char *message_for_topdata_init(struct starpu_top_data* data)
 {
 	char*message = (char *) malloc(256+strlen(data->name));
 	switch(data->type)
@@ -309,7 +306,7 @@ char *message_for_topdata_init(starpu_top_data* data)
 	return message;
 }
 
-char *message_for_topparam_init(starpu_top_param* param)
+char *message_for_topparam_init(struct starpu_top_param* param)
 {
 	char*message = NULL;
 	int i;
@@ -354,7 +351,7 @@ char *message_for_topparam_init(starpu_top_param* param)
 				"ENUM;%d;%s;",
 				param->id,
 				param->name);
-		
+
 		//compute the begin of enums elements in message
 		char* cur = message+strlen(message);
 		//add each enum element
@@ -373,7 +370,7 @@ char *message_for_topparam_init(starpu_top_param* param)
 	return message;
 }
 
-void starpu_top_enqueue_param(starpu_top_param* param)
+void starpu_top_enqueue_param(struct starpu_top_param* param)
 {
 	if(starpu_top_first_param == NULL)
 	{
@@ -381,7 +378,7 @@ void starpu_top_enqueue_param(starpu_top_param* param)
 	}
 	else
 	{
-		starpu_top_param * cur = starpu_top_first_param;
+		struct starpu_top_param * cur = starpu_top_first_param;
 		while(cur->next != NULL)
 			cur = cur->next;
 		cur->next = param;
@@ -389,34 +386,33 @@ void starpu_top_enqueue_param(starpu_top_param* param)
 }
 
 
-starpu_top_param* starpu_top_register_parameter_boolean(
-			const char* param_name,
-			int* parameter_field,
-			void (*callback)(struct starpu_top_param_t*))
+struct starpu_top_param* starpu_top_register_parameter_boolean(const char* param_name,
+							       int* parameter_field,
+							       void (*callback)(struct starpu_top_param*))
 {
-    STARPU_ASSERT(!starpu_top_status_get());
-	starpu_top_param * param = (starpu_top_param *) malloc(sizeof(starpu_top_param));
+	STARPU_ASSERT(!starpu_top_status_get());
+	struct starpu_top_param * param = (struct starpu_top_param *) malloc(sizeof(struct starpu_top_param));
 	param->callback = callback;
 	param->name = param_name;
 	param->id = starpu_top_param_cpt++;
 	param->type = STARPU_TOP_PARAM_BOOLEAN;
 	param->value = (void*)parameter_field;
 	param->next = NULL;
-	
+
 	starpu_top_enqueue_param(param);
-	
+
 	return param;
 }
 
 
-starpu_top_param* starpu_top_register_parameter_integer(const char* param_name,
-			int* parameter_field,
-			int minimum_value,
-			int maximum_value,
-			void (*callback)(struct starpu_top_param_t*))
-{	
+struct starpu_top_param* starpu_top_register_parameter_integer(const char* param_name,
+							       int* parameter_field,
+							       int minimum_value,
+							       int maximum_value,
+							       void (*callback)(struct starpu_top_param*))
+{
 	STARPU_ASSERT(!starpu_top_status_get());
-	starpu_top_param * param = (starpu_top_param *) malloc(sizeof(starpu_top_param));
+	struct starpu_top_param * param = (struct starpu_top_param *) malloc(sizeof(struct starpu_top_param));
 	param->callback = callback;
 	param->name = param_name;
 	param->id = starpu_top_param_cpt++;
@@ -427,18 +423,17 @@ starpu_top_param* starpu_top_register_parameter_integer(const char* param_name,
 	param->next = NULL;
 
 	starpu_top_enqueue_param(param);
-	
+
 	return param;
 }
-starpu_top_param* starpu_top_register_parameter_float(
-			const char* param_name,
-			double* parameter_field,
-			double minimum_value,
-			double maximum_value,
-			void (*callback)(struct starpu_top_param_t*))
+struct starpu_top_param* starpu_top_register_parameter_float(const char* param_name,
+							     double* parameter_field,
+							     double minimum_value,
+							     double maximum_value,
+							     void (*callback)(struct starpu_top_param*))
 {
 	STARPU_ASSERT(!starpu_top_status_get());
-	starpu_top_param * param = (starpu_top_param *) malloc(sizeof(starpu_top_param));
+	struct starpu_top_param * param = (struct starpu_top_param *) malloc(sizeof(struct starpu_top_param));
 	param->callback = callback;
 	param->name = param_name;
 	param->id = starpu_top_param_cpt++;
@@ -453,15 +448,14 @@ starpu_top_param* starpu_top_register_parameter_float(
 	return param;
 }
 
-starpu_top_param* starpu_top_register_parameter_enum(
-			const char* param_name,
-			int* parameter_field,
-			char** values,
-			int nb_values,
-			void (*callback)(struct starpu_top_param_t*))
+struct starpu_top_param* starpu_top_register_parameter_enum(const char* param_name,
+							    int* parameter_field,
+							    char** values,
+							    int nb_values,
+							    void (*callback)(struct starpu_top_param*))
 {
 	STARPU_ASSERT(!starpu_top_status_get());
-	starpu_top_param * param = (starpu_top_param *) malloc(sizeof(starpu_top_param));
+	struct starpu_top_param * param = (struct starpu_top_param *) malloc(sizeof(struct starpu_top_param));
 	param->callback = callback;
 	param->name = param_name;
 	param->id = starpu_top_param_cpt++;
@@ -470,7 +464,7 @@ starpu_top_param* starpu_top_register_parameter_enum(
 	param->enum_values = values;
 	param->nb_values = nb_values;
 	param->next = NULL;
-	
+
 	starpu_top_enqueue_param(param);
 
 	return param;
@@ -479,7 +473,7 @@ starpu_top_param* starpu_top_register_parameter_enum(
 *****************UPDATE FUNC******************
 **********************************************/
 
-void starpu_top_update_data_boolean(const starpu_top_data* data, int value){
+void starpu_top_update_data_boolean(const struct starpu_top_data* data, int value) {
 	if (!starpu_top_status_get())
 		return;
 	if(data->active)
@@ -493,7 +487,8 @@ void starpu_top_update_data_boolean(const starpu_top_data* data, int value){
 		starpu_top_message_add(starpu_top_mt,message);
 	}
 }
-void starpu_top_update_data_integer(const starpu_top_data* data,int value){
+
+void starpu_top_update_data_integer(const struct starpu_top_data* data, int value){
 	if (!starpu_top_status_get())
 		return;
 	if(data->active)
@@ -507,7 +502,8 @@ void starpu_top_update_data_integer(const starpu_top_data* data,int value){
 		starpu_top_message_add(starpu_top_mt,message);
 	}
 }
-void starpu_top_update_data_float(const starpu_top_data* data, double value){
+
+void starpu_top_update_data_float(const struct starpu_top_data* data, double value){
 	if (!starpu_top_status_get())
 		return;
 	if(data->active)
@@ -520,7 +516,8 @@ void starpu_top_update_data_float(const starpu_top_data* data, double value){
 		starpu_top_message_add(starpu_top_mt,message);
 	}
 }
-void starpu_top_update_parameter(const starpu_top_param* param){
+
+void starpu_top_update_parameter(const struct starpu_top_param* param){
 	if (!starpu_top_status_get())
 		return;
 	char*message = (char *) malloc(50);
@@ -536,7 +533,7 @@ void starpu_top_update_parameter(const starpu_top_param* param){
 					*((int*)param->value),
 					current_timestamp());
 			break;
-		
+
 		case STARPU_TOP_PARAM_FLOAT:
 			sprintf(message,
 					"SET;%d;%f;%lld\n",
@@ -545,8 +542,8 @@ void starpu_top_update_parameter(const starpu_top_param* param){
 					current_timestamp());
 			break;
 	}
-	
-	starpu_top_message_add(starpu_top_mt,message);	
+
+	starpu_top_message_add(starpu_top_mt,message);
 }
 
 /*********************************************
@@ -560,7 +557,7 @@ void starpu_top_debug_log(const char* debug_message)
 		//length can be up to strlen*2, if message contains only unwanted chars
 		char * message = (char *) malloc(strlen(debug_message)*2+16);
 		sprintf(message,"MESSAGE;");
-		
+
 		//escape unwanted char : ; and \n
 		char* cur = message+8;
 		while(*debug_message!='\0')
@@ -581,6 +578,7 @@ void starpu_top_debug_log(const char* debug_message)
 		starpu_top_message_add(starpu_top_mt,message);
 	}
 }
+
 void starpu_top_debug_lock(const char* debug_message)
 {
 	if(starpu_top_debug_on)
@@ -611,8 +609,8 @@ void starpu_top_debug_lock(const char* debug_message)
 	}
 }
 
- 
- 
+
+
 /********************************************
  **************TIME FUNCTION****************
  *******************************************/
@@ -633,7 +631,7 @@ unsigned long long _starpu_top_timing_timespec_to_ms(const struct timespec *ts)
  **************INPUT PROCESSING**************
  *******************************************/
 
-starpu_top_message_type starpu_top_get_message_type(const char* message)
+enum starpu_top_message_type starpu_top_get_message_type(const char* message)
 {
 	if(!strncmp("GO\n", message,3))
 		return TOP_TYPE_GO;
@@ -647,7 +645,7 @@ starpu_top_message_type starpu_top_get_message_type(const char* message)
 		return TOP_TYPE_DISABLE;
 	else if(!strncmp("DEBUG;", message,6))
 		return TOP_TYPE_DEBUG;
-	else 
+	else
 		return TOP_TYPE_UNKNOW;
 }
 
@@ -671,7 +669,7 @@ void starpu_top_change_data_active(char* message, int active)
 void starpu_top_change_parameter_value(const char* message){
 	const char*tmp = strstr(message, ";")+1;
 	int param_id = atoi(tmp);
-	starpu_top_param* param = starpu_top_params[param_id];
+	struct starpu_top_param* param = starpu_top_params[param_id];
 	tmp = strstr(tmp+1,";")+1;
 	int* val_ptr_int;
 	double* val_ptr_double;
@@ -683,7 +681,7 @@ void starpu_top_change_parameter_value(const char* message){
 			val_ptr_int = (int*)param->value;
 			*val_ptr_int = atoi(tmp);
 		break;
-		
+
 		case STARPU_TOP_PARAM_FLOAT:
 			val_ptr_double = (double*)param->value;
 			*val_ptr_double = atof(tmp);
@@ -693,7 +691,7 @@ void starpu_top_change_parameter_value(const char* message){
 			val_ptr_int = (int*)param->value;
 			*val_ptr_int = atoi(tmp);
 		break;
-		
+
 	}
 	if(param->callback != NULL)
 		param->callback(param);
@@ -729,7 +727,7 @@ void starpu_top_debug_next_step()
 
 void starpu_top_process_input_message(char *buffer)
 {
-	starpu_top_message_type message_type = starpu_top_get_message_type(buffer);
+	enum starpu_top_message_type message_type = starpu_top_get_message_type(buffer);
 	switch(message_type)
 	{
 		case TOP_TYPE_GO:

+ 10 - 10
src/top/starpu_top_connection.c

@@ -40,7 +40,7 @@
 const char *STARPU_TOP_PORT = "2011";
 const int STARPU_TOP_BUFFER_SIZE=1024;
 
-extern starpu_top_message_queue_t*  starpu_top_mt;
+extern struct starpu_top_message_queue*  starpu_top_mt;
 
 //client socket after fopen
 FILE* starpu_top_socket_fd_read;
@@ -104,17 +104,17 @@ void starpu_top_communications_threads_launcher()
 	pthread_t to_ui;
 	pthread_attr_t threads_attr;
 
-  
+
 	//Connection to UI & Socket Initilization
 	printf("%s:%d Connection to UI initilization\n",__FILE__, __LINE__);
 	struct sockaddr_storage from;
 	struct addrinfo req, *ans;
 	int code;
 	req.ai_flags = AI_PASSIVE;
-	req.ai_family = PF_UNSPEC;            
+	req.ai_family = PF_UNSPEC;
 	req.ai_socktype = SOCK_STREAM;
-	req.ai_protocol = 0;  
-  
+	req.ai_protocol = 0;
+
 	if ((code = getaddrinfo(NULL, STARPU_TOP_PORT, &req, &ans)) != 0)
 	{
 		fprintf(stderr, " getaddrinfo failed %d\n", code);
@@ -140,7 +140,7 @@ void starpu_top_communications_threads_launcher()
 		perror("accept");
 		exit(EXIT_FAILURE);
 	}
-	
+
 	if ( (starpu_top_socket_fd_read=fdopen(starpu_top_socket_fd, "r")) == NULL)
 	{
 		perror("fdopen");
@@ -148,20 +148,20 @@ void starpu_top_communications_threads_launcher()
 	}
 
 	starpu_top_socket_fd=dup(starpu_top_socket_fd);
-	
+
 	if ((starpu_top_socket_fd_write=fdopen(starpu_top_socket_fd, "w")) == NULL)
 	{
 		perror("fdopen");
 		exit(EXIT_FAILURE);
 	}
-	
+
 	close(sock);
-	
+
 	//Threads creation
 	fprintf(stderr,"Threads Creation\n");
 	pthread_attr_init(&threads_attr);
 	pthread_attr_setdetachstate(&threads_attr, PTHREAD_CREATE_DETACHED);
-	
+
 	pthread_create(&from_ui, &threads_attr, message_from_ui, NULL);
 	pthread_create(&to_ui, &threads_attr, message_to_ui, NULL);
 }

+ 5 - 4
src/top/starpu_top_connection.h

@@ -25,16 +25,17 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-  extern starpu_top_message_queue_t*  starpu_top_mt;
+
+extern struct starpu_top_message_queue*  starpu_top_mt;
 
 /*
  * This function initialize the two communications threads.
  * It initializes the connection and then launches the threads.
  * The function wait the UI connection before launching the threads.
- * About mt : mt MUST be allocated before call. 
- * All messages in the queue are freed after used. 
+ * About mt : mt MUST be allocated before call.
+ * All messages in the queue are freed after used.
  */
-  void starpu_top_communications_threads_launcher();
+void starpu_top_communications_threads_launcher();
 
 #ifdef __cplusplus
 }

+ 9 - 10
src/top/starpu_top_message_queue.c

@@ -21,15 +21,14 @@
 #include  <stdlib.h>
 
 //this global queue is used both by API and by network threads
-starpu_top_message_queue_t*  starpu_top_mt = NULL;
+struct starpu_top_message_queue*  starpu_top_mt = NULL;
 
 
 /* Will always return the pointer to starpu_top_message_queue */
-starpu_top_message_queue_t* starpu_top_message_add(
-			starpu_top_message_queue_t* s,
-			char* msg)
+struct starpu_top_message_queue* starpu_top_message_add(struct starpu_top_message_queue* s,
+							char* msg)
 {
-	starpu_top_message_queue_item_t* p = (starpu_top_message_queue_item_t *) malloc( 1 * sizeof(*p) );
+	struct starpu_top_message_queue_item* p = (struct starpu_top_message_queue_item *) malloc( 1 * sizeof(*p) );
 	pthread_mutex_lock(&(s->mutex));
 	if( NULL == p )
 	{
@@ -67,11 +66,11 @@ starpu_top_message_queue_t* starpu_top_message_add(
 }
 
 //this is a queue and it is FIFO, so we will always remove the first element
-char* starpu_top_message_remove(starpu_top_message_queue_t* s)
+char* starpu_top_message_remove(struct starpu_top_message_queue* s)
 {
 	sem_wait(&(s->semaphore));
-	starpu_top_message_queue_item_t* h = NULL;
-	starpu_top_message_queue_item_t* p = NULL;
+	struct starpu_top_message_queue_item* h = NULL;
+	struct starpu_top_message_queue_item* p = NULL;
 
 	if( NULL == s )
 	{
@@ -94,9 +93,9 @@ char* starpu_top_message_remove(starpu_top_message_queue_t* s)
 }
 
 
-starpu_top_message_queue_t* starpu_top_message_queue_new(void)
+struct starpu_top_message_queue* starpu_top_message_queue_new(void)
 {
-	starpu_top_message_queue_t* p = (starpu_top_message_queue_t *) malloc( 1 * sizeof(*p));
+	struct starpu_top_message_queue* p = (struct starpu_top_message_queue *) malloc( 1 * sizeof(*p));
 	if( NULL == p )
 	{
 		fprintf(stderr, "LINE: %d, malloc() failed\n", __LINE__);

+ 10 - 12
src/top/starpu_top_message_queue.h

@@ -16,35 +16,33 @@
  */
 
 #include <sys/types.h>
-#include <semaphore.h> 
+#include <semaphore.h>
 #include <pthread.h>
 
 #ifndef __STARPU_TOP_MESSAGE_QUEUE_H__
 #define __STARPU_TOP_MESSAGE_QUEUE_H__
 
-typedef struct starpu_top_message_queue_item
+struct starpu_top_message_queue_item
 {
 	char *message;
 	struct starpu_top_message_queue_item* next;
-} starpu_top_message_queue_item_t;
+};
 
-typedef struct starpu_top_message_queue
+struct starpu_top_message_queue
 {
 	struct starpu_top_message_queue_item* head;
 	struct starpu_top_message_queue_item* tail;
 	sem_t semaphore;
 	pthread_mutex_t mutex;
-} starpu_top_message_queue_t;
+};
 
 
-starpu_top_message_queue_t *starpu_top_message_add(
-			starpu_top_message_queue_t*,
-			char*);
+struct starpu_top_message_queue *starpu_top_message_add(struct starpu_top_message_queue*,
+							char*);
 
-char* starpu_top_message_remove(starpu_top_message_queue_t*);
+char* starpu_top_message_remove(struct starpu_top_message_queue*);
 
-starpu_top_message_queue_t* starpu_top_message_queue_new();
-starpu_top_message_queue_t* starpu_top_message_queue_free(
-			starpu_top_message_queue_t*);
+struct starpu_top_message_queue* starpu_top_message_queue_new();
+struct starpu_top_message_queue* starpu_top_message_queue_free(struct starpu_top_message_queue*);
 
 #endif