Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new tracing mask TRACE_VOLUME to trace the msg tasks communication size and group...
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 23 Apr 2010 15:51:30 +0000 (15:51 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 23 Apr 2010 15:51:30 +0000 (15:51 +0000)
details:
- can be used to analyze how much data is exchanged among msg processes
- first use of paje links in simgrid trace file

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7640 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/src/CMakeDefinePackages.txt
include/instr/instr.h
src/instr/interface.c
src/instr/msg_process_instr.c
src/instr/msg_task_instr.c
src/instr/msg_volume.c [new file with mode: 0644]
src/instr/private.h

index 25d138f..a45bfc4 100755 (executable)
@@ -293,6 +293,7 @@ set(TRACING_SRC
        ${PROJECT_DIRECTORY}/src/instr/paje.c
        ${PROJECT_DIRECTORY}/src/instr/msg_task_instr.c
        ${PROJECT_DIRECTORY}/src/instr/msg_process_instr.c
+       ${PROJECT_DIRECTORY}/src/instr/msg_volume.c
        ${PROJECT_DIRECTORY}/src/instr/smx_instr.c
        ${PROJECT_DIRECTORY}/src/instr/surf_instr.c
        ${PROJECT_DIRECTORY}/src/instr/variables_instr.c
index 53a811f..4f3a2d8 100644 (file)
@@ -21,6 +21,7 @@
 #define TRACE_PLATFORM  1
 #define TRACE_PROCESS   2
 #define TRACE_TASK      4
+#define TRACE_VOLUME    8
 
 #include "xbt.h"
 #include "msg/msg.h"
index 3770cde..41c6d05 100644 (file)
@@ -52,7 +52,8 @@ int TRACE_start_with_mask(const char *filename, int mask) {
   /* checking mask */
   if (!(mask&TRACE_PLATFORM ||
       mask&TRACE_TASK ||
-      mask&TRACE_PROCESS)){
+      mask&TRACE_PROCESS ||
+      mask&TRACE_VOLUME)){
     THROW0 (tracing_error, TRACE_ERROR_MASK,
           "unknown tracing mask");
   }
@@ -80,13 +81,20 @@ int TRACE_start_with_mask(const char *filename, int mask) {
     pajeDefineVariableType ("latency", "LINK", "latency");
   }
 
-  if (IS_TRACING_PROCESSES){
+  if (IS_TRACING_PROCESSES || IS_TRACING_VOLUME){
     //processes grouped by host
     pajeDefineContainerType("PROCESS", "HOST", "PROCESS");
+  }
+
+  if (IS_TRACING_PROCESSES){
     pajeDefineStateType("category", "PROCESS", "category");
     pajeDefineStateType("presence", "PROCESS", "presence");
   }
 
+  if (IS_TRACING_VOLUME){
+    pajeDefineLinkType ("volume", "0", "PROCESS", "PROCESS", "volume");
+  }
+
   if (IS_TRACING_TASKS){
     //tasks grouped by host
     pajeDefineContainerType("TASK", "HOST", "TASK");
index bf67050..e4e361b 100644 (file)
@@ -23,7 +23,7 @@ void __TRACE_msg_process_init (void)
 
 void __TRACE_msg_process_location (m_process_t process)
 {
-  if (!IS_TRACING_PROCESSES) return;
+  if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME)) return;
 
   char name[200], alias[200];
   m_host_t host = MSG_process_get_host (process);
@@ -33,7 +33,7 @@ void __TRACE_msg_process_location (m_process_t process)
   //check if process_alias container is already created
   if (!xbt_dict_get_or_null (process_containers, alias)){
     pajeCreateContainer (MSG_get_clock(), alias, "PROCESS", MSG_host_get_name(host), name);
-    pajeSetState (MSG_get_clock(), "category", alias, process->category);
+    if (IS_TRACING_PROCESSES) pajeSetState (MSG_get_clock(), "category", alias, process->category);
     xbt_dict_set (process_containers, xbt_strdup(alias), xbt_strdup("1"), xbt_free);
   }
 }
@@ -76,7 +76,7 @@ void TRACE_msg_set_process_category (m_process_t process, const char *category)
  */
 void TRACE_msg_process_change_host (m_process_t process, m_host_t old_host, m_host_t new_host)
 {
-  if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
+  if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME) || !IS_TRACED(process)) return;
 
   //disabling presence in old_host (__TRACE_msg_process_not_present)
   char alias[200];
index 4f294a8..96ab84e 100644 (file)
@@ -173,6 +173,8 @@ void TRACE_msg_task_get_end (double start_time, m_task_t task)
   TRACE_task_container (task, name, 200);
   if (IS_TRACING_TASKS) pajePopState (MSG_get_clock(), "task-state", name);
 
+  __TRACE_msg_volume_finish (task);
+
   __TRACE_task_location (task);
   __TRACE_task_location_present (task);
 }
