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_init ()
15 current_task_category = xbt_dict_new();
18 void __TRACE_category_set (smx_process_t proc, const char *category)
22 snprintf (processid, 100, "%p", proc);
23 var_cpy = xbt_strdup (category);
24 xbt_dict_set (current_task_category, processid, var_cpy, xbt_free);
27 char *__TRACE_category_get (smx_process_t proc)
30 snprintf (processid, 100, "%p", proc);
31 return xbt_dict_get_or_null (current_task_category, processid);
34 void __TRACE_category_unset (smx_process_t proc)
37 snprintf (processid, 100, "%p", proc);
38 if (xbt_dict_get_or_null (current_task_category, processid) != NULL){
39 xbt_dict_remove (current_task_category, processid);
43 void __TRACE_msg_category_set (smx_process_t proc, m_task_t task)
45 __TRACE_category_set (proc, task->category);