Index: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.c
===================================================================
--- trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.c	(revision 134)
+++ trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.c	(revision 140)
@@ -6,50 +6,84 @@
 void benchmark (void)
 {
-  /* if(procnum() != 0) */
-  /*   EXIT(0); */
-
-  int result = 0;
+  int result      = 0;
+  int num_cpu     = procnum();
   int cycle_begin = cycle_begin = cpu_cycles();
-
-  switch (procnum())
-    {
-    default :
-      {
+  
+  if (num_cpu < BENCHMARK_NB_THREAD)
+   switch (num_cpu)
+     {
+     default :
+        {
 #if BENCHMARK_MATRIX_MULTIPLICATION_MT
-        int result_mm_mt = benchmark_matrix_multiplication_mt();
-        result += result_mm_mt;
+          int result_mm_mt = benchmark_matrix_multiplication_mt();
+          result += result_mm_mt;
 #endif
 #if BENCHMARK_DHRYSTONE
-        int result_dhrystone = benchmark_dhrystone();
-        result += result_dhrystone;
+          int result_dhrystone = benchmark_dhrystone();
+          result += result_dhrystone;
 #endif
-#if BENCHMARK_SORT
-        int result_sort = benchmark_sort();
-        result += result_sort;
+#if BENCHMARK_SORT_ALL
+          int result_sort_all = benchmark_sort_all();
+          result += result_sort_all;
+#endif
+#if BENCHMARK_SORT_BUBBLE
+          int result_sort_bubble = benchmark_sort_bubble();
+          result += result_sort_bubble;
+#endif
+#if BENCHMARK_SORT_INSERTION
+          int result_sort_insertion = benchmark_sort_insertion();
+          result += result_sort_insertion;
+#endif
+#if BENCHMARK_SORT_SELECTION
+          int result_sort_selection = benchmark_sort_selection();
+          result += result_sort_selection;
+#endif
+#if BENCHMARK_SORT_SHELL
+          int result_sort_shell = benchmark_sort_shell();
+          result += result_sort_shell;
 #endif
 #if BENCHMARK_MATRIX_MULTIPLICATION_ST
-        int result_mm_st = benchmark_matrix_multiplication_st();
-        result += result_mm_st;
+          int result_mm_st = benchmark_matrix_multiplication_st();
+          result += result_mm_st;
 #endif
-
-        printf("\n");
-        printf("--------------------------------\n");
-        printf( "Partial results :\n");
+#if BENCHMARK_SELF_CODE_MODIFYING
+          int result_self_code_modifying = benchmark_self_code_modifying();
+          result += result_self_code_modifying;
+#endif
+          
+          printf("\n");
+          printf("--------------------------------\n");
+          printf( "Partial results :\n");
 #if BENCHMARK_MATRIX_MULTIPLICATION_MT
-        printf(" * MM MT           : %d\n",result_mm_mt);
+          printf(" * MM MT               : %d\n",result_mm_mt);
 #endif
 #if BENCHMARK_DHRYSTONE
-        printf(" * DHRYSTONE       : %d\n",result_dhrystone);
+          printf(" * DHRYSTONE           : %d\n",result_dhrystone);
 #endif
-#if BENCHMARK_SORT
-        printf(" * SORT            : %d\n",result_sort);
+#if BENCHMARK_SORT_ALL
+          printf(" * SORT_ALL            : %d\n",result_sort_all);
+#endif
+#if BENCHMARK_SORT_BUBBLE
+          printf(" * SORT_BUBBLE         : %d\n",result_sort_bubble);
+#endif
+#if BENCHMARK_SORT_INSERTION
+          printf(" * SORT_INSERTION      : %d\n",result_sort_insertion);
+#endif
+#if BENCHMARK_SORT_SELECTION
+          printf(" * SORT_SELECTION      : %d\n",result_sort_selection);
+#endif
+#if BENCHMARK_SORT_SHELL
+          printf(" * SORT_SHELL          : %d\n",result_sort_shell);
 #endif
 #if BENCHMARK_MATRIX_MULTIPLICATION_ST
-        printf(" * MM ST           : %d\n",result_mm_st);
+          printf(" * MM ST               : %d\n",result_mm_st);
 #endif 
-        printf("--------------------------------\n");
-       break;
+#if BENCHMARK_SELF_CODE_MODIFYING
+          printf(" * SELF_CODE_MODIFYING : %d\n",result_self_code_modifying);
+#endif
+          printf("--------------------------------\n");
+          break;
+        }
       }
-    }
 
   printf("\n");
Index: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.h
===================================================================
--- trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.h	(revision 134)
+++ trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.h	(revision 140)
@@ -5,5 +5,9 @@
 
 void benchmark                         (void);
-int  benchmark_sort                    (void);
+int  benchmark_sort_all                (void);
+int  benchmark_sort_bubble             (void);
+int  benchmark_sort_insert             (void);
+int  benchmark_sort_selection          (void);
+int  benchmark_sort_shell              (void);
 int  benchmark_dhrystone               (void);
 int  benchmark_matrix_multiplication_st(void);
Index: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_matrix_multiplication.c
===================================================================
--- trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_matrix_multiplication.c	(revision 134)
+++ trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_matrix_multiplication.c	(revision 140)
@@ -127,7 +127,9 @@
   /* matrix_multiplication_print(matrix_local_d, size); */
   
+#if VERIFICATION_MATRIX_MULTIPLICATION
   printf(" * Verification... ");
   
   benchmark_matrix_validation (matrix_local_d, size);
+#endif
   
   printf(" * Free...\n");
@@ -230,7 +232,9 @@
   if (matrix_nb_thread_stop == matrix_nb_thread_start)
     {
+#if VERIFICATION_MATRIX_MULTIPLICATION
       printf(" * Verification... ");
 
       benchmark_matrix_validation (matrix_global_d, size);
+#endif
       
       printf(" * Free...\n");
Index: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_self_code_modifying.c
===================================================================
--- trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_self_code_modifying.c	(revision 140)
+++ trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_self_code_modifying.c	(revision 140)
@@ -0,0 +1,31 @@
+#include "benchmark.h"
+#include "system.h"
+#include "stdlib.h"
+#include "stdio.h"
+#include "../self_code_modifying/self_code_modifying.h"
+
+static uint32_t nb_thread;
+
+int _benchmark_self_code_modifying (unsigned int nb_runs)
+{
+  printf("\n");
+  printf("================================\n");
+  printf("Benchmark Self_Code_Modifying\n");
+  printf("================================\n");
+  printf("\n");
+
+  int result = 0;
+  
+  if (atomic_inc(&nb_thread) == 1)
+    {
+      result = self_code_modifying(nb_runs);
+    }
+  else
+    {
+      printf("The self_code_modifying benchmark is not multi threaded.\n");
+    }
+    
+  return result;
+}
+
+int benchmark_self_code_modifying (void) { return _benchmark_self_code_modifying(SELF_CODE_MODIFYING_NB_RUNS); }
Index: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_sort.c
===================================================================
--- trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_sort.c	(revision 134)
+++ trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_sort.c	(revision 140)
@@ -9,5 +9,82 @@
 static uint32_t sort_lock;
 
-int _benchmark_sort (unsigned int size)
+int _benchmark_sort (sort_t sort_type,
+                     unsigned int size)
+{
+  printf(" * Size : %d\n",size);
+
+  unsigned int* SortArray;
+  
+  int cycle_begin;
+
+  int num_cpu=procnum();
+  
+  printf(" * Algo : %s\n",sort_str(sort_type));
+  
+  printf("   * Init...\n");
+  
+  lock_lock(&sort_lock);
+  SortArray = (unsigned int*) malloc(size*sizeof(unsigned int));
+  lock_unlock(&sort_lock);
+  
+  unsigned int seed = num_cpu;
+  int i;
+  for (i=0; i<size; ++i)
+    {
+      seed = seed * 1103515245 + 12345;
+      SortArray[i] = seed&0xff;
+    }
+  printf("   * Sort... \n");
+  
+  cycle_begin = cpu_cycles();
+  sort((unsigned int *) (SortArray), (unsigned int) size, sort_type);
+  int cycle_exec = cpu_cycles()-cycle_begin;
+  
+  printf("   * Executed in %d cycles\n",cycle_exec);
+  
+  int result = cycle_exec;
+  
+#if VERIFICATION_SORT      
+  printf("   * Verification... ");
+  
+  for (i = 1; i < size; i++)
+    {
+      /* printf("%d ",SortArray[i-1]); */
+      
+      if (SortArray[i] < SortArray[i-1])
+        {
+          printf("KO !!!\n");
+          EXIT(1);
+        }
+    }
+  printf("OK\n");
+#endif
+  
+  free (SortArray);
+
+  return result;
+}
+
+int _benchmark_sort_all (unsigned int size)
+{
+  printf("\n");
+  printf("================================\n");
+  printf("Benchmark Sort (ALL)\n");
+  printf("================================\n");
+  printf("\n");
+
+  int result = 0;
+  int num_cpu=procnum();
+  sort_t _sort_type;
+  const sort_t nb_sort_type = 4;
+  
+  for (_sort_type=0; _sort_type < nb_sort_type; _sort_type++)
+    result += _benchmark_sort((_sort_type+num_cpu)%nb_sort_type,size);
+  
+  return result;
+}
+
+int _benchmark_sort_one (sort_t sort_type,
+                         unsigned int size)
 {
   printf("\n");
@@ -17,68 +94,10 @@
   printf("\n");
 
-  printf(" * Size : %d\n",size);
-
-  unsigned int* SortArray;
-  
-  int cycle_begin, result;
-
-  result = 0;
-  
-  int p=procnum();
-  
-  sort_t _sort_type;
-  const sort_t nb_sort_type = 4;
-  
-  for (_sort_type=0; _sort_type < nb_sort_type; _sort_type++)
-    {
-      sort_t sort_type = (_sort_type+p)%nb_sort_type;
-      
-      printf(" * Algo : %s\n",sort_str(sort_type));
-      
-      printf("   * Init...\n");
-      
-      lock_lock(&sort_lock);
-      SortArray = (unsigned int*) malloc(size*sizeof(unsigned int));
-      lock_unlock(&sort_lock);
-      
-      unsigned int seed = p;
-      int i;
-      for (i=0; i<size; ++i)
-        {
-          seed = seed * 1103515245 + 12345;
-          SortArray[i] = seed&0xff;
-        }
-      printf("   * Sort... \n");
-      
-      cycle_begin = cpu_cycles();
-      sort((unsigned int *) (SortArray), (unsigned int) size, sort_type);
-      int cycle_exec = cpu_cycles()-cycle_begin;
-      
-      printf("   * Executed in %d cycles\n",cycle_exec);
-      
-      result += cycle_exec;
-      
-      printf("   * Verification... ");
-      
-      for (i = 1; i < size; i++)
-        {
-          /* printf("%d ",SortArray[i-1]); */
-          
-          if (SortArray[i] < SortArray[i-1])
-            {
-              printf("KO !!!\n");
-              EXIT(1);
-            }
-        }
-      printf("OK\n");
-
-      free (SortArray);
-
-    }
-  
-  return result;
+  return _benchmark_sort(sort_type,size);
 }
 
-int benchmark_sort (void) { return _benchmark_sort(SORT_SIZE); }
-
-  
+int benchmark_sort_all       (void) { return _benchmark_sort_all(SORT_ALL_SIZE); }
+int benchmark_sort_bubble    (void) { return _benchmark_sort_one(SORT_BUBBLE   ,SORT_BUBBLE_SIZE   ); }
+int benchmark_sort_insertion (void) { return _benchmark_sort_one(SORT_INSERTION,SORT_INSERTION_SIZE); }
+int benchmark_sort_selection (void) { return _benchmark_sort_one(SORT_SELECTION,SORT_SELECTION_SIZE); }
+int benchmark_sort_shell     (void) { return _benchmark_sort_one(SORT_SHELL    ,SORT_SHELL_SIZE    ); }
