void thorium_multiplexer_policy_destroy(struct thorium_multiplexer_policy *self) { core_set_destroy(&self->actions_to_skip); self->threshold_buffer_size_in_bytes = -1; self->threshold_time_in_nanoseconds = -1; }
void thorium_message_multiplexer_destroy(struct thorium_message_multiplexer *self) { int i; int size; struct thorium_multiplexed_buffer *multiplexed_buffer; float ratio; if (thorium_node_must_print_data(self->node)) { ratio = 0.0; if (self->original_message_count != 0) { ratio = self->real_message_count / (0.0 + self->original_message_count); /* * Jack M. Nilles * "Traffic reduction by telecommuting: A status review and selected bibliography" * Transportation Research Part A: General * Volume 22, Issue 4, July 1988, Pages 301–317. * * @see http://www.sciencedirect.com/science/article/pii/0191260788900088 * @see http://ww2.cityofpasadena.net/councilagendas/2007%20agendas/feb_26_07/pasadena%20traffic%20reduction%20strategies%2011-20-06%20draft.pdf */ thorium_printf("[thorium] node %d worker %d message_multiplexer:" " original_message_count %d real_message_count %d (traffic reduction: %.2f%%)\n", thorium_node_name(self->node), thorium_worker_name(self->worker), self->original_message_count, self->real_message_count, (1.0 - ratio) * 100); thorium_message_multiplexer_print_traffic_reduction(self); } } #ifdef CORE_DEBUGGER_ASSERT_ENABLED #endif size = core_vector_size(&self->buffers); #ifdef THORIUM_MULTIPLEXER_TRACK_BUFFERS_WITH_CONTENT /* * There can be no messages that are not flushed already. */ CORE_DEBUGGER_ASSERT(core_set_empty(&self->buffers_with_content)); core_set_destroy(&self->buffers_with_content); #endif for (i = 0; i < size; ++i) { multiplexed_buffer = core_vector_at(&self->buffers, i); CORE_DEBUGGER_ASSERT(thorium_multiplexed_buffer_current_size(multiplexed_buffer) == 0); thorium_multiplexed_buffer_destroy(multiplexed_buffer); } core_vector_destroy(&self->buffers); self->node = NULL; self->buffer_size_in_bytes = -1; self->timeout_in_nanoseconds = -1; core_timer_destroy(&self->timer); #ifdef THORIUM_MULTIPLEXER_USE_TREE core_red_black_tree_destroy(&self->timeline); #elif defined(THORIUM_MULTIPLEXER_USE_HEAP) core_binary_heap_destroy(&self->timeline); #elif defined(THORIUM_MULTIPLEXER_USE_QUEUE) core_queue_destroy(&self->timeline); #endif thorium_decision_maker_destroy(&self->decision_maker); thorium_router_destroy(&self->router); }
void thorium_worker_destroy(struct thorium_worker *worker) { void *buffer; thorium_load_profiler_destroy(&worker->profiler); if (core_bitmap_get_bit_uint32_t(&worker->flags, FLAG_ENABLE_ACTOR_LOAD_PROFILER)) { core_buffered_file_writer_destroy(&worker->load_profile_writer); } core_map_destroy(&worker->actor_received_messages); /* thorium_worker_print_balance(worker); */ while (thorium_worker_fetch_clean_outbound_buffer(worker, &buffer)) { core_memory_pool_free(&worker->outbound_message_memory_pool, buffer); #ifdef THORIUM_WORKER_DEBUG_INJECTION ++worker->counter_freed_outbound_buffers_from_other_workers; #endif } #ifdef THORIUM_WORKER_DEBUG_INJECTION printf("AFTER COLLECTION\n"); thorium_worker_print_balance(worker); printf("THORIUM-> clean_message_queue_for_triage has %d items\n", core_fast_queue_size(&worker->clean_message_queue_for_triage)); printf("THORIUM-> clean_message_ring_for_triage has %d items\n", core_fast_ring_size_from_producer(&worker->clean_message_ring_for_triage)); printf("THORIUM-> injected_clean_outbound_buffers has %d items\n", core_fast_ring_size_from_producer(&worker->injected_clean_outbound_buffers)); #endif core_timer_destroy(&worker->timer); #ifdef THORIUM_WORKER_ENABLE_LOCK core_lock_destroy(&worker->lock); #endif core_fast_ring_destroy(&worker->actors_to_schedule); #ifdef THORIUM_NODE_INJECT_CLEAN_WORKER_BUFFERS core_fast_ring_destroy(&worker->injected_clean_outbound_buffers); core_fast_ring_destroy(&worker->clean_message_ring_for_triage); core_fast_queue_destroy(&worker->clean_message_queue_for_triage); #endif thorium_scheduler_destroy(&worker->scheduler); core_fast_ring_destroy(&worker->outbound_message_queue); core_fast_queue_destroy(&worker->outbound_message_queue_buffer); core_map_destroy(&worker->actors); core_map_iterator_destroy(&worker->actor_iterator); core_set_destroy(&worker->evicted_actors); worker->node = NULL; worker->name = -1; core_bitmap_set_bit_uint32_t(&worker->flags, FLAG_DEAD); core_memory_pool_destroy(&worker->ephemeral_memory); core_memory_pool_destroy(&worker->outbound_message_memory_pool); thorium_priority_assigner_destroy(&worker->assigner); }