use of xbt_os_time for benchmarking...
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1205
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
#include <stdlib.h>
#include <stdio.h>
#include "surf/maxmin.h"
#include <stdlib.h>
#include <stdio.h>
#include "surf/maxmin.h"
-#include "gras/virtu.h" /* time manipulation for benchmarking */
+#include "xbt/sysdep.h" /* time manipulation for benchmarking */
- date = gras_os_time() * 1000000;
+ date = xbt_os_time() * 1000000;
- date = gras_os_time() * 1000000 - date;
+ date = xbt_os_time() * 1000000 - date;
lmm_system_free(Sys);
free(cnst);
lmm_system_free(Sys);
free(cnst);
int nb_cnst = 2000;
int nb_var = 2000;
int nb_elem = 20;
int nb_cnst = 2000;
int nb_var = 2000;
int nb_elem = 20;
- date = gras_os_time() * 1000000;
+ date = xbt_os_time() * 1000000;
test(nb_cnst, nb_var, nb_elem);
printf("One shot execution time for a total of %d constraints, "
"%d variables with %d active constraint each : %lg microsecondes \n",
test(nb_cnst, nb_var, nb_elem);
printf("One shot execution time for a total of %d constraints, "
"%d variables with %d active constraint each : %lg microsecondes \n",
#include <stdio.h>
#include "surf/maxmin.h"
#include <stdio.h>
#include "surf/maxmin.h"
-#define PRINT_VAR(var) printf(#var " = %lg\n",lmm_variable_getvalue(var));
+#include "xbt/log.h"
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+
+#define PRINT_VAR(var) DEBUG1(#var " = %lg\n",lmm_variable_getvalue(var));
PRINT_VAR(R_2);
PRINT_VAR(R_3);
PRINT_VAR(R_2);
PRINT_VAR(R_3);
lmm_solve(Sys);
PRINT_VAR(R_1_2_3);
PRINT_VAR(R_1);
PRINT_VAR(R_2);
PRINT_VAR(R_3);
lmm_solve(Sys);
PRINT_VAR(R_1_2_3);
PRINT_VAR(R_1);
PRINT_VAR(R_2);
PRINT_VAR(R_3);
lmm_update_variable_weight(Sys,R_1_2_3,.5);
lmm_update_variable_weight(Sys,R_1_2_3,.5);
PRINT_VAR(T1);
PRINT_VAR(T2);
PRINT_VAR(T1);
PRINT_VAR(T2);
lmm_solve(Sys);
PRINT_VAR(T1);
PRINT_VAR(T2);
lmm_solve(Sys);
PRINT_VAR(T1);
PRINT_VAR(T2);
lmm_system_free(Sys);
}
int main(int argc, char **argv)
{
lmm_system_free(Sys);
}
int main(int argc, char **argv)
{
- printf("***** Test 1 ***** \n");
+ DEBUG0("***** Test 1 ***** \n");
- printf("***** Test 2 ***** \n");
+ DEBUG0("***** Test 2 ***** \n");
#include <stdio.h>
#include "surf/surf.h"
#include <stdio.h>
#include "surf/surf.h"
+#include "xbt/log.h"
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+
const char *string_action(e_surf_action_state_t state);
const char *string_action(e_surf_action_state_t state)
{
const char *string_action(e_surf_action_state_t state);
const char *string_action(e_surf_action_state_t state)
{
surf_network_resource_init_CM02(platform); /* Now it is possible to use eth0 */
/*********************** CPU ***********************************/
surf_network_resource_init_CM02(platform); /* Now it is possible to use eth0 */
/*********************** CPU ***********************************/
- printf("%p \n", surf_cpu_resource);
+ DEBUG1("%p \n", surf_cpu_resource);
cpuA = surf_cpu_resource->common_public->name_service("Cpu A");
cpuB = surf_cpu_resource->common_public->name_service("Cpu B");
/* Let's check that those two processors exist */
cpuA = surf_cpu_resource->common_public->name_service("Cpu A");
cpuB = surf_cpu_resource->common_public->name_service("Cpu B");
/* Let's check that those two processors exist */
surf_cpu_resource->common_public->get_resource_name(cpuA), cpuA);
surf_cpu_resource->common_public->get_resource_name(cpuA), cpuA);
surf_cpu_resource->common_public->get_resource_name(cpuB), cpuB);
/* Let's do something on it */
surf_cpu_resource->common_public->get_resource_name(cpuB), cpuB);
/* Let's do something on it */
stateActionC = surf_cpu_resource->common_public->action_get_state(actionC); /* When you know actionA resource type */
/* And just look at the state of these tasks */
stateActionC = surf_cpu_resource->common_public->action_get_state(actionC); /* When you know actionA resource type */
/* And just look at the state of these tasks */
- printf("actionA : %p (%s)\n", actionA, string_action(stateActionA));
- printf("actionB : %p (%s)\n", actionB, string_action(stateActionB));
- printf("actionC : %p (%s)\n", actionB, string_action(stateActionC));
+ DEBUG2("actionA : %p (%s)\n", actionA, string_action(stateActionA));
+ DEBUG2("actionB : %p (%s)\n", actionB, string_action(stateActionB));
+ DEBUG2("actionC : %p (%s)\n", actionB, string_action(stateActionC));
/*********************** Network *******************************/
/*********************** Network *******************************/
- printf("%p \n", surf_network_resource);
+ DEBUG1("%p \n", surf_network_resource);
cardA = surf_network_resource->common_public->name_service("Cpu A");
cardB = surf_network_resource->common_public->name_service("Cpu B");
/* Let's check that those two processors exist */
cardA = surf_network_resource->common_public->name_service("Cpu A");
cardB = surf_network_resource->common_public->name_service("Cpu B");
/* Let's check that those two processors exist */
surf_network_resource->common_public->get_resource_name(cardA),
cardA);
surf_network_resource->common_public->get_resource_name(cardA),
cardA);
surf_network_resource->common_public->get_resource_name(cardB),
cardB);
surf_network_resource->common_public->get_resource_name(cardB),
cardB);
do {
surf_action_t action = NULL;
now = surf_get_clock();
do {
surf_action_t action = NULL;
now = surf_get_clock();
- printf("Next Event : " "%lg" "\n", now);
- printf("\t CPU actions\n");
+ DEBUG1("Next Event : " "%lg" "\n", now);
+ DEBUG0("\t CPU actions\n");
while ((action =
xbt_swag_extract(surf_cpu_resource->common_public->states.
failed_action_set))) {
while ((action =
xbt_swag_extract(surf_cpu_resource->common_public->states.
failed_action_set))) {
- printf("\t * Failed : %p\n", action);
+ DEBUG1("\t * Failed : %p\n", action);
action->resource_type->common_public->action_free(action);
}
while ((action =
xbt_swag_extract(surf_cpu_resource->common_public->states.
done_action_set))) {
action->resource_type->common_public->action_free(action);
}
while ((action =
xbt_swag_extract(surf_cpu_resource->common_public->states.
done_action_set))) {
- printf("\t * Done : %p\n", action);
+ DEBUG1("\t * Done : %p\n", action);
action->resource_type->common_public->action_free(action);
}
action->resource_type->common_public->action_free(action);
}
- printf("\t Network actions\n");
+ DEBUG0("\t Network actions\n");
while ((action =
xbt_swag_extract(surf_network_resource->common_public->states.
failed_action_set))) {
while ((action =
xbt_swag_extract(surf_network_resource->common_public->states.
failed_action_set))) {
- printf("\t * Failed : %p\n", action);
+ DEBUG1("\t * Failed : %p\n", action);
action->resource_type->common_public->action_free(action);
}
while ((action =
xbt_swag_extract(surf_network_resource->common_public->states.
done_action_set))) {
action->resource_type->common_public->action_free(action);
}
while ((action =
xbt_swag_extract(surf_network_resource->common_public->states.
done_action_set))) {
- printf("\t * Done : %p\n", action);
+ DEBUG1("\t * Done : %p\n", action);
action->resource_type->common_public->action_free(action);
}
} while (surf_solve()>=0.0);
action->resource_type->common_public->action_free(action);
}
} while (surf_solve()>=0.0);
- printf("Simulation Terminated\n");
+ DEBUG0("Simulation Terminated\n");
#include <stdio.h>
#include "surf/surf.h"
#include <stdio.h>
#include "surf/surf.h"
+#include "xbt/log.h"
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+
const char *string_action(e_surf_action_state_t state);
const char *string_action(e_surf_action_state_t state)
{
const char *string_action(e_surf_action_state_t state);
const char *string_action(e_surf_action_state_t state)
{
surf_workstation_resource->common_public->name_service("Cpu B");
/* Let's check that those two processors exist */
surf_workstation_resource->common_public->name_service("Cpu B");
/* Let's check that those two processors exist */
surf_workstation_resource->common_public->
get_resource_name(workstationA), workstationA);
surf_workstation_resource->common_public->
get_resource_name(workstationA), workstationA);
surf_workstation_resource->common_public->
get_resource_name(workstationB), workstationB);
surf_workstation_resource->common_public->
get_resource_name(workstationB), workstationB);
surf_resource_t resource = NULL;
now = surf_get_clock();
surf_resource_t resource = NULL;
now = surf_get_clock();
- printf("Next Event : " "%lg" "\n", now);
+ DEBUG1("Next Event : " "%lg" "\n", now);
xbt_dynar_foreach(resource_list, i, resource) {
xbt_dynar_foreach(resource_list, i, resource) {
- printf("\t %s actions\n", resource->common_public->name);
+ DEBUG1("\t %s actions\n", resource->common_public->name);
while ((action =
xbt_swag_extract(resource->common_public->states.
failed_action_set))) {
while ((action =
xbt_swag_extract(resource->common_public->states.
failed_action_set))) {
- printf("\t * Failed : %p\n", action);
+ DEBUG1("\t * Failed : %p\n", action);
resource->common_public->action_free(action);
}
while ((action =
xbt_swag_extract(resource->common_public->states.
done_action_set))) {
resource->common_public->action_free(action);
}
while ((action =
xbt_swag_extract(resource->common_public->states.
done_action_set))) {
- printf("\t * Done : %p\n", action);
+ DEBUG1("\t * Done : %p\n", action);
resource->common_public->action_free(action);
}
}
} while (surf_solve()>=0.0);
resource->common_public->action_free(action);
}
}
} while (surf_solve()>=0.0);
- printf("Simulation Terminated\n");
+ DEBUG0("Simulation Terminated\n");
#include "surf/trace_mgr.h"
#include "surf/surf.h"
#include "surf/trace_mgr.h"
#include "surf/surf.h"
+#include "xbt/log.h"
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+
void test(void);
void test(void)
{
void test(void);
void test(void)
{
tmgr_history_add_trace(history, trace_B, 0.0, 0, host_B);
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
tmgr_history_add_trace(history, trace_B, 0.0, 0, host_B);
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
- printf("%lg" " : \n", next_event_date);
+ DEBUG1("%lg" " : \n", next_event_date);
while (tmgr_history_get_next_event_leq(history, next_event_date,
&value, (void **) &resource)) {
while (tmgr_history_get_next_event_leq(history, next_event_date,
&value, (void **) &resource)) {
- printf("\t %s : " "%lg" "\n", resource, value);
+ DEBUG2("\t %s : " "%lg" "\n", resource, value);
}
if (next_event_date > 1000)
break;
}
if (next_event_date > 1000)
break;