24 #include <sys/resource.h>
26 #include <sys/times.h>
28 #define u32 unsigned int
30 #include "utilities.h"
39 #define FREQUENCY 1695000000
50 MESSAGE(
"X86_Timer Default Ctor");
55 rdtsc(_click_start.n32[0],_click_start.n32[1]);
62 rdtsc(_click_stop.n32[0],_click_stop.n32[1]);
73 return (_click_stop.n64-_click_start.n64)/double(
FREQUENCY);
80 return (_click_stop.n64-_click_start.n64);
106 _frequency=_frequency*get_elapsed_time_in_second()/double(
final-
initial);
114 _counted_clicks[get_click()]++;
115 fill_history_clicks();
121 ofstream outfile (filemane.c_str(),
ios::out) ;
123 std::map<unsigned long long , unsigned long long>::iterator itr;
124 for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++)
126 outfile << (*itr).first <<
" " << (*itr).second << endl ;
135 ofstream outfile (filemane.c_str(),
ios::out) ;
139 for(
int i=0 ;
i<_history_mean_clicks.size() ;
i++)
142 << _history_mean_clicks[
i] <<
" "
143 << _history_shortest_clicks[
i] <<
" "
144 << _history_most_occured_clicks[
i] << endl ;
155 std::map<unsigned long long,unsigned long long>::iterator itr;
157 unsigned long long mean_clicks=0;
159 for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++)
162 mean_clicks+=(*itr).second*(*itr).first;
165 return mean_clicks/double(_nb_sample);
171 return double((*_counted_clicks.begin()).first);
177 _history_mean_clicks.push_back(get_mean_clicks());
178 _history_shortest_clicks.push_back(get_shortest_clicks());
179 _history_most_occured_clicks.push_back(get_most_occured_clicks());
186 unsigned long long moc=0;
187 unsigned long long max_occurence=0;
189 std::map<unsigned long long,unsigned long long>::iterator itr;
191 for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++)
194 if (max_occurence<=(*itr).second){
195 max_occurence=(*itr).second;
206 _counted_clicks.clear();
208 _history_mean_clicks.clear();
209 _history_shortest_clicks.clear();
210 _history_most_occured_clicks.clear();
221 unsigned long int n32[2] ;
227 unsigned long int n32[2] ;
228 unsigned long long n64 ;