Ejemplo n.º 1
0
/** Bypass deployment **/
static int bypass_deployment(void)
{
  int nb_host,i;
  static int AX_ptr;
  static int surfxml_bufferstack_size = 2048;
  static int surfxml_buffer_stack_stack_ptr = 0;
  static int surfxml_buffer_stack_stack[1024];
  xbt_dynar_t hosts = MSG_hosts_as_dynar();
  /* allocating memory to the buffer, I think 2MB should be enough */
  surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);

  nb_host = xbt_dynar_length(hosts);
  xbt_dynar_free(&hosts);

  /* <platform> */
  SURFXML_BUFFER_SET(platform_version, "3");
  SURFXML_START_TAG(platform);
  XBT_DEBUG("<platform version=\"3\">");

    XBT_DEBUG("  <process host=\"c-0.me\" function=\"master\">");
    SURFXML_BUFFER_SET(process_host, "c-0.me");
    SURFXML_BUFFER_SET(process_function, "master");
    SURFXML_BUFFER_SET(process_start___time, "-1.0");
    SURFXML_BUFFER_SET(process_kill___time, "-1.0");
    SURFXML_START_TAG(process);

    XBT_DEBUG("    <argument value=\"%s\"/>",bprintf("%d",nb_host-1));
    SURFXML_BUFFER_SET(argument_value, bprintf("%d",nb_host-1));
    SURFXML_START_TAG(argument);
    SURFXML_END_TAG(argument);

    XBT_DEBUG("    <argument value=\"5000000\"/>");
    SURFXML_BUFFER_SET(argument_value, "5000000");
    SURFXML_START_TAG(argument);
    SURFXML_END_TAG(argument);

    XBT_DEBUG("    <argument value=\"100000\"/>");
    SURFXML_BUFFER_SET(argument_value, "100000");
    SURFXML_START_TAG(argument);
    SURFXML_END_TAG(argument);

  for(i=1 ; i<nb_host ; i++)
  {
    XBT_DEBUG("    <argument value=\"%s.me\"/>",bprintf("c-%d",i));
    SURFXML_BUFFER_SET(argument_value, bprintf("c-%d.me",i));
    SURFXML_START_TAG(argument);
    SURFXML_END_TAG(argument);
  }
  XBT_DEBUG("  </process>");
  SURFXML_END_TAG(process);

  for(i=1 ; i<nb_host ; i++)
  {
    XBT_DEBUG("  <process host=\"%s.me\" function=\"slave\"/>",bprintf("c-%d",i));
    SURFXML_BUFFER_SET(process_host, bprintf("c-%d.me",i));
    SURFXML_BUFFER_SET(process_function, "slave");
    SURFXML_BUFFER_SET(process_start___time, "-1.0");
    SURFXML_BUFFER_SET(process_kill___time, "-1.0");
    SURFXML_START_TAG(process);
    SURFXML_END_TAG(process);
  }

  XBT_DEBUG("</platform>");
  SURFXML_END_TAG(platform);

  free(surfxml_bufferstack);
  return 0;
}
Ejemplo n.º 2
0
static int surf_parse_bypass_platform(void)
{
  static int AX_ptr = 0;
  static int surfxml_bufferstack_size = 2048;

  /* allocating memory for the buffer, I think 2kB should be enough */
  surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);

  XBT_DEBUG("<platform>");
  SURFXML_BUFFER_SET(platform_version, "3");
  SURFXML_START_TAG(platform);

  XBT_DEBUG("<AS>");
  SURFXML_BUFFER_SET(AS_id, "AS0");
  SURFXML_BUFFER_SET(AS_coordinates, "");
  SURFXML_BUFFER_SET(AS_routing, "Full");
  SURFXML_START_TAG(AS);

  XBT_DEBUG("<host id=\"host A\" power=\"100000000.00\"/>");
  SURFXML_BUFFER_SET(host_id, "host A");
  SURFXML_BUFFER_SET(host_power, "100000000.00");
  SURFXML_BUFFER_SET(host_availability, "1.0");
  SURFXML_BUFFER_SET(host_availability_file, "");
  SURFXML_BUFFER_SET(host_core, "1");
  A_surfxml_host_state = A_surfxml_host_state_ON;
  SURFXML_BUFFER_SET(host_state_file, "");
  SURFXML_BUFFER_SET(host_coordinates, "");
  SURFXML_START_TAG(host);
  SURFXML_END_TAG(host);

  XBT_DEBUG("<host id=\"host B\" power=\"100000000.00\"/>");
  SURFXML_BUFFER_SET(host_id, "host B");
  SURFXML_BUFFER_SET(host_power, "100000000.00");
  SURFXML_BUFFER_SET(host_availability, "1.0");
  SURFXML_BUFFER_SET(host_availability_file, "");
  SURFXML_BUFFER_SET(host_core, "1");
  A_surfxml_host_state = A_surfxml_host_state_ON;
  SURFXML_BUFFER_SET(host_state_file, "");
  SURFXML_BUFFER_SET(host_coordinates, "");
  SURFXML_START_TAG(host);
  SURFXML_END_TAG(host);

  XBT_DEBUG("<link id=\"LinkA\" bandwidth=\"10000000.0\" latency=\"0.2\"/>");
  SURFXML_BUFFER_SET(link_id, "LinkA");
  SURFXML_BUFFER_SET(link_bandwidth, "10000000.0");
  SURFXML_BUFFER_SET(link_bandwidth_file, "");
  SURFXML_BUFFER_SET(link_latency, "0.2");
  SURFXML_BUFFER_SET(link_latency_file, "");
  A_surfxml_link_state = A_surfxml_link_state_ON;
  SURFXML_BUFFER_SET(link_state_file, "");
  A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
  SURFXML_START_TAG(link);
  SURFXML_END_TAG(link);

  XBT_DEBUG("<route src=\"host A\" dst=\"host B\">");
  SURFXML_BUFFER_SET(route_src, "host A");
  SURFXML_BUFFER_SET(route_dst, "host B");
  A_surfxml_route_symmetrical = A_surfxml_route_symmetrical_YES;
  SURFXML_START_TAG(route);
  XBT_DEBUG("	<link:ctn id=\"LinkA\"/>");
  SURFXML_BUFFER_SET(link_ctn_id, "LinkA");
  A_surfxml_link_ctn_direction = A_surfxml_link_ctn_direction_NONE;
  SURFXML_START_TAG(link_ctn);
  SURFXML_END_TAG(link_ctn);
  XBT_DEBUG("</route>");
  SURFXML_END_TAG(route);

  XBT_DEBUG("</AS>");
  SURFXML_END_TAG(AS);
  XBT_DEBUG("</platfrom>");
  SURFXML_END_TAG(platform);

  free(surfxml_bufferstack);
  return 0;
}
Ejemplo n.º 3
0
static int surf_parse_bypass_application(void)
{
  static int AX_ptr;
  static int surfxml_bufferstack_size = 2048;
  static int surfxml_buffer_stack_stack_ptr = 0;
  static int surfxml_buffer_stack_stack[1024];
  /* allocating memory to the buffer, I think 2MB should be enough */
  surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);

  /* <platform> */
  SURFXML_BUFFER_SET(platform_version, "3");

  SURFXML_START_TAG(platform);

