Last change
on this file since 74 was
71,
checked in by rosiere, 17 years ago
|
Modification of Statisctics
Add a new systemC component : Load_Store_Queue (tested with one benchmark and one configuration). Store don't supported the Data Buss Error (Load is supported)
|
File size:
829 bytes
|
Line | |
---|
1 | #ifndef TIME_H |
---|
2 | #define TIME_H |
---|
3 | |
---|
4 | #ifdef SYSTEMC |
---|
5 | #include "systemc.h" |
---|
6 | #endif |
---|
7 | |
---|
8 | #include <string> |
---|
9 | #include <iostream> |
---|
10 | #include <sys/time.h> |
---|
11 | |
---|
12 | class Time |
---|
13 | { |
---|
14 | private : timeval time_begin; |
---|
15 | // private : timeval time_end; |
---|
16 | |
---|
17 | public : Time () |
---|
18 | { |
---|
19 | gettimeofday(&time_begin ,NULL); |
---|
20 | }; |
---|
21 | |
---|
22 | public : ~Time () |
---|
23 | { |
---|
24 | std::cout << *this; |
---|
25 | }; |
---|
26 | |
---|
27 | public : friend std::ostream& operator<< (std::ostream& output_stream, |
---|
28 | const Time & x) |
---|
29 | { |
---|
30 | timeval time_end; |
---|
31 | |
---|
32 | gettimeofday(&time_end ,NULL); |
---|
33 | |
---|
34 | uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time()); |
---|
35 | |
---|
36 | double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec); |
---|
37 | |
---|
38 | output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << std::endl; |
---|
39 | |
---|
40 | return output_stream; |
---|
41 | } |
---|
42 | }; |
---|
43 | |
---|
44 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.