1 /* Copyright (c) 2013-2014. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #include "instr/instr_private.h"
9 #include "simdag/datatypes.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_sd, instr, "SD");
14 void TRACE_sd_set_task_category(SD_task_t task, const char *category){
16 //if user provides a NULL category, task is no longer traced
17 if (category == NULL) {
18 xbt_free (task->category);
19 task->category = NULL;
20 XBT_DEBUG("SD task %p(%s), category removed", task, task->name);
25 xbt_free(task->category);
26 task->category = xbt_strdup (category);
27 XBT_DEBUG("SD task %p(%s), category %s", task, task->name, task->category);
30 void TRACE_sd_task_create(SD_task_t task)
32 static long long counter = 0;
33 task->counter = counter++;
34 task->category = NULL;
36 XBT_DEBUG("CREATE %p, %lld", task, task->counter);
39 void TRACE_sd_task_execute_start(SD_task_t task)
41 if (task->kind == SD_TASK_COMP_PAR_AMDAHL || task->kind == SD_TASK_COMP_SEQ){
42 XBT_DEBUG("EXEC,in %p, %lld, %s", task, task->counter, task->category);
44 // for (i = 0; i < task->workstation_nb; i++){
45 // container_t workstation_container =
46 // PJ_container_get (SD_workstation_get_name(task->workstation_list[i]));
48 // type_t type = PJ_type_get ("power_used", workstation_container->type);
49 // sprintf(name, "%s_ws_%d", SD_task_get_name(task), i);
50 // val_t value = PJ_value_new(name, "1 0 1", type);
51 // new_pajePushState (SD_get_clock(), workstation_container, type, value);
56 void TRACE_sd_task_execute_end(SD_task_t task)
58 if (task->kind == SD_TASK_COMP_PAR_AMDAHL || task->kind == SD_TASK_COMP_SEQ){
59 XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
61 // for (i = 0; i < task->workstation_nb; i++){
62 // container_t workstation_container =
63 // PJ_container_get (SD_workstation_get_name(task->workstation_list[i]));
64 // type_t type = PJ_type_get ("power_used", workstation_container->type);
65 // new_pajePopState (SD_get_clock(), workstation_container, type);
70 void TRACE_sd_task_destroy(SD_task_t task)
72 XBT_DEBUG("DESTROY %p, %lld, %s", task, task->counter, task->category);
75 xbt_free(task->category);
76 task->category = NULL;