PITimeMeasurer remove some API, add elapsedAndReset()

got rid off some warnings
This commit is contained in:
2025-01-17 11:49:24 +03:00
parent 82cda42e75
commit d01baffb0b
9 changed files with 57 additions and 58 deletions

View File

@@ -317,6 +317,14 @@ PISystemTime PITimeMeasurer::elapsed() const {
}
PISystemTime PITimeMeasurer::elapsedAndReset() {
auto ct = PISystemTime::current(true);
auto ret = ct - t_st;
t_st = ct;
return ret;
}
// PISystemTime::Frequency
PISystemTime PISystemTime::Frequency::toSystemTime() const {

View File

@@ -501,43 +501,24 @@ public:
//! \~russian Возвращает в PISystemTime время, прошедшее с последнего вызова \a reset(), либо создания измерителя.
PISystemTime elapsed() const;
double reset_time_n() const { return t_st.toNanoseconds(); }
double reset_time_u() const { return t_st.toMicroseconds(); }
double reset_time_m() const { return t_st.toMilliseconds(); }
double reset_time_s() const { return t_st.toSeconds(); }
//! \~\brief
//! \~english Returns PISystemTime elapsed from last \a reset() execution or from timer measurer creation and call \a reset().
//! \~russian Возвращает в PISystemTime время, прошедшее с последнего вызова \a reset(), либо создания измерителя, и вызывает \a
//! reset().
PISystemTime elapsedAndReset();
//! \~\brief
//! \~english Returns time mark of last \a reset() execution or timer measurer creation.
//! \~russian Возвращает отметку времени последнего вызова \a reset(), либо создания измерителя.
PISystemTime reset_time() { return t_st; }
PISystemTime reset_time() DEPRECATEDM("use PISystemTime::resetTime()") { return t_st; }
//! \~\brief
//! \~english Returns nanoseconds representation of current system time.
//! \~russian Возвращает в наносекундах системное время.
static double elapsed_system_n() { return PISystemTime::current(true).toNanoseconds(); }
//! \~\brief
//! \~english Returns microseconds representation of current system time.
//! \~russian Возвращает в микросекундах системное время.
static double elapsed_system_u() { return PISystemTime::current(true).toMicroseconds(); }
//! \~\brief
//! \~english Returns milliseconds representation of current system time.
//! \~russian Возвращает в милисекундах системное время.
static double elapsed_system_m() { return PISystemTime::current(true).toMilliseconds(); }
//! \~\brief
//! \~english Returns seconds representation of current system time.
//! \~russian Возвращает в секундах системное время.
static double elapsed_system_s() { return PISystemTime::current(true).toSeconds(); }
//! \~\brief
//! \~english Returns time mark of current system time.
//! \~russian Возвращает системное время.
static PISystemTime elapsed_system() { return PISystemTime::current(true); }
//! \~english Returns time mark of last \a reset() execution or timer measurer creation.
//! \~russian Возвращает отметку времени последнего вызова \a reset(), либо создания измерителя.
PISystemTime resetTime() const { return t_st; }
private:
PISystemTime t_st, t_cur;
PISystemTime t_st;
};
#endif // PITIME_H