@@ -187,6 +189,8 @@ int TRACE_msg_task_put_start (m_task_t task)
   if (IS_TRACING_TASKS) pajePopState (MSG_get_clock(), "task-state", name);
   if (IS_TRACING_TASKS) pajePushState (MSG_get_clock(), "task-state", name, "communicate");
 
+  __TRACE_msg_volume_start (task);
+
   //trace task location grouped by host
   __TRACE_task_location_not_present (task);
 
diff --git a/src/instr/msg_volume.c b/src/instr/msg_volume.c
new file mode 100644 (file)
index 0000000..eafa26a
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * msg_volume.c
+ *
+ *  Created on: April 23, 2010
+ *      Author: Lucas Schnorr
+ *     License: This program is free software; you can redistribute
+ *              it and/or modify it under the terms of the license
+ *              (GNU LGPL) which comes with this package.
+ *
+ *     Copyright (c) 2009 The SimGrid team.
+ */
+
+#include "instr/private.h"
+
+#ifdef HAVE_TRACING
+
+void __TRACE_msg_volume_start (m_task_t task)
+{
+  if (!IS_TRACING_VOLUME) return;
+
+  /* check if task is traced */
+  if (!IS_TRACED(task)) return;
+
+  /* check if process is traced */
+  m_process_t process = MSG_process_self ();
+  if (!IS_TRACED(process)) return;
+
+  char process_name[200], process_alias[200];
+  m_host_t host = MSG_process_get_host (process);
+  TRACE_process_container (process, process_name, 200);
+  TRACE_process_alias_container (process, host, process_alias, 200);
+  char task_name[200];
+  TRACE_task_container (task, task_name, 200);
+
+  double volume = MSG_task_get_data_size (task);
+
+  pajeStartLinkWithVolume (MSG_get_clock(), "volume", "0", task->category, process_alias, task_name, volume);
+}
+
+void __TRACE_msg_volume_finish (m_task_t task)
+{
+  if (!IS_TRACING_VOLUME) return;
+
+  /* check if task is traced */
+  if (!IS_TRACED(task)) return;
+
+  /* check if process is traced */
+  m_process_t process = MSG_process_self ();
+  if (!IS_TRACED(process)) return;
+
+  char process_name[200], process_alias[200];
+  m_host_t host = MSG_process_get_host (process);
+  TRACE_process_container (process, process_name, 200);
+  TRACE_process_alias_container (process, host, process_alias, 200);
+  char task_name[200];
+  TRACE_task_container (task, task_name, 200);
+
+  pajeEndLink (MSG_get_clock(), "volume", "0", task->category, process_alias, task_name);
+}
+
+#endif
index 2a5310b..b4ebdcf 100644 (file)
@@ -25,6 +25,7 @@ extern int trace_mask; /* declared in interface.c */
 #define IS_TRACING_TASKS      ((TRACE_TASK)&trace_mask)
 #define IS_TRACING_PLATFORM   ((TRACE_PLATFORM)&trace_mask)
 #define IS_TRACING_PROCESSES  ((TRACE_PROCESS)&trace_mask)
+#define IS_TRACING_VOLUME     ((TRACE_VOLUME)&trace_mask)
 
 #include "instr/instr.h"
 #include "msg/msg.h"
@@ -99,6 +100,10 @@ void TRACE_msg_process_sleep_in (m_process_t process); //called from msg/gos.c
 void TRACE_msg_process_sleep_out (m_process_t process);
 void TRACE_msg_process_end (m_process_t process);
 
+/* declaration of instrumentation functions from msg_volume.c */
+void __TRACE_msg_volume_start (m_task_t task);
+void __TRACE_msg_volume_finish (m_task_t task);
+
 /* from smx.c */
 void TRACE_smx_action_execute (smx_action_t act);
 void TRACE_smx_action_communicate (smx_action_t act, smx_process_t proc);