Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove useless code
[simgrid.git] / src / msg / instr_msg_task.cpp
1 /* Copyright (c) 2010-2019. 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 "mc/mc.h"
8 #include "src/instr/instr_private.hpp"
9 #include "src/msg/msg_private.hpp"
10
11 #include <atomic>
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_msg, instr, "MSG instrumentation");
14
15 void TRACE_msg_set_task_category(msg_task_t task, const char *category)
16 {
17   xbt_assert(task->category == nullptr, "Task %p(%s) already has a category (%s).",
18       task, task->name, task->category);
19
20   //if user provides a nullptr category, task is no longer traced
21   if (category == nullptr) {
22     xbt_free (task->category);
23     task->category = nullptr;
24     XBT_DEBUG("MSG task %p(%s), category removed", task, task->name);
25   } else {
26     // set task category
27     task->category = xbt_strdup(category);
28     XBT_DEBUG("MSG task %p(%s), category %s", task, task->name, task->category);
29   }
30 }
31
32 void TRACE_msg_task_get_end(msg_task_t task)
33 {
34   XBT_DEBUG("GET,out %p, %lld, %s", task, task->counter, task->category);
35
36   if (TRACE_actor_is_enabled()) {
37     container_t process_container = simgrid::instr::Container::by_name(instr_pid(MSG_process_self()));
38
39     std::string key = std::string("p") + std::to_string(task->counter);
40     simgrid::instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->end_event(process_container, "SR", key);
41   }
42 }
43
44 /* MSG_task_put related functions */
45 void TRACE_msg_task_put_start(msg_task_t task)
46 {
47   XBT_DEBUG("PUT,in %p, %lld, %s", task, task->counter, task->category);
48
49   if (TRACE_actor_is_enabled()) {
50     container_t process_container = simgrid::instr::Container::by_name(instr_pid(MSG_process_self()));
51     std::string key = std::string("p") + std::to_string(task->counter);
52     simgrid::instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->start_event(process_container, "SR", key);
53   }
54 }