Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'actor-yield' of github.com:Takishipp/simgrid into actor-yield
[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     simgrid::instr::Container::byName(resource)->getVariable("power")->setEvent(date, speed);
16   }
17 }
18
19 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth)
20 {
21   if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) {
22     simgrid::instr::Container::byName(resource)->getVariable("bandwidth")->setEvent(date, bandwidth);
23   }
24 }
25
26 void TRACE_surf_action(surf_action_t surf_action, const char *category)
27 {
28   if (not TRACE_is_enabled() || not TRACE_categorized() || not category)
29     return;
30
31   surf_action->setCategory(category);
32 }