added printing info how much time winix spent in the ezc engine
added to Request: timespec timespec_req_stop; timespec timespec_req_diff; timespec timespec_ezc_engine_start; timespec timespec_ezc_engine_stop;
This commit is contained in:
@@ -1472,5 +1472,44 @@ bool wide_to_utf8(const std::wstring & wide_string, char * utf8, size_t utf8_siz
|
||||
}
|
||||
|
||||
|
||||
void calculate_timespec_diff(timespec & start, timespec & stop, timespec & result)
|
||||
{
|
||||
/*
|
||||
* copied from macro timespecsub(tsp, usp, vsp) which is defined in sys/time.h
|
||||
*/
|
||||
|
||||
result.tv_sec = stop.tv_sec - start.tv_sec;
|
||||
result.tv_nsec = stop.tv_nsec - start.tv_nsec;
|
||||
|
||||
if( result.tv_nsec < 0 )
|
||||
{
|
||||
result.tv_sec--;
|
||||
result.tv_nsec += 1000000000L;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
double timespec_to_double(timespec & val)
|
||||
{
|
||||
double val_double = val.tv_sec + val.tv_nsec / 1000000000.0;
|
||||
return val_double;
|
||||
}
|
||||
|
||||
|
||||
void timespec_to_stream(timespec & val, pt::Stream & stream)
|
||||
{
|
||||
char buf[50];
|
||||
|
||||
double val_double = timespec_to_double(val);
|
||||
sprintf(buf, "%g", val_double);
|
||||
SetNonZeroDigitsAfterComma(buf, 2);
|
||||
|
||||
stream << buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
||||
Reference in New Issue
Block a user