static int test_port_stats(void) { struct ind_core_port *handle1, *handle2; indigo_core_port_register(1, &handle1); indigo_core_port_register(2, &handle2); /* Request for OFPP_ANY */ memset(port_counters, 0, sizeof(port_counters)); of_port_stats_request_t *obj = of_port_stats_request_new(OF_VERSION_1_4); of_port_stats_request_port_no_set(obj, OF_PORT_DEST_WILDCARD); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].stats == 1); AIM_TRUE_OR_DIE(port_counters[2].stats == 1); /* Request for a single port */ memset(port_counters, 0, sizeof(port_counters)); obj = of_port_stats_request_new(OF_VERSION_1_4); of_port_stats_request_port_no_set(obj, 2); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].stats == 0); AIM_TRUE_OR_DIE(port_counters[2].stats == 1); indigo_core_port_unregister(handle1); indigo_core_port_unregister(handle2); return TEST_PASS; }
static int test_port_stats_multipart(void) { int i; struct ind_core_port *port_handles[OFSTATEMANAGER_CONFIG_MAX_PORTS]; for (i = 0; i < OFSTATEMANAGER_CONFIG_MAX_PORTS; i++) { indigo_core_port_register(i, &port_handles[i]); } memset(port_counters, 0, sizeof(port_counters)); of_port_stats_request_t *obj = of_port_stats_request_new(OF_VERSION_1_4); of_port_stats_request_port_no_set(obj, OF_PORT_DEST_WILDCARD); handle_message(obj); do_barrier(); for (i = 0; i < OFSTATEMANAGER_CONFIG_MAX_PORTS; i++) { AIM_TRUE_OR_DIE(port_counters[i].stats == 1); } for (i = 0; i < OFSTATEMANAGER_CONFIG_MAX_PORTS; i++) { indigo_core_port_unregister(port_handles[i]); } return TEST_PASS; }
static int test_queue_desc_stats_multipart(void) { int i, j; struct ind_core_port *port_handles[OFSTATEMANAGER_CONFIG_MAX_PORTS]; struct ind_core_queue *queue_handles[OFSTATEMANAGER_CONFIG_MAX_PORTS]; const int qid = 3; for (i = 0; i < OFSTATEMANAGER_CONFIG_MAX_PORTS; i++) { indigo_core_port_register(i, &port_handles[i]); indigo_core_queue_register(i, qid, &queue_handles[i]); } memset(port_counters, 0, sizeof(port_counters)); of_queue_desc_stats_request_t *obj = of_queue_desc_stats_request_new(OF_VERSION_1_4); of_queue_desc_stats_request_port_no_set(obj, OF_PORT_DEST_WILDCARD); of_queue_desc_stats_request_queue_id_set(obj, OF_QUEUE_ALL); handle_message(obj); do_barrier(); for (i = 0; i < OFSTATEMANAGER_CONFIG_MAX_PORTS; i++) { for (j = 0; j < QUEUES_PER_PORT; j++) { AIM_TRUE_OR_DIE(port_counters[i].queue_desc_stats[j] == (j == qid)? 1: 0); } } for (i = 0; i < OFSTATEMANAGER_CONFIG_MAX_PORTS; i++) { indigo_core_queue_unregister(queue_handles[i]); indigo_core_port_unregister(port_handles[i]); } return TEST_PASS; }
// NOTE! Any changes made here should also be made // in FastScanClosure::do_oop_work() template <class T> inline void ScanClosure::do_oop_work(T* p) { T heap_oop = oopDesc::load_heap_oop(p); // Should we copy the obj? if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); if ((HeapWord*)obj < _boundary) { assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?"); oop new_obj = obj->is_forwarded() ? obj->forwardee() : _g->copy_to_survivor_space(obj); oopDesc::encode_store_heap_oop_not_null(p, new_obj); } if (_gc_barrier) { // Now call parent closure do_barrier(p); } } }
// NOTE! Any changes made here should also be made // in ScanClosure::do_oop(); void FastScanClosure::do_oop(oop* p) { oop obj = *p; // Should we copy the obj? if (obj != NULL) { if ((HeapWord*)obj < _boundary) { assert(!_g->to()->contains(obj), "Scanning field twice?"); if (obj->is_forwarded()) { *p = obj->forwardee(); } else { *p = _g->copy_to_survivor_space(obj, p); } if (_gc_barrier) { // Now call parent closure do_barrier(p); } } } }
void TrainScanClosure::do_oop(oop* p) { oop obj = *p; // Should we copy the obj? if (obj != NULL) { if (_tg->car_table()->desc_for(obj)->target()) { if (obj->is_forwarded()) { *p = obj->forwardee(); } else { assert(_tg->is_in(obj), "invalid ref"); CarTableDesc* to_desc = _tg->car_table()->desc_for(obj); CarTableDesc* first_desc = _tg->first_car_desc(); julong to_desc_train_number = to_desc->train_number(); if (to_desc_train_number <= first_desc->train_number()) { if (to_desc_train_number == CarTableDesc::special_nonoop_train_number) { to_desc->space()->set_marked(true); } else { assert(to_desc_train_number == first_desc->train_number(), "invalid train number"); _ref_to_first_train_found = true; if (first_desc->car_number() == to_desc->car_number()) { *p = _tg->copy_to_train(obj, p); } } } } } if (_rs_update) { // Update train remembered set if reference is in this generation. // This check is required whether the object moved or not; for // example, we might just be scanning followers. _tg->oop_update_remembered_set(p); } if (_gc_barrier) { // Scanning oops in an older generation, call parent closure do_barrier(p); } } }
static int test_port_desc_stats(void) { struct ind_core_port *handle1, *handle2; indigo_core_port_register(1, &handle1); indigo_core_port_register(2, &handle2); memset(port_counters, 0, sizeof(port_counters)); of_port_desc_stats_request_t *obj = of_port_desc_stats_request_new(OF_VERSION_1_4); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].desc_stats == 1); AIM_TRUE_OR_DIE(port_counters[2].desc_stats == 1); indigo_core_port_unregister(handle1); indigo_core_port_unregister(handle2); return TEST_PASS; }
static int test_queue_desc_stats(void) { struct ind_core_port *handle1, *handle2; indigo_core_port_register(1, &handle1); indigo_core_port_register(2, &handle2); struct ind_core_queue *queue1_3, *queue1_4, *queue2_3, *queue2_4; indigo_core_queue_register(1, 3, &queue1_3); indigo_core_queue_register(1, 4, &queue1_4); indigo_core_queue_register(2, 3, &queue2_3); indigo_core_queue_register(2, 4, &queue2_4); /* Request for OFPP_ANY, OF_QUEUE_ALL */ memset(port_counters, 0, sizeof(port_counters)); of_queue_desc_stats_request_t *obj = of_queue_desc_stats_request_new(OF_VERSION_1_4); of_queue_desc_stats_request_port_no_set(obj, OF_PORT_DEST_WILDCARD); of_queue_desc_stats_request_queue_id_set(obj, OF_QUEUE_ALL); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[3] == 1); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[4] == 1); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[3] == 1); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[4] == 1); /* Request for a single port, OF_QUEUE_ALL */ memset(port_counters, 0, sizeof(port_counters)); obj = of_queue_desc_stats_request_new(OF_VERSION_1_4); of_queue_desc_stats_request_port_no_set(obj, 2); of_queue_desc_stats_request_queue_id_set(obj, OF_QUEUE_ALL); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[3] == 0); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[4] == 0); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[3] == 1); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[4] == 1); /* Request for OFPP_ANY, a single queue */ memset(port_counters, 0, sizeof(port_counters)); obj = of_queue_desc_stats_request_new(OF_VERSION_1_4); of_queue_desc_stats_request_port_no_set(obj, OF_PORT_DEST_WILDCARD); of_queue_desc_stats_request_queue_id_set(obj, 4); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[3] == 0); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[4] == 1); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[3] == 0); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[4] == 1); /* Request for a single port and queue */ memset(port_counters, 0, sizeof(port_counters)); obj = of_queue_desc_stats_request_new(OF_VERSION_1_4); of_queue_desc_stats_request_port_no_set(obj, 2); of_queue_desc_stats_request_queue_id_set(obj, 4); handle_message(obj); do_barrier(); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[3] == 0); AIM_TRUE_OR_DIE(port_counters[1].queue_desc_stats[4] == 0); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[3] == 0); AIM_TRUE_OR_DIE(port_counters[2].queue_desc_stats[4] == 1); indigo_core_queue_unregister(queue1_3); indigo_core_queue_unregister(queue1_4); indigo_core_queue_unregister(queue2_3); indigo_core_queue_unregister(queue2_4); indigo_core_port_unregister(handle1); indigo_core_port_unregister(handle2); return TEST_PASS; }