@@ -309,11 +309,12 @@ class CV_EXPORTS_W TickMeter
309
309
// ! stops counting ticks.
310
310
CV_WRAP void stop ()
311
311
{
312
- int64 time = cv::getTickCount ();
312
+ const int64 time = cv::getTickCount ();
313
313
if (startTime == 0 )
314
314
return ;
315
315
++counter;
316
- sumTime += (time - startTime);
316
+ lastTime = time - startTime;
317
+ sumTime += lastTime;
317
318
startTime = 0 ;
318
319
}
319
320
@@ -336,11 +337,35 @@ class CV_EXPORTS_W TickMeter
336
337
}
337
338
338
339
// ! returns passed time in seconds.
339
- CV_WRAP double getTimeSec () const
340
+ CV_WRAP double getTimeSec () const
340
341
{
341
342
return (double )getTimeTicks () / getTickFrequency ();
342
343
}
343
344
345
+ // ! returns counted ticks of the last iteration.
346
+ CV_WRAP int64 getLastTimeTicks () const
347
+ {
348
+ return lastTime;
349
+ }
350
+
351
+ // ! returns passed time of the last iteration in microseconds.
352
+ CV_WRAP double getLastTimeMicro () const
353
+ {
354
+ return getLastTimeMilli ()*1e3 ;
355
+ }
356
+
357
+ // ! returns passed time of the last iteration in milliseconds.
358
+ CV_WRAP double getLastTimeMilli () const
359
+ {
360
+ return getLastTimeSec ()*1e3 ;
361
+ }
362
+
363
+ // ! returns passed time of the last iteration in seconds.
364
+ CV_WRAP double getLastTimeSec () const
365
+ {
366
+ return (double )getLastTimeTicks () / getTickFrequency ();
367
+ }
368
+
344
369
// ! returns internal counter value.
345
370
CV_WRAP int64 getCounter () const
346
371
{
@@ -373,15 +398,17 @@ class CV_EXPORTS_W TickMeter
373
398
// ! resets internal values.
374
399
CV_WRAP void reset ()
375
400
{
376
- startTime = 0 ;
377
- sumTime = 0 ;
378
401
counter = 0 ;
402
+ sumTime = 0 ;
403
+ startTime = 0 ;
404
+ lastTime = 0 ;
379
405
}
380
406
381
407
private:
382
408
int64 counter;
383
409
int64 sumTime;
384
410
int64 startTime;
411
+ int64 lastTime;
385
412
};
386
413
387
414
/* * @brief output operator
0 commit comments