Ejemplo n.º 1
0
/** @brief Displays debugging informations about a workstation */
void SD_workstation_dump(SD_workstation_t ws)
{
  xbt_dict_t props;
  xbt_dict_cursor_t cursor=NULL;
  char *key,*data;
  SD_task_t task = NULL;
  
  XBT_INFO("Displaying workstation %s", SD_workstation_get_name(ws));
  XBT_INFO("  - power: %.0f", SD_workstation_get_power(ws));
  XBT_INFO("  - available power: %.2f", SD_workstation_get_available_power(ws));
  switch (sg_host_sd(ws)->access_mode){
  case SD_WORKSTATION_SHARED_ACCESS:
      XBT_INFO("  - access mode: Space shared");
      break;
  case SD_WORKSTATION_SEQUENTIAL_ACCESS:
      XBT_INFO("  - access mode: Exclusive");
    task = SD_workstation_get_current_task(ws);
    if(task)
      XBT_INFO("    current running task: %s",
               SD_task_get_name(task));
    else
      XBT_INFO("    no task running");
      break;
  default: break;
  }
  props = SD_workstation_get_properties(ws);
  
  if (!xbt_dict_is_empty(props)){
    XBT_INFO("  - properties:");

    xbt_dict_foreach(props,cursor,key,data) {
      XBT_INFO("    %s->%s",key,data);
    }
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
  char *platformFile = NULL;
  unsigned int totalHosts, totalLinks;
  int timings=0;
  int version = 4;
  const char *link_ctn = "link_ctn";
  unsigned int i;
  xbt_dict_t props = NULL;
  xbt_dict_cursor_t cursor = NULL;
  xbt_lib_cursor_t cursor_src = NULL;
  xbt_lib_cursor_t cursor_dst = NULL;
  char *src,*dst,*key,*data;
  sg_netcard_t value1;
  sg_netcard_t value2;

  const sg_host_t *hosts;
  const SD_link_t *links;
  xbt_os_timer_t parse_time = xbt_os_timer_new();

  SD_init(&argc, argv);

  if (parse_cmdline(&timings, &platformFile, argc, argv) || !platformFile) {
    xbt_die("Invalid command line arguments: expected [--timings] platformFile");
  }

  XBT_DEBUG("%d,%s", timings, platformFile);

  create_environment(parse_time, platformFile);

  if (timings) {
    XBT_INFO("Parsing time: %fs (%zu hosts, %d links)", xbt_os_timer_elapsed(parse_time),
             sg_host_count(), sg_link_count());
  } else {
    printf("<?xml version='1.0'?>\n");
    printf("<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd\">\n");
    printf("<platform version=\"%d\">\n", version);
    printf("<AS id=\"AS0\" routing=\"Full\">\n");

    // Hosts
    totalHosts = sg_host_count();
    hosts = sg_host_list();
    qsort((void *) hosts, totalHosts, sizeof(sg_host_t), name_compare_hosts);

    for (i = 0; i < totalHosts; i++) {
      printf("  <host id=\"%s\" speed=\"%.0f\"", sg_host_get_name(hosts[i]), sg_host_speed(hosts[i]));
      props = sg_host_get_properties(hosts[i]);
      if (sg_host_core_count(hosts[i])>1) {
        printf(" core=\"%d\"", sg_host_core_count(hosts[i]));
      }
      if (props && !xbt_dict_is_empty(props)) {
        printf(">\n");
        xbt_dict_foreach(props, cursor, key, data) {
          printf("    <prop id=\"%s\" value=\"%s\"/>\n", key, data);
        }
        printf("  </host>\n");
      } else {
Ejemplo n.º 3
0
/** @brief Displays debugging information about a host */
void sg_host_dump(sg_host_t host)
{
  xbt_dict_t props;
  xbt_dict_cursor_t cursor=NULL;
  char *key,*data;

  XBT_INFO("Displaying host %s", sg_host_get_name(host));
  XBT_INFO("  - speed: %.0f", host->speed());
  XBT_INFO("  - available speed: %.2f", sg_host_get_available_speed(host));
  props = sg_host_get_properties(host);

  if (!xbt_dict_is_empty(props)){
    XBT_INFO("  - properties:");

    xbt_dict_foreach(props,cursor,key,data) {
      XBT_INFO("    %s->%s",key,data);
    }
Ejemplo n.º 4
0
static void recursiveGraphExtraction (simgrid::surf::As *rc, container_t container, xbt_dict_t filter)
{
  if (!TRACE_platform_topology()){
    XBT_DEBUG("Graph extraction disabled by user.");
    return;
  }
  XBT_DEBUG ("Graph extraction for routing_component = %s", rc->name_);
  if (!xbt_dict_is_empty(rc->children_)){
    xbt_dict_cursor_t cursor = NULL;
    AS_t rc_son;
    char *child_name;
    //bottom-up recursion
    xbt_dict_foreach(surf_AS_get_children(rc), cursor, child_name, rc_son) {
      container_t child_container = (container_t) xbt_dict_get (
        container->children, surf_AS_get_name(rc_son));
      recursiveGraphExtraction (rc_son, child_container, filter);
    }
Ejemplo n.º 5
0
static void generate_cat_configuration (const char *output, const char *name, int brackets)
{
  if (output && strlen(output) > 0){
    //check if we do have categories declared
    if (xbt_dict_is_empty(created_categories)){
      XBT_INFO("No categories declared, ignoring generation of %s graph configuration", name);
      return;
    }

    FILE *file = fopen (output, "w");
    if (file == NULL){
      THROWF (system_error, 1, "Unable to open file (%s) for writing %s graph "
          "configuration (categorized).", output, name);
    }

    if (brackets) fprintf (file, "{\n");
    cat_configuration (file);
    if (brackets) fprintf (file, "}\n");
    fclose (file);
  }
}
Ejemplo n.º 6
0
/** \ingroup msg_trace_driven
 * \brief A trace loader
 *
 *  If path!=NULL, load a trace file containing actions, and execute them.
 *  Else, assume that each process gets the path in its deployment file
 */
msg_error_t MSG_action_trace_run(char *path)
{
  msg_error_t res;
  char *name;
  xbt_dynar_t todo;
  xbt_dict_cursor_t cursor;

  xbt_action_fp=NULL;
  if (path) {
	  xbt_action_fp = fopen(path, "r");
    if (xbt_action_fp == NULL)
      xbt_die("Cannot open %s: %s", path, strerror(errno));
  }
  res = MSG_main();

  if (!xbt_dict_is_empty(xbt_action_queues)) {
    XBT_WARN
        ("Not all actions got consumed. If the simulation ended successfully (without deadlock), you may want to add new processes to your deployment file.");


    xbt_dict_foreach(xbt_action_queues, cursor, name, todo) {
      XBT_WARN("Still %lu actions for %s", xbt_dynar_length(todo), name);
    }
Ejemplo n.º 7
0
int main(int argc, char **argv)
{
  char *platformFile = NULL;
  int totalHosts, totalLinks;
  int timings=0;
  int downgrade = 0;
  int version = 3;
  const char *link_ctn = link_ctn_v3;
  unsigned int i;
  xbt_dict_t props = NULL;
  xbt_dict_cursor_t cursor = NULL;
  xbt_lib_cursor_t cursor_src = NULL;
  xbt_lib_cursor_t cursor_dst = NULL;
  char *src,*dst,*key,*data;
  sg_routing_edge_t value1;
  sg_routing_edge_t value2;

  const SD_workstation_t *hosts;
  const SD_link_t *links;
  xbt_os_timer_t parse_time = xbt_os_timer_new();

  setvbuf(stdout, NULL, _IOLBF, 0);

  SD_init(&argc, argv);

  if (parse_cmdline(&timings, &downgrade, &platformFile, argc, argv) || !platformFile) {
    xbt_die("Invalid command line arguments: expected [--timings|--downgrade] platformFile");
  }
 
  XBT_DEBUG("%d,%d,%s", timings, downgrade, platformFile);

  if (downgrade) {
    version = 2;
    link_ctn = link_ctn_v2;
  }

  create_environment(parse_time, platformFile);

  if (timings) {
    XBT_INFO("Parsing time: %fs (%d hosts, %d links)",
          xbt_os_timer_elapsed(parse_time),SD_workstation_get_number(),SD_link_get_number());
  } else {
    printf("<?xml version='1.0'?>\n");
    printf("<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n");
    printf("<platform version=\"%d\">\n", version);
    if (!downgrade)
      printf("<AS id=\"AS0\" routing=\"Full\">\n");

    // Hosts
    totalHosts = SD_workstation_get_number();
    hosts = SD_workstation_get_list();
    qsort((void *) hosts, totalHosts, sizeof(SD_workstation_t),
        name_compare_hosts);

    for (i = 0; i < totalHosts; i++) {
      printf("  <host id=\"%s\" power=\"%.0f\"",
          SD_workstation_get_name(hosts[i]),
          SD_workstation_get_power(hosts[i]));
      props = SD_workstation_get_properties(hosts[i]);
      if (props && !xbt_dict_is_empty(props)) {
        printf(">\n");
        xbt_dict_foreach(props, cursor, key, data) {
          printf("    <prop id=\"%s\" value=\"%s\"/>\n", key, data);
        }
        printf("  </host>\n");
      } else {