瀏覽代碼

Add events to see where profiling starts and stops

Samuel Thibault 11 年之前
父節點
當前提交
ce7007a3c3
共有 4 個文件被更改,包括 38 次插入5 次删除
  1. 9 4
      examples/cholesky/cholesky_implicit.c
  2. 3 1
      src/common/fxt.c
  3. 5 0
      src/common/fxt.h
  4. 21 0
      src/debug/traces/starpu_fxt.c

+ 9 - 4
examples/cholesky/cholesky_implicit.c

@@ -41,10 +41,12 @@ static int _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 
 	int prio_level = noprio?STARPU_DEFAULT_PRIO:STARPU_MAX_PRIO;
 
-	start = starpu_timing_now();
-
 	if (bound || bound_lp || bound_mps)
 		starpu_bound_start(bound_deps, 0);
+	starpu_fxt_start_profiling();
+
+	start = starpu_timing_now();
+
 	/* create all the DAG nodes */
 	for (k = 0; k < nblocks; k++)
 	{
@@ -94,11 +96,13 @@ static int _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 	}
 
 	starpu_task_wait_for_all();
-	if (bound || bound_lp || bound_mps)
-		starpu_bound_stop();
 
 	end = starpu_timing_now();
 
+	starpu_fxt_stop_profiling();
+	if (bound || bound_lp || bound_mps)
+		starpu_bound_stop();
+
 	double timing = end - start;
 
 	double flop = FLOPS_SPOTRF(n);
@@ -296,6 +300,7 @@ int main(int argc, char **argv)
 
 	int ret;
 	ret = starpu_init(NULL);
+	starpu_fxt_stop_profiling();
 
 	if (ret == -ENODEV)
                 return 77;

+ 3 - 1
src/common/fxt.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2013  Université de Bordeaux 1
+ * Copyright (C) 2009-2014  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -107,11 +107,13 @@ void starpu_fxt_start_profiling()
 {
 	unsigned threadid = _starpu_gettid();
 	fut_keychange(FUT_ENABLE, FUT_KEYMASKALL, threadid);
+	_STARPU_TRACE_EVENT("start_profiling");
 }
 
 void starpu_fxt_stop_profiling()
 {
 	unsigned threadid = _starpu_gettid();
+	_STARPU_TRACE_EVENT("stop_profiling");
 	fut_keychange(FUT_DISABLE, FUT_KEYMASKALL, threadid);
 }
 

+ 5 - 0
src/common/fxt.h

@@ -105,6 +105,8 @@
 
 #define _STARPU_FUT_TASK_WAIT_FOR_ALL	0x513b
 
+#define _STARPU_FUT_EVENT	0x513c
+
 #define _STARPU_FUT_LOCKING_MUTEX	0x5140	
 #define _STARPU_FUT_MUTEX_LOCKED	0x5141	
 
@@ -459,6 +461,9 @@ do {										\
 #define _STARPU_TRACE_TASK_WAIT_FOR_ALL			\
 	FUT_DO_PROBE0(_STARPU_FUT_TASK_WAIT_FOR_ALL)
 
+#define _STARPU_TRACE_EVENT(S)			\
+	FUT_DO_PROBESTR(_STARPU_FUT_EVENT,S)
+
 #define _STARPU_TRACE_HYPERVISOR_BEGIN()  \
 	FUT_DO_PROBE1(_STARPU_FUT_HYPERVISOR_BEGIN, _starpu_gettid());
 

+ 21 - 0
src/debug/traces/starpu_fxt.c

@@ -1294,6 +1294,23 @@ static void handle_task_wait_for_all(void)
 	_starpu_fxt_dag_add_sync_point();
 }
 
+static void handle_event(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
+{
+	char *event = (char*)&ev->param[0];
+
+	/* Add an event in the trace */
+	if (out_paje_file)
+	{
+#ifdef STARPU_HAVE_POTI
+		char container[STARPU_POTI_STR_LEN];
+		snprintf(container, STARPU_POTI_STR_LEN, "%sp", options->file_prefix);
+		poti_NewEvent(get_event_time_stamp(ev, options), container, "event", event);
+#else
+		fprintf(out_paje_file, "9	%.9f	event	%sp	%s\n", get_event_time_stamp(ev, options), options->file_prefix, event);
+#endif
+	}
+}
+
 static
 void _starpu_fxt_display_bandwidth(struct starpu_fxt_options *options)
 {
@@ -1691,6 +1708,10 @@ void starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *opt
 				handle_task_wait_for_all();
 				break;
 
+			case _STARPU_FUT_EVENT:
+				handle_event(&ev, options);
+				break;
+
 			case _STARPU_FUT_LOCKING_MUTEX:
 				break;