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())
21 snprintf(valuestr, 100, "%g", value);
23 if (strcmp(what, "declare") == 0) {
24 instr_new_user_link_variable_type (variable, NULL);
26 char *variable_id = instr_variable_type(variable, resource);
27 char *resource_id = instr_resource_type(resource);
28 if (strcmp(what, "set") == 0) {
29 pajeSetVariable(time, variable_id, resource_id, valuestr);
30 } else if (strcmp(what, "add") == 0) {
31 pajeAddVariable(time, variable_id, resource_id, valuestr);
32 } else if (strcmp(what, "sub") == 0) {
33 pajeSubVariable(time, variable_id, resource_id, valuestr);
38 void TRACE_user_host_variable(double time, const char *variable,
39 double value, const char *what)
41 if (!TRACE_is_active())
45 snprintf(valuestr, 100, "%g", value);
47 if (strcmp(what, "declare") == 0) {
48 instr_new_user_host_variable_type (variable, NULL);
50 char *host_name = MSG_host_self()->name;
51 char *variable_id = instr_variable_type(variable, host_name);
52 char *resource_id = instr_resource_type(host_name);
53 if (strcmp(what, "set") == 0) {
54 pajeSetVariable(time, variable_id, resource_id, valuestr);
55 } else if (strcmp(what, "add") == 0) {
56 pajeAddVariable(time, variable_id, resource_id, valuestr);
57 } else if (strcmp(what, "sub") == 0) {
58 pajeSubVariable(time, variable_id, resource_id, valuestr);
63 #endif /* HAVE_TRACING */