示例#1
0
/* Recursive so that multiple depth types are properly shown */
static void
output_only (hwloc_topology_t topology, hwloc_obj_t l, FILE *output, int logical, int verbose_mode)
{
  unsigned x;
  if (lstopo_show_only == l->type) {
    output_console_obj (topology, l, output, logical, verbose_mode);
    fprintf (output, "\n");
  }
  for (x=0; x<l->arity; x++)
    output_only (topology, l->children[x], output, logical, verbose_mode);
}
/* Recursively output topology in a console fashion */
static void
output_topology (hwloc_topology_t topology, hwloc_obj_t l, hwloc_obj_t parent, FILE *output, int i, int logical, int verbose_mode)
{
  hwloc_obj_t child;
  int group_identical = (verbose_mode <= 1) && !lstopo_show_cpuset;
  unsigned collapse = 1;

  if (l->type == HWLOC_OBJ_PCI_DEVICE) {
    const char *collapsestr = hwloc_obj_get_info_by_name(l, "lstopoCollapse");
    if (collapsestr)
      collapse = atoi(collapsestr);
    if (!collapse)
      return;
  }

  if (group_identical
      && parent && parent->arity == 1
      && l->cpuset && parent->cpuset && hwloc_bitmap_isequal(l->cpuset, parent->cpuset)) {
    /* in non-verbose mode, merge objects with their parent is they are exactly identical */
    fprintf(output, " + ");
  } else {
    if (parent)
      fprintf(output, "\n");
    indent (output, 2*i);
    i++;
  }

  if (collapse > 1)
    fprintf(output, "%u x { ", collapse);
  output_console_obj(topology, l, output, logical, verbose_mode, collapse > 1);
  if (collapse > 1)
    fprintf(output, " }");

  for(child = l->first_child; child; child = child->next_sibling)
    if (child->type != HWLOC_OBJ_PU || !lstopo_ignore_pus)
      output_topology (topology, child, l, output, i, logical, verbose_mode);
  for(child = l->io_first_child; child; child = child->next_sibling)
    output_topology (topology, child, l, output, i, logical, verbose_mode);
  for(child = l->misc_first_child; child; child = child->next_sibling)
    output_topology (topology, child, l, output, i, logical, verbose_mode);
}
/* Recursive so that multiple depth types are properly shown */
static void
output_only (hwloc_topology_t topology, hwloc_obj_t l, FILE *output, int logical, int verbose_mode)
{
  hwloc_obj_t child;
  if (lstopo_show_only == l->type) {
    output_console_obj (topology, l, output, logical, verbose_mode, 0);
    fprintf (output, "\n");
  }
  for(child = l->first_child; child; child = child->next_sibling)
    output_only (topology, child, output, logical, verbose_mode);
  if (lstopo_show_only == HWLOC_OBJ_BRIDGE || lstopo_show_only == HWLOC_OBJ_PCI_DEVICE
      || lstopo_show_only == HWLOC_OBJ_OS_DEVICE || lstopo_show_only == HWLOC_OBJ_MISC) {
    /* I/O can only contain other I/O or Misc, no need to recurse otherwise */
    for(child = l->io_first_child; child; child = child->next_sibling)
      output_only (topology, child, output, logical, verbose_mode);
  }
  if (lstopo_show_only == HWLOC_OBJ_MISC) {
    /* Misc can only contain other Misc, no need to recurse otherwise */
    for(child = l->misc_first_child; child; child = child->next_sibling)
      output_only (topology, child, output, logical, verbose_mode);
  }
}
示例#4
0
/* Recursively output topology in a console fashion */
static void
output_topology (hwloc_topology_t topology, hwloc_obj_t l, hwloc_obj_t parent, FILE *output, int i, int logical, int verbose_mode)
{
  unsigned x;
  int group_identical = (verbose_mode <= 1) && !lstopo_show_cpuset;
  if (group_identical
      && parent && parent->arity == 1
      && l->cpuset && parent->cpuset && hwloc_bitmap_isequal(l->cpuset, parent->cpuset)) {
    /* in non-verbose mode, merge objects with their parent is they are exactly identical */
    fprintf(output, " + ");
  } else {
    if (parent)
      fprintf(output, "\n");
    indent (output, 2*i);
    i++;
  }
  output_console_obj(topology, l, output, logical, verbose_mode);
  if (l->arity || (!i && !l->arity))
    {
      for (x=0; x<l->arity; x++)
	if (l->children[x]->type != HWLOC_OBJ_PU || !lstopo_ignore_pus)
	  output_topology (topology, l->children[x], l, output, i, logical, verbose_mode);
  }
}