void monitor_schedule_run(uint32_t runnable) { load_current -= load_history[15]; // Determine load for (int l = 15; l > 0; l--) { load_history[l] = load_history[l-1]; } load_history[0] = runnable; load_current += load_history[0]; runtime_trace_load(load_current); monitor_load_array[runtime_get_instance_id()] = load_current; /* if (scheduler_needs_rebalance() != 0) { scheduler_rebalance(); }*/ update_counter++; if (update_counter == update_counter_interval) { if (communication_ready()) { for (int t = 0; t < runtime_get_num_instances(); t++) { if (t != runtime_get_instance_id()) { printf("Send load to %u\n", t); communication_send(t, SYSTEM_MESSAGE_MONITOR, &load_current, 4); } } } update_counter = 0; } }
static void inbox_received_callback(DictionaryIterator *iterator, void *context) { Tuple *message_type = dict_find(iterator, KEY_MESSAGE_TYPE); switch (message_type->value->int32) { case MESSAGE_TYPE_READY: communication_ready(); break; case MESSAGE_TYPE_WEATHER: weather_received_callback(iterator); break; case MESSAGE_TYPE_CONFIG: config_received_callback(iterator); break; } }