#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); }
