/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <math.h> // sqrt
#include "private.h"
#include "xbt/dict.h"
#include "xbt/sysdep.h"
void smpi_bench_destroy(void)
{
- if (allocs) {
- xbt_dict_free(&allocs);
- }
- if (samples) {
- xbt_dict_free(&samples);
- }
- if(calls) {
- xbt_dict_free(&calls);
- }
+ xbt_dict_free(&allocs);
+ xbt_dict_free(&samples);
+ xbt_dict_free(&calls);
}
static void smpi_execute_flops(double flops)
smpi_bench_end(); /* Take time from previous MPI call into account */
if (!samples) {
- samples = xbt_dict_new();
+ samples = xbt_dict_new_homogeneous(free);
}
data = xbt_dict_get_or_null(samples, loc);
if (!data) {
data->iters = iters;
data->threshold = threshold;
data->started = 0;
- xbt_dict_set(samples, loc, data, &free);
+ xbt_dict_set(samples, loc, data, NULL);
return 0;
}
free(loc);
shared_data_t *data;
if (!allocs) {
- allocs = xbt_dict_new();
+ allocs = xbt_dict_new_homogeneous(free);
}
data = xbt_dict_get_or_null(allocs, loc);
if (!data) {
data = (shared_data_t *) xbt_malloc0(sizeof(int) + size);
data->count = 1;
- xbt_dict_set(allocs, loc, data, &free);
+ xbt_dict_set(allocs, loc, data, NULL);
} else {
data->count++;
}
int known;
if(!calls) {
- calls = xbt_dict_new();
+ calls = xbt_dict_new_homogeneous(NULL);
}
TRY {
xbt_dict_get(calls, loc); /* Succeed or throw */
void* data;
if(!calls) {
- calls = xbt_dict_new();
+ calls = xbt_dict_new_homogeneous(NULL);
}
data = xbt_dict_get(calls, loc);
free(loc);
char* loc = bprintf("%s:%s", func, input);
if(!calls) {
- calls = xbt_dict_new();
+ calls = xbt_dict_new_homogeneous(NULL);
}
xbt_dict_set(calls, loc, data, NULL);
free(loc);