70 getitimer(ITIMER_VIRTUAL, &
virt_tmr);
81 std::map<string, time_diffs>::iterator iter = prof_times.find(what);
82 if(iter==prof_times.end()){
83 prof_times[what] = tdiffs;
86 (iter->second).virt += tdiffs.
virt;
87 (iter->second).prof += tdiffs.
prof;
93 void TimeDiff(
const prof_time &other_time,
double &tdiff_real,
double &tdiff_virt,
double &tdiff_prof){
94 struct itimerval tmp_real;
95 struct itimerval tmp_virt;
96 struct itimerval tmp_prof;
102 timersub(&
real_tmr.it_value, &other_time.
real_tmr.it_value, &tmp_real.it_value);
103 timersub(&
virt_tmr.it_value, &other_time.
virt_tmr.it_value, &tmp_virt.it_value);
104 timersub(&
prof_tmr.it_value, &other_time.
prof_tmr.it_value, &tmp_prof.it_value);
106 timersub(&other_time.
real_tmr.it_value, &
real_tmr.it_value, &tmp_real.it_value);
107 timersub(&other_time.
virt_tmr.it_value, &
virt_tmr.it_value, &tmp_virt.it_value);
108 timersub(&other_time.
prof_tmr.it_value, &
prof_tmr.it_value, &tmp_prof.it_value);
110 tdiff_real = (double)tmp_real.it_value.tv_sec + (
double)tmp_real.it_value.tv_usec/1.0E6;
111 tdiff_virt = (double)tmp_virt.it_value.tv_sec + (
double)tmp_virt.it_value.tv_usec/1.0E6;
112 tdiff_prof = (double)tmp_prof.it_value.tv_sec + (
double)tmp_prof.it_value.tv_usec/1.0E6;
121 #endif // _prof_time_
void TimeDiffNow(std::map< std::string, time_diffs > &prof_times, std::string what)
struct itimerval real_tmr
struct itimerval prof_tmr
void TimeDiff(const prof_time &other_time, double &tdiff_real, double &tdiff_virt, double &tdiff_prof)
struct itimerval virt_tmr
This utility class is to help in doing detailed profiling of code. It is uses the unix itimer system ...