diff --git a/a.out b/a.out new file mode 100755 index 0000000..df8e890 Binary files /dev/null and b/a.out differ diff --git a/exo1 b/exo1 new file mode 100755 index 0000000..6d7d7fc Binary files /dev/null and b/exo1 differ diff --git a/exo2 b/exo2 new file mode 100755 index 0000000..7804849 Binary files /dev/null and b/exo2 differ diff --git a/exo2.1 b/exo2.1 new file mode 100755 index 0000000..55d4ca6 Binary files /dev/null and b/exo2.1 differ diff --git a/exo2.2 b/exo2.2 new file mode 100755 index 0000000..0529662 Binary files /dev/null and b/exo2.2 differ diff --git a/exo2.c b/exo2.c new file mode 100644 index 0000000..f3c7195 --- /dev/null +++ b/exo2.c @@ -0,0 +1,15 @@ +/* segment bss et data */ +#define N 100000 +//int t[N]; /* version 1 */ +int t[N]={1}; /* version 2 */ + +int main() +{ + return 0; +} + + + +// 1) Le tableau se trouve dans les données car la variables est globale. La taille n'a pas changé malgrès le changement de variables globale. +// 2) La deuxième version est plus lourde. + diff --git a/exo3 b/exo3 new file mode 100755 index 0000000..ea6bc6f Binary files /dev/null and b/exo3 differ diff --git a/exo3.1 b/exo3.1 new file mode 100755 index 0000000..8c0ec1f Binary files /dev/null and b/exo3.1 differ diff --git a/exo3.c b/exo3.c new file mode 100644 index 0000000..f32ac86 --- /dev/null +++ b/exo3.c @@ -0,0 +1,31 @@ +/* accès mémoire */ +#include +#include +#include +#define N 8192 + +int t[N][N]; + +static inline double tstamp(void) +{ + struct timespec tv; + clock_gettime(CLOCK_REALTIME, &tv); + return tv.tv_sec + tv.tv_nsec * 1.0e-9; +} + +int main() +{ + int i,j; + double t1,t2; + t1=tstamp(); + /* version 1 */ // for(i=0;i +#include +#include +#include +#include +static inline double tstamp(void) +{ + struct timespec tv; + clock_gettime(CLOCK_REALTIME, &tv); + return tv.tv_sec + tv.tv_nsec * 1.0e-9; +} +void shuffle(int *array, size_t n) +{ + if (n > 1) + { + size_t i; +// for (i = 0; i < n - 1; i++) + for (i = 0; i < n ; i++) + { +// size_t j = i + rand() / (RAND_MAX / (n - i) + 1); + size_t j = rand()%n; + int t = array[j]; + array[j] = array[i]; + array[i] = t; + } + } +} +void init_access_c(int access[],size_t size) +{ + int i; + for(i=0;i