Logo AND Algorithmique Numérique Distribuée

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