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/instr_private.h"
8 #include "surf/surf_private.h"
9 #include "surf/network_private.h"
13 void TRACE_user_link_variable(double time, const char *resource,
15 double value, const char *what)
17 if (!TRACE_is_active())
20 xbt_assert1 (instr_platform_traced(),
21 "%s must be called after environment creation", __FUNCTION__);
24 snprintf(valuestr, 100, "%g", value);
26 if (strcmp(what, "declare") == 0) {
27 instr_new_user_link_variable_type (variable, NULL);
29 char *variable_id = instr_variable_type(variable, resource);
30 char *resource_id = instr_resource_type(resource);
31 if (strcmp(what, "set") == 0) {
32 pajeSetVariable(time, variable_id, resource_id, valuestr);
33 } else if (strcmp(what, "add") == 0) {
34 pajeAddVariable(time, variable_id, resource_id, valuestr);
35 } else if (strcmp(what, "sub") == 0) {
36 pajeSubVariable(time, variable_id, resource_id, valuestr);
41 void TRACE_user_host_variable(double time, const char *variable,
42 double value, const char *what)
44 if (!TRACE_is_active())
47 xbt_assert1 (instr_platform_traced(),
48 "%s must be called after environment creation", __FUNCTION__);
51 snprintf(valuestr, 100, "%g", value);
53 if (strcmp(what, "declare") == 0) {
54 instr_new_user_host_variable_type (variable, NULL);
56 char *host_name = MSG_host_self()->name;
57 char *variable_id = instr_variable_type(variable, host_name);
58 char *resource_id = instr_resource_type(host_name);
59 if (strcmp(what, "set") == 0) {
60 pajeSetVariable(time, variable_id, resource_id, valuestr);
61 } else if (strcmp(what, "add") == 0) {
62 pajeAddVariable(time, variable_id, resource_id, valuestr);
63 } else if (strcmp(what, "sub") == 0) {
64 pajeSubVariable(time, variable_id, resource_id, valuestr);
69 #endif /* HAVE_TRACING */