ucs_status_t ucs_stats_node_initv(ucs_stats_node_t *node, ucs_stats_class_t *cls, const char *name, va_list ap) { ucs_status_t status; unsigned i; /* Check class */ status = ucs_stats_name_check(cls->name); if (status != UCS_OK) { return status; } for (i = 0; i < cls->num_counters; ++i) { status = ucs_stats_name_check(cls->counter_names[i]); if (status != UCS_OK) { return status; } } /* Set up node */ node->cls = cls; vsnprintf(node->name, UCS_STAT_NAME_MAX, name, ap); ucs_list_head_init(&node->children[UCS_STATS_INACTIVE_CHILDREN]); ucs_list_head_init(&node->children[UCS_STATS_ACTIVE_CHILDREN]); memset(node->counters, 0, cls->num_counters * sizeof(ucs_stats_counter_t)); return UCS_OK; }
UCS_CLASS_INIT_FUNC(uct_ud_ep_t, uct_ud_iface_t *iface) { ucs_trace_func(""); memset(self, 0, sizeof(*self)); UCS_CLASS_CALL_SUPER_INIT(uct_base_ep_t, &iface->super.super); self->dest_ep_id = UCT_UD_EP_NULL_ID; uct_ud_ep_reset(self); ucs_list_head_init(&self->cep_list); uct_ud_iface_add_ep(iface, self); UCT_UD_EP_HOOK_INIT(self); ucs_debug("NEW EP: iface=%p ep=%p id=%d", iface, self, self->ep_id); return UCS_OK; }
ucs_status_t ucs_twheel_init(ucs_twheel_t *twheel, ucs_time_t resolution) { unsigned i; twheel->res = ucs_roundup_pow2(resolution); twheel->res_order = (unsigned) ucs_log2(twheel->res); twheel->num_slots = 1024; twheel->current = 0; twheel->now = ucs_get_time(); twheel->wheel = malloc(sizeof(*twheel->wheel) * twheel->num_slots); for (i = 0; i < twheel->num_slots; i++) { ucs_list_head_init(&twheel->wheel[i]); } ucs_debug("high res timer created log=%d resolution=%lf usec wanted: %lf usec", twheel->res_order, ucs_time_to_usec(twheel->res), ucs_time_to_usec(resolution)); return UCS_OK; }