Logo AND Algorithmique Numérique Distribuée

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