Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] adding comments to #endif's
[simgrid.git] / src / instr / instr_smx.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 static long long int counter = 0;       /* to uniquely identify simix actions */
12
13 void TRACE_smx_host_execute(smx_action_t act)
14 {
15   char *category = NULL;
16   if (!IS_TRACING)
17     return;
18
19   act->counter = counter++;
20   category = TRACE_category_get(SIMIX_process_self());
21   if (category) {
22     act->category = xbt_new(char, strlen(category) + 1);
23     strncpy(act->category, category, strlen(category) + 1);
24   }
25   TRACE_surf_resource_utilization_start(act);
26 }
27
28 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc)
29 {
30   char *category = NULL;
31   if (!IS_TRACING)
32     return;
33
34   act->counter = counter++;
35   category = TRACE_category_get(proc);
36   if (category) {
37     act->category = xbt_strdup(category);
38   }
39   TRACE_surf_resource_utilization_start(act);
40 }
41
42 void TRACE_smx_action_destroy(smx_action_t act)
43 {
44   if (!IS_TRACING)
45     return;
46
47   if (act->category) {
48     xbt_free(act->category);
49   }
50   TRACE_surf_resource_utilization_end(act);
51 }
52
53 #endif /* HAVE_TRACING */