Exemple #1
0
void
set_output(const char *name)
{
	static int set = 0;
	module_conf_t *ml, *m;

	if (set)
		return;
	set = 1;

	if (NULL == name || !strcasecmp(name, "list")) {
		list_output();
		exit(0);
	}
	
	ml = parse_module_param(name);

	for (m = ml; m; m = m->next) {
		preferred = get_output_module(ml->name);

		if (NULL == preferred)
			continue;

		if (preferred->om_set_opts)
			preferred->om_set_opts(ml->attrs);

		if (preferred->om_probe)
			if (preferred->om_probe())
				return;
	}
	
	quit("No (working) output module found\n");
}
Exemple #2
0
static int cmd_list_output(int argc, const char **argv)
{
	int ret;

	if (lttng_opt_mi) {
		ret = mi_list_output();
	} else {
		ret = list_output();
	}

	return ret;
}
Exemple #3
0
static void test_match(int argc, char *argv[])
{
  t_upsugo_command *command_line = NULL;
  char *list_valid_opts = "a?cdDf:g:h:K:lm:M:noq:r:tU:vVz:Z";
  int need_unique = 0;
  t_upslst_item *mproduct_list;

  /* avoid the need_unique flag */
  argc -= 2;

  if (! strcmp(argv[1],"1")) {
    need_unique = 1;
  }

 /* get the options for each iteration of the command and do it */
  while ((command_line = upsugo_next(argc, &argv[2], (char *)list_valid_opts)) != 0) {
    mproduct_list = upsmat_instance(command_line, NULL, need_unique);
    if (UPS_ERROR != UPS_SUCCESS) {
      upserr_output();
      break;
    }
    list_output(mproduct_list, command_line);
  }
}
Exemple #4
0
void
proceed_find(MPIRPC* rpc)
{
  NOTE_F;
  KDA_Operation* op = (KDA_Operation*) rpc->extras;

  list_remove_where(op->outstanding, KDA_Neighbor_node_cmp,
                    &rpc->target);

  // NOTE("from: ");
  // NOTE(MPIRPC_Comm_get_name(rpc->target.comm));

  NOTE("outstanding: ");
  DEBUG(list_output(KDA_Neighbor_tostring, op->outstanding));

  int size;
  int n;
  char* p = rpc->result;
  sscanf(rpc->result, "%i %n", &size, &n);
  p += n;

  struct list* neighbors = KDA_Neighbor_node_list(p);
  for (struct list_item* item = neighbors->head; item;
       item = item->next)
  {
    KDA_Neighbor* neighbor = (KDA_Neighbor*) item->data;
    neighbor = check_neighbor(rpc->target, neighbor);
    if (neighbor == NULL)
      continue;

    int d = XOR(neighbor->id, op->object_id);
    if (d < op->k_closest->tail->key);
    {
      NOTE("improved");
      op->improved = true;
      // printf("inserting: %s \n", KDA_Neighbor_name(n));
      ilist_ordered_insert_unique(op->k_closest, KDA_Neighbor_cmp,
                                  d, neighbor);
      // ilist_output(KDA_Neighbor_tostring, op->k_closest);
      if (op->k_closest->size > k)
        ilist_pop(op->k_closest);
    }
  }
  list_destroy(neighbors);

  free(rpc->result);
  MPIRPC_Free(rpc);

  if (op->outstanding->size == 0)
  {
    if (op->improved)
    {
      if (! KDA_Find_node_again(op))
        KDA_Map(op);
      else
        NOTE("Doing another round.");
    }
    else
      KDA_Map(op);
  }
  NOTE_I("outstanding: ", op->outstanding->size);
  NOTE_I("contacted:   ", op->contacted->size);
  NOTE("proceed_find done");
}