Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] do not rely on preprocessor constants to control what is traced (part 1)
[simgrid.git] / src / instr / instr_msg_volume.c
1 /* Copyright (c) 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5   * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "instr/instr_private.h"
8
9 #ifdef HAVE_TRACING
10
11 void TRACE_msg_volume_start(m_task_t task)
12 {
13   m_process_t process = NULL;
14   m_host_t host = NULL;
15   char process_name[200], process_alias[200];
16   char task_name[200];
17   double volume = 0;
18   if (!TRACE_msg_volume_is_enabled())
19     return;
20
21   /* check if task is traced */
22   if (!IS_TRACED(task))
23     return;
24
25   /* check if process is traced */
26   process = MSG_process_self();
27   if (!IS_TRACED(process))
28     return;
29
30   host = MSG_process_get_host(process);
31   TRACE_process_container(process, process_name, 200);
32   TRACE_process_alias_container(process, host, process_alias, 200);
33   TRACE_task_container(task, task_name, 200);
34
35   volume = MSG_task_get_data_size(task);
36
37   pajeStartLinkWithVolume(MSG_get_clock(), "volume", "0", task->category,
38                           process_alias, task_name, volume);
39 }
40
41 void TRACE_msg_volume_finish(m_task_t task)
42 {
43   char process_name[200], process_alias[200];
44   char task_name[200];
45   m_process_t process = NULL;
46   m_host_t host = NULL;
47   if (!TRACE_msg_volume_is_enabled())
48     return;
49
50   /* check if task is traced */
51   if (!IS_TRACED(task))
52     return;
53
54   /* check if process is traced */
55   process = MSG_process_self();
56   if (!IS_TRACED(process))
57     return;
58
59   host = MSG_process_get_host(process);
60   TRACE_process_container(process, process_name, 200);
61   TRACE_process_alias_container(process, host, process_alias, 200);
62   TRACE_task_container(task, task_name, 200);
63
64   pajeEndLink(MSG_get_clock(), "volume", "0", task->category,
65               process_alias, task_name);
66 }
67
68 #endif /* HAVE_TRACING */