/*   <process host="host A" function="master"> */
  SURFXML_BUFFER_SET(process_host, "host A");
  SURFXML_BUFFER_SET(process_function, "master");
  SURFXML_BUFFER_SET(process_start_time, "-1.0");
  SURFXML_BUFFER_SET(process_kill_time, "-1.0");
  SURFXML_START_TAG(process);

/*      <argument value="20"/> */
  SURFXML_BUFFER_SET(argument_value, "20");
  SURFXML_START_TAG(argument);
  SURFXML_END_TAG(argument);

/*      <argument value="5000000"/> */
  SURFXML_BUFFER_SET(argument_value, "5000000");
  SURFXML_START_TAG(argument);
  SURFXML_END_TAG(argument);

/*      <argument value="100000"/> */
  SURFXML_BUFFER_SET(argument_value, "100000");
  SURFXML_START_TAG(argument);
  SURFXML_END_TAG(argument);

/*      <argument value="host B"/> */
  SURFXML_BUFFER_SET(argument_value, "host B");
  SURFXML_START_TAG(argument);
  SURFXML_END_TAG(argument);

/*   </process> */
  SURFXML_END_TAG(process);

/*   <process host="host B" function="slave"/> */
  SURFXML_BUFFER_SET(process_host, "host B");
  SURFXML_BUFFER_SET(process_function, "slave");
  SURFXML_BUFFER_SET(process_start_time, "-1.0");
  SURFXML_BUFFER_SET(process_kill_time, "-1.0");
  SURFXML_START_TAG(process);
  SURFXML_END_TAG(process);

/* </platform> */
  SURFXML_END_TAG(platform);

  free(surfxml_bufferstack);
  return 0;
}
Ejemplo n.º 4
0
static int surf_parse_bypass_application(void)
{
	int i;
	static int AX_ptr;
	static int surfxml_bufferstack_size = 2048;
	static int surfxml_buffer_stack_stack_ptr = 0;
	static int surfxml_buffer_stack_stack[1024];
	/* allocating memory to the buffer, I think 2MB should be enough */
	surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);

	totalHosts = MSG_get_host_number();
	hosts = MSG_get_host_table();

	/* <platform> */
	SURFXML_BUFFER_SET(platform_version, "3");

	SURFXML_START_TAG(platform);

	XBT_DEBUG("process : %s en master",MSG_host_get_name(hosts[0]));
	/*   <process host="host A" function="master"> */
	SURFXML_BUFFER_SET(process_host, MSG_host_get_name(hosts[0]));
	SURFXML_BUFFER_SET(process_function, "master");
	SURFXML_BUFFER_SET(process_start_time, "-1.0");
	SURFXML_BUFFER_SET(process_kill_time, "-1.0");
	SURFXML_START_TAG(process);

	/*      <argument value="0"/> */
	SURFXML_BUFFER_SET(argument_value, "0");
	SURFXML_START_TAG(argument);
	SURFXML_END_TAG(argument);
	SURFXML_END_TAG(process);

	for(i=1;i<totalHosts;i++)
	{
	XBT_DEBUG("process : %s en slave",MSG_host_get_name(hosts[i]));
	/*   <process host="host A" function="slave"> */
	SURFXML_BUFFER_SET(process_host,MSG_host_get_name(hosts[i]) );
	SURFXML_BUFFER_SET(process_function, "slave");
	SURFXML_BUFFER_SET(process_start_time, "-1.0");
	SURFXML_BUFFER_SET(process_kill_time, "-1.0");
	SURFXML_START_TAG(process);

	/*      <argument value="num"/> */
	SURFXML_BUFFER_SET(argument_value, bprintf("%d",i));
	SURFXML_START_TAG(argument);
	SURFXML_END_TAG(argument);
	SURFXML_END_TAG(process);
	}
	/* </platform> */
	SURFXML_END_TAG(platform);

	free(surfxml_bufferstack);
	return 0;
}