/*
 * $Id: test.h 81 2008-04-15 18:40:01Z rosiere $
 *
 * [ Description ]
 * 
 * Test "RegisterFile"
 */

#ifdef SYSTEMC
#include "systemc.h"
#endif

#include <string>
#include <iostream>
#include <sys/time.h>

#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue/include/Read_queue.h"

using namespace std;
using namespace morpheo;
using namespace morpheo::behavioural;
using namespace morpheo::behavioural::core;
using namespace morpheo::behavioural::core::multi_execute_loop;
using namespace morpheo::behavioural::core::multi_execute_loop::execute_loop;
using namespace morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit;
using namespace morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit;
using namespace morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::read_queue;

void test    (string name,
	      morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::read_queue::Parameters * param);

class Time 
{
private : timeval time_begin;
// private : timeval time_end;
  
public  : Time ()
  {
    gettimeofday(&time_begin     ,NULL);
  };

public  : ~Time ()
  {
    cout << *this;
  };

public  : friend ostream& operator<< (ostream& output_stream,
				      const Time & x)
  {
    timeval time_end;
    
    gettimeofday(&time_end       ,NULL);
    
    uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());

    double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec);
    
    output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << endl;

    return output_stream;
  }
};
