/* A few basic tests for the surf library */
-/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2004-2012. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#endif
#include <stdio.h>
+#include "simgrid/sg_config.h"
#include "surf/surf.h"
+#include "surf/surf_resource.h"
#include "surf/surfxml_parse.h" // for reset callback
#include "xbt/log.h"
surf_action_t actionA = NULL;
surf_action_t actionB = NULL;
surf_action_t actionC = NULL;
- surf_action_t commAB = NULL;
e_surf_action_state_t stateActionA;
e_surf_action_state_t stateActionB;
e_surf_action_state_t stateActionC;
double now = -1.0;
- surf_parse_reset_callbacks();
- surf_cpu_model_init_Cas01(platform); /* Now it is possible to use CPUs */
- surf_network_model_init_CM02(platform); /* Now it is possible to use eth0 */
+ xbt_cfg_set_parse(_sg_cfg_set, "cpu/model:Cas01");
+ xbt_cfg_set_parse(_sg_cfg_set, "network/model:CM02");
parse_platform_file(platform);
/*********************** CPU ***********************************/
XBT_DEBUG("%p", surf_cpu_model);
- cpuA = surf_model_resource_by_name(surf_cpu_model, "Cpu A");
- cpuB = surf_model_resource_by_name(surf_cpu_model, "Cpu B");
+ cpuA = surf_cpu_resource_by_name("Cpu A");
+ cpuB = surf_cpu_resource_by_name("Cpu B");
/* Let's check that those two processors exist */
XBT_DEBUG("%s : %p", surf_resource_name(cpuA), cpuA);
/*********************** Network *******************************/
XBT_DEBUG("%p", surf_network_model);
- cardA = surf_model_resource_by_name(surf_network_model, "Cpu A");
- cardB = surf_model_resource_by_name(surf_network_model, "Cpu B");
+ cardA = sg_routing_edge_by_name_or_null("Cpu A");
+ cardB = sg_routing_edge_by_name_or_null("Cpu B");
/* Let's check that those two processors exist */
XBT_DEBUG("%s : %p", surf_resource_name(cardA), cardA);
XBT_DEBUG("%s : %p", surf_resource_name(cardB), cardB);
/* Let's do something on it */
- commAB =
- surf_network_model->extension.network.communicate("Cpu A", "Cpu B",
- 150.0, -1.0);
+ surf_network_model->extension.network.communicate(cardA, cardB,
+ 150.0, -1.0);
surf_solve(-1.0); /* Takes traces into account. Returns 0.0 */
do {