Last change
on this file since 139 was
138,
checked in by rosiere, 14 years ago
|
1) add counters_t type for interface
2) fix in check load in load_store_unit
3) add parameters (but not yet implemented)
4) change environment and add script (distcc_env.sh ...)
5) add warning if an unser change rename flag with l.mtspr instruction
6) ...
|
-
Property svn:keywords set to
Id
|
File size:
1.4 KB
|
Rev | Line | |
---|
[88] | 1 | #ifndef Morpheo_Time_h |
---|
| 2 | #define Morpheo_Time_h |
---|
[71] | 3 | |
---|
| 4 | #ifdef SYSTEMC |
---|
| 5 | #include "systemc.h" |
---|
| 6 | #endif |
---|
| 7 | |
---|
| 8 | #include <string> |
---|
| 9 | #include <iostream> |
---|
| 10 | #include <sys/time.h> |
---|
[113] | 11 | #include "Common/include/Systemc.h" |
---|
[138] | 12 | #include "Common/include/Message.h" |
---|
[71] | 13 | |
---|
[88] | 14 | namespace morpheo { |
---|
| 15 | |
---|
[71] | 16 | class Time |
---|
| 17 | { |
---|
[88] | 18 | #ifdef SYSTEMC |
---|
[97] | 19 | private : const bool systemc; |
---|
| 20 | private : double nb_cycles_begin; |
---|
[88] | 21 | #endif |
---|
[97] | 22 | private : timeval time_begin; |
---|
[71] | 23 | // private : timeval time_end; |
---|
| 24 | |
---|
[97] | 25 | public : Time (bool systemc=true) |
---|
| 26 | #ifdef SYSTEMC |
---|
| 27 | : |
---|
| 28 | systemc (systemc) |
---|
| 29 | #endif |
---|
[88] | 30 | { |
---|
| 31 | #ifdef SYSTEMC |
---|
[113] | 32 | nb_cycles_begin = simulation_cycle(); |
---|
[88] | 33 | #endif |
---|
| 34 | gettimeofday(&time_begin,NULL); |
---|
[71] | 35 | }; |
---|
[88] | 36 | |
---|
[71] | 37 | public : ~Time () |
---|
| 38 | { |
---|
| 39 | std::cout << *this; |
---|
| 40 | }; |
---|
| 41 | |
---|
[88] | 42 | public : friend std::ostream& operator<< (std::ostream& output, |
---|
[71] | 43 | const Time & x) |
---|
| 44 | { |
---|
| 45 | timeval time_end; |
---|
| 46 | |
---|
[88] | 47 | gettimeofday(&time_end,NULL); |
---|
[71] | 48 | |
---|
[88] | 49 | #ifdef SYSTEMC |
---|
[97] | 50 | if (x.systemc) |
---|
| 51 | { |
---|
[113] | 52 | double nb_cycles_end = simulation_cycle(); |
---|
[97] | 53 | double average = static_cast<double>(nb_cycles_end-x.nb_cycles_begin+1) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec+1); |
---|
| 54 | |
---|
| 55 | output << "Timing : " << nb_cycles_end << " cycles \t(" << average << " cycles/s)" << std::endl; |
---|
| 56 | } |
---|
| 57 | else |
---|
[88] | 58 | #endif |
---|
[97] | 59 | { |
---|
| 60 | double average = static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec+1); |
---|
| 61 | |
---|
| 62 | output << "Timing : " << average << " s" << std::endl; |
---|
| 63 | } |
---|
| 64 | |
---|
[88] | 65 | return output; |
---|
[71] | 66 | } |
---|
| 67 | }; |
---|
| 68 | |
---|
[88] | 69 | }; // end namespace morpheo |
---|
| 70 | |
---|
[71] | 71 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.