Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2b489c227b468150c71786e6907bd88337180bd2
[simgrid.git] / src / instr / instr_surf.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 #include "surf/surf_private.h"
9 #include "surf/network_gtnets_private.h"
10
11 #ifdef HAVE_TRACING
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_surf, instr, "Tracing Surf");
14
15 void TRACE_surf_alloc(void)
16 {
17   TRACE_surf_resource_utilization_alloc();
18 }
19
20 void TRACE_surf_release(void)
21 {
22   TRACE_surf_resource_utilization_release();
23 }
24
25 void TRACE_surf_host_set_power(double date, const char *resource, double power)
26 {
27   if (!TRACE_is_enabled())
28     return;
29
30   container_t container = PJ_container_get(resource);
31   type_t type = PJ_type_get ("power", container->type);
32   new_pajeSetVariable(date, container, type, power);
33 }
34
35 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth)
36 {
37   if (!TRACE_is_enabled())
38     return;
39
40   container_t container = PJ_container_get(resource);
41   type_t type = PJ_type_get ("bandwidth", container->type);
42   new_pajeSetVariable(date, container, type, bandwidth);
43 }
44
45 //FIXME: this function is not used (latency availability traces support exists in surf network models?)
46 void TRACE_surf_link_set_latency(double date, const char *resource, double latency)
47 {
48   if (!TRACE_is_enabled())
49     return;
50
51   container_t container = PJ_container_get(resource);
52   type_t type = PJ_type_get ("latency", container->type);
53   new_pajeSetVariable(date, container, type, latency);
54 }
55
56 /* to trace gtnets */
57 void TRACE_surf_gtnets_communicate(void *action, const char *src, const char *dst)
58 {
59   surf_action_network_GTNETS_t gtnets_action = (surf_action_network_GTNETS_t)action;
60   gtnets_action->src_name = xbt_strdup (src);
61   gtnets_action->dst_name = xbt_strdup (dst);
62 }
63
64 void TRACE_surf_gtnets_destroy(void *action)
65 {
66   surf_action_network_GTNETS_t gtnets_action = (surf_action_network_GTNETS_t)action;
67   xbt_free (gtnets_action->src_name);
68   xbt_free (gtnets_action->dst_name);
69 }
70
71 void TRACE_surf_action(surf_action_t surf_action, const char *category)
72 {
73   if (!TRACE_is_enabled())
74     return;
75   if (!TRACE_categorized ())
76     return;
77   if (!category)
78     return;
79
80   surf_action->category = xbt_strdup(category);
81 }
82 #endif /* HAVE_TRACING */