Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
85c7d5292b6d2f7d593f555c2e00b0a3600be523
[simgrid.git] / src / instr / general.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/private.h"
8
9
10 #ifdef HAVE_TRACING
11
12 char *TRACE_paje_msg_container(m_task_t task, char *host, char *output,
13                                int len)
14 {
15   if (output) {
16     snprintf(output, len, "msg-%p-%s-%lld", task, host, task->counter);
17     return output;
18   } else {
19     return NULL;
20   }
21 }
22
23 char *TRACE_paje_smx_container(smx_action_t action, int seqnumber,
24                                char *host, char *output, int len)
25 {
26   if (output) {
27     snprintf(output, len, "smx-%p-%d", action, seqnumber);
28     return output;
29   } else {
30     return NULL;
31   }
32 }
33
34 char *TRACE_paje_surf_container(void *action, int seqnumber, char *output,
35                                 int len)
36 {
37   if (output) {
38     snprintf(output, len, "surf-%p-%d", action, seqnumber);
39     return output;
40   } else {
41     return NULL;
42   }
43 }
44
45 char *TRACE_host_container(m_host_t host, char *output, int len)
46 {
47   if (output) {
48     snprintf(output, len, "%s", MSG_host_get_name(host));
49     return output;
50   } else {
51     return NULL;
52   }
53 }
54
55 char *TRACE_task_container(m_task_t task, char *output, int len)
56 {
57   if (output) {
58     snprintf(output, len, "%p-%lld", task, task->counter);
59     return output;
60   } else {
61     return NULL;
62   }
63 }
64
65 char *TRACE_process_container(m_process_t process, char *output, int len)
66 {
67   if (output) {
68     snprintf(output, len, "%s-%p", MSG_process_get_name(process), process);
69     return output;
70   } else {
71     return NULL;
72   }
73 }
74
75 char *TRACE_process_alias_container(m_process_t process, m_host_t host,
76                                     char *output, int len)
77 {
78   if (output) {
79     snprintf(output, len, "%p-%p", process, host);
80     return output;
81   } else {
82     return NULL;
83   }
84 }
85
86 char *TRACE_task_alias_container(m_task_t task, m_process_t process,
87                                  m_host_t host, char *output, int len)
88 {
89   if (output) {
90     snprintf(output, len, "%p-%lld-%p-%p", task, task->counter, process,
91              host);
92     return output;
93   } else {
94     return NULL;
95   }
96 }
97
98 #endif