Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b53c55f3d76f6723deb37641172844ce56706ed7
[simgrid.git] / src / surf / instr_surf.cpp
1 /* Copyright (c) 2010, 2012-2017. 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 "src/instr/instr_private.hpp"
8 #include "src/surf/surf_interface.hpp"
9
10 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_surf, instr, "Tracing Surf");
11
12 void TRACE_surf_host_set_speed(double date, const char *resource, double speed)
13 {
14   if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) {
15     container_t container      = simgrid::instr::Container::byName(resource);
16     simgrid::instr::VariableType* variable =
17         static_cast<simgrid::instr::VariableType*>(container->type_->byName("power"));
18     variable->setEvent(date, container, speed);
19   }
20 }
21
22 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth)
23 {
24   if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) {
25     container_t container      = simgrid::instr::Container::byName(resource);
26     simgrid::instr::VariableType* variable =
27         static_cast<simgrid::instr::VariableType*>(container->type_->byName("bandwidth"));
28     variable->setEvent(date, container, bandwidth);
29   }
30 }
31
32 void TRACE_surf_action(surf_action_t surf_action, const char *category)
33 {
34   if (not TRACE_is_enabled())
35     return;
36   if (not TRACE_categorized())
37     return;
38   if (not category)
39     return;
40
41   surf_action->setCategory(category);
42 }