diff options
| author | Wiimm <wiimm@wiimm.de> | 2024-02-17 11:45:01 +0100 |
|---|---|---|
| committer | Wiimm <wiimm@wiimm.de> | 2024-02-17 11:45:01 +0100 |
| commit | 685554b2c272fdefc23bb1d237c059b52ab5fc58 (patch) | |
| tree | 9e0e7ff41f688bdc07fdb7869fc0258725197bcf /project/dclib/dclib-numeric.h | |
| parent | ac9a0b25eaffaa05e5431a8527dab8649ef6504f (diff) | |
SZS v2.41a
Diffstat (limited to '')
| -rw-r--r-- | project/dclib/dclib-numeric.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/project/dclib/dclib-numeric.h b/project/dclib/dclib-numeric.h index 1ad805c..c2ddf3b 100644 --- a/project/dclib/dclib-numeric.h +++ b/project/dclib/dclib-numeric.h @@ -261,6 +261,40 @@ bool IsSameD3 ( const double *a, const double *b, int bit_diff ); // /////////////////////////////////////////////////////////////////////////////// +/////////////// progress helper /////////////// +/////////////////////////////////////////////////////////////////////////////// +// [[progress_t]] + +// [[doxygen]] +typedef struct progress_t +{ + // all times are set by GetTimerMSec() + + u_msec_t interval_msec; // 0=off, >0: minimum distance between 2 logs + u_msec_t start_msec; // start time of progress + u_msec_t last_log_msec; // time of last log + uint counter; // current counter + uint last_counter; // count at last log +} +progress_t; + +//----------------------------------------------------------------------------- + +void StartProgress ( progress_t *pr, u_msec_t interval_msec ); +bool CheckProgress ( progress_t *pr ); +bool FinalProgress ( progress_t *pr ); + +static inline void ResetProgress ( progress_t *pr ) + { DASSERT(pr); memset(pr,0,sizeof(*pr)); } + +static inline uint IncrementProgress ( progress_t *pr ) + { DASSERT(pr); return ++pr->counter; } + +static inline uint AddProgress ( progress_t *pr, uint add ) + { DASSERT(pr); return pr->counter += add; } + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// 2D vector functions /////////////// /////////////////////////////////////////////////////////////////////////////// |
