A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[mc] Fix mc_translate_address() for MC_REGION_STORAGE_TYPE_PRIVATIZED:
[simgrid.git]
/
contrib
/
benchmarking_code_block
/
inject.h
diff --git
a/contrib/benchmarking_code_block/inject.h
b/contrib/benchmarking_code_block/inject.h
index
ba23a65
..
57e2c82
100644
(file)
--- a/
contrib/benchmarking_code_block/inject.h
+++ b/
contrib/benchmarking_code_block/inject.h
@@
-1,3
+1,9
@@
+/* Copyright (c) 2013-2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* 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. */
+
/* Copy to src/include/xbt/ folder */
/* Injecting timings for previously benchmarked code blocks */
/* Copy to src/include/xbt/ folder */
/* Injecting timings for previously benchmarked code blocks */
@@
-18,13
+24,14
@@
#include "xbt/dict.h"
#include "xbt/sysdep.h"
#include "xbt/dict.h"
#include "xbt/sysdep.h"
-#define MAX_LINE_INJ 1000
+#define MAX_LINE_INJ 1000
0
/*
* Histogram entry for each measured block
* Each entry is guarded inside xbt dictionary which is read from the file */
typedef struct xbt_hist {
int n;
/*
* Histogram entry for each measured block
* Each entry is guarded inside xbt dictionary which is read from the file */
typedef struct xbt_hist {
int n;
+ int counts;
double mean;
double *breaks;
double *percentage;
double mean;
double *breaks;
double *percentage;
@@
-62,7
+69,7
@@
static inline void xbt_inject_init(char *inputfile)
printf("Error input file is empty!");//Skipping first row
while (fgets(line, 200, fpInput) != NULL)
{
printf("Error input file is empty!");//Skipping first row
while (fgets(line, 200, fpInput) != NULL)
{
- key = strtok(line, "
\t");
+ key = strtok(line, "\t");
data = xbt_dict_get_or_null(mydict, key);
if (data)
data = xbt_dict_get_or_null(mydict, key);
if (data)
@@
-71,15
+78,16
@@
static inline void xbt_inject_init(char *inputfile)
data = (xbt_hist_t *) xbt_new(xbt_hist_t, 1);
data->block_id = key;
data = (xbt_hist_t *) xbt_new(xbt_hist_t, 1);
data->block_id = key;
- data->mean = atof(strtok(NULL, " \t"));
- data->n = atoi(strtok(NULL, " \t"));
+ data->counts = atoi(strtok(NULL, "\t"));
+ data->mean = atof(strtok(NULL, "\t"));
+ data->n = atoi(strtok(NULL, "\t"));
data->breaks = (double*) malloc(sizeof(double) * data->n);
data->percentage = (double*) malloc(sizeof(double) * (data->n - 1));
for (i = 0; i < data->n; i++)
data->breaks = (double*) malloc(sizeof(double) * data->n);
data->percentage = (double*) malloc(sizeof(double) * (data->n - 1));
for (i = 0; i < data->n; i++)
- data->breaks[i] = atof(strtok(NULL, "
\t"));
+ data->breaks[i] = atof(strtok(NULL, "\t"));
for (i = 0; i < (data->n - 1); i++)
for (i = 0; i < (data->n - 1); i++)
- data->percentage[i] = atof(strtok(NULL, "
\t"));
+ data->percentage[i] = atof(strtok(NULL, "\t"));
xbt_dict_set(mydict, key, data, NULL);
}
xbt_dict_set(mydict, key, data, NULL);
}
@@
-97,7
+105,10
@@
static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre
mydict = *dict;
FILE* fpInput = fopen(inputfile, "r");
if (fpInput == NULL)
mydict = *dict;
FILE* fpInput = fopen(inputfile, "r");
if (fpInput == NULL)
+ {
printf("Error while opening the inputfile");
printf("Error while opening the inputfile");
+ return;
+ }
fseek(fpInput, 0, 0);
fseek(fpInput, 0, 0);
@@
-107,12
+118,15
@@
static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre
xbt_hist_t* data;
if (fgets(line, MAX_LINE_INJ, fpInput) == NULL)
xbt_hist_t* data;
if (fgets(line, MAX_LINE_INJ, fpInput) == NULL)
+ {
printf("Error input file is empty!");//Skipping first row
printf("Error input file is empty!");//Skipping first row
+ return;
+ }
while (fgets(line, MAX_LINE_INJ, fpInput) != NULL)
{
while (fgets(line, MAX_LINE_INJ, fpInput) != NULL)
{
- key = strtok(line, "
\t");
+ key = strtok(line, "\t");
data = xbt_dict_get_or_null(mydict, key);
if (data)
data = xbt_dict_get_or_null(mydict, key);
if (data)
@@
-120,16
+134,17
@@
static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre
data = (xbt_hist_t *) xbt_new(xbt_hist_t, 1);
data->block_id = key;
data = (xbt_hist_t *) xbt_new(xbt_hist_t, 1);
data->block_id = key;
- data->mean = atof(strtok(NULL, " \t"));
- data->n = atoi(strtok(NULL, " \t"));
+ data->counts = atoi(strtok(NULL, "\t"));
+ data->mean = atof(strtok(NULL, "\t"));
+ data->n = atoi(strtok(NULL, "\t"));
data->breaks = (double*) malloc(sizeof(double) * data->n);
data->percentage = (double*) malloc(sizeof(double) * (data->n - 1));
for (i = 0; i < data->n; i++)
data->breaks = (double*) malloc(sizeof(double) * data->n);
data->percentage = (double*) malloc(sizeof(double) * (data->n - 1));
for (i = 0; i < data->n; i++)
- data->breaks[i] = atof(strtok(NULL, "
\t"));
+ data->breaks[i] = atof(strtok(NULL, "\t"));
for (i = 0; i < (data->n - 1); i++)
{
for (i = 0; i < (data->n - 1); i++)
{
- data->percentage[i] = atof(strtok(NULL, "
\t"));
+ data->percentage[i] = atof(strtok(NULL, "\t"));
}
xbt_dict_set(mydict, key, data, NULL);
}
xbt_dict_set(mydict, key, data, NULL);