1 /* Copyright (c) 2010. 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/private.h"
11 static xbt_dict_t current_task_category = NULL;
13 void TRACE_category_alloc ()
15 current_task_category = xbt_dict_new();
18 void TRACE_category_release ()
20 xbt_dict_free (¤t_task_category);
23 void TRACE_category_set (smx_process_t proc, const char *category)
27 snprintf (processid, 100, "%p", proc);
28 var_cpy = xbt_strdup (category);
29 xbt_dict_set (current_task_category, processid, var_cpy, xbt_free);
32 char *TRACE_category_get (smx_process_t proc)
35 snprintf (processid, 100, "%p", proc);
36 return xbt_dict_get_or_null (current_task_category, processid);
39 void TRACE_category_unset (smx_process_t proc)
42 snprintf (processid, 100, "%p", proc);
43 if (xbt_dict_get_or_null (current_task_category, processid) != NULL){
44 xbt_dict_remove (current_task_category, processid);
48 void TRACE_msg_category_set (smx_process_t proc, m_task_t task)
50 TRACE_category_set (proc, task->category);