static void test_heap_mean_operation(int size) { xbt_heap_t heap = xbt_heap_new(size, NULL); double date = xbt_os_time() * 1000000; for (int i = 0; i < size; i++) xbt_heap_push(heap, NULL, (10.0 * rand() / (RAND_MAX + 1.0))); date = xbt_os_time() * 1000000 - date; printf("Creation time %d size heap : %g\n", size, date); date = xbt_os_time() * 1000000; for (int j = 0; j < MAX_TEST; j++) { if (!(j % size) && j) test_reset_heap(&heap, size); double val = xbt_heap_maxkey(heap); xbt_heap_pop(heap); xbt_heap_push(heap, NULL, 3.0 * val); } date = xbt_os_time() * 1000000 - date; printf("Mean access time for a %d size heap : %g\n", size, date * 1.0 / (MAX_TEST + 0.0)); xbt_heap_free(heap); }
void test_heap_validity(int size) { xbt_heap_t heap = xbt_heap_new(size, NULL); double *tab = xbt_new0(double, size); int i; for (i = 0; i < size; i++) { tab[i] = (double) (10.0 * rand() / (RAND_MAX + 1.0)); xbt_heap_push(heap, NULL, (double) tab[i]); } qsort(tab, size, sizeof(double), compare_double); for (i = 0; i < size; i++) { /* printf("%g" " ", xbt_heap_maxkey(heap)); */ if (xbt_heap_maxkey(heap) != tab[i]) { fprintf(stderr, "Problem !\n"); exit(1); } xbt_heap_pop(heap); } xbt_heap_free(heap); free(tab); printf("Validity test complete!\n"); }
/** * @brief The destructor of the NetworkModel */ ~NetworkModel() { if (p_maxminSystem) lmm_system_free(p_maxminSystem); if (p_actionHeap) xbt_heap_free(p_actionHeap); if (p_modifiedSet) delete p_modifiedSet; }
static void test_reset_heap(xbt_heap_t * heap, int size) { xbt_heap_free(*heap); *heap = xbt_heap_new(size, NULL); for (int i = 0; i < size; i++) { xbt_heap_push(*heap, NULL, (10.0 * rand() / (RAND_MAX + 1.0))); } }
CpuCas01Model::~CpuCas01Model() { lmm_system_free(maxminSystem_); maxminSystem_ = nullptr; xbt_heap_free(actionHeap_); delete modifiedSet_; surf_cpu_model_pm = nullptr; delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }
CpuCas01Model::~CpuCas01Model() { lmm_system_free(p_maxminSystem); p_maxminSystem = NULL; if (p_actionHeap) xbt_heap_free(p_actionHeap); delete p_modifiedSet; surf_cpu_model_pm = NULL; delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }
XBT_INLINE void tmgr_history_free(tmgr_history_t h) { xbt_heap_free(h->heap); free(h); }
NetworkModel::~NetworkModel() { lmm_system_free(maxminSystem_); xbt_heap_free(actionHeap_); delete modifiedSet_; }
simgrid::trace_mgr::future_evt_set::~future_evt_set() { xbt_heap_free(p_heap); }