Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
proper check for the -std=gnu++11 standard, and take in on clang too
[simgrid.git] / src / simdag / instr_sd_task.c
1 /* Copyright (c) 2013-2014. 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 "private.h"
9 #include "simgrid/simdag.h"
10
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_sd, instr, "SD");
12
13 void TRACE_sd_set_task_category(SD_task_t task, const char *category){
14
15   //if user provides a NULL category, task is no longer traced
16   if (category == NULL) {
17     xbt_free (task->category);
18     task->category = NULL;
19     XBT_DEBUG("SD task %p(%s), category removed", task, task->name);
20     return;
21   }
22
23   //set task category
24   xbt_free(task->category);
25   task->category = xbt_strdup (category);
26   XBT_DEBUG("SD task %p(%s), category %s", task, task->name, task->category);
27 }
28
29 void TRACE_sd_task_create(SD_task_t task)
30 {
31   static long long counter = 0;
32   task->counter = counter++;
33   task->category = NULL;
34
35   XBT_DEBUG("CREATE %p, %lld", task, task->counter);
36 }
37
38 void TRACE_sd_task_execute_start(SD_task_t task)
39 {
40   if (task->kind == SD_TASK_COMP_PAR_AMDAHL || task->kind == SD_TASK_COMP_SEQ){
41     XBT_DEBUG("EXEC,in %p, %lld, %s", task, task->counter, task->category);
42 //    int i;
43 //    for (i = 0; i < task->workstation_nb; i++){
44 //      container_t workstation_container =
45 //          PJ_container_get (SD_workstation_get_name(task->workstation_list[i]));
46 //      char name[1024];
47 //      type_t type = PJ_type_get ("power_used", workstation_container->type);
48 //      sprintf(name, "%s_ws_%d", SD_task_get_name(task), i);
49 //      val_t value = PJ_value_new(name, "1 0 1", type);
50 //      new_pajePushState (SD_get_clock(), workstation_container, type, value);
51 //    }
52   }
53 }
54
55 void TRACE_sd_task_execute_end(SD_task_t task)
56 {
57   if (task->kind == SD_TASK_COMP_PAR_AMDAHL || task->kind == SD_TASK_COMP_SEQ){
58     XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
59 //    int i;
60 //    for (i = 0; i < task->workstation_nb; i++){
61 //      container_t workstation_container =
62 //          PJ_container_get (SD_workstation_get_name(task->workstation_list[i]));
63 //      type_t type = PJ_type_get ("power_used", workstation_container->type);
64 //      new_pajePopState (SD_get_clock(), workstation_container, type);
65 //    }
66   }
67 }
68
69 void TRACE_sd_task_destroy(SD_task_t task)
70 {
71   XBT_DEBUG("DESTROY %p, %lld, %s", task, task->counter, task->category);
72
73   //free category
74   xbt_free(task->category);
75   task->category = NULL;
76   return;
77 }
78