@@ -340,11 +340,12 @@ class CV_EXPORTS_W TickMeter
340
340
// ! stops counting ticks.
341
341
CV_WRAP void stop ()
342
342
{
343
- int64 time = cv::getTickCount ();
343
+ const int64 time = cv::getTickCount ();
344
344
if (startTime == 0 )
345
345
return ;
346
346
++counter;
347
- sumTime += (time - startTime);
347
+ lastTime = time - startTime;
348
+ sumTime += lastTime;
348
349
startTime = 0 ;
349
350
}
350
351
@@ -367,11 +368,35 @@ class CV_EXPORTS_W TickMeter
367
368
}
368
369
369
370
// ! returns passed time in seconds.
370
- CV_WRAP double getTimeSec () const
371
+ CV_WRAP double getTimeSec () const
371
372
{
372
373
return (double )getTimeTicks () / getTickFrequency ();
373
374
}
374
375
376
+ // ! returns counted ticks of the last iteration.
377
+ CV_WRAP int64 getLastTimeTicks () const
378
+ {
379
+ return lastTime;
380
+ }
381
+
382
+ // ! returns passed time of the last iteration in microseconds.
383
+ CV_WRAP double getLastTimeMicro () const
384
+ {
385
+ return getLastTimeMilli ()*1e3 ;
386
+ }
387
+
388
+ // ! returns passed time of the last iteration in milliseconds.
389
+ CV_WRAP double getLastTimeMilli () const
390
+ {
391
+ return getLastTimeSec ()*1e3 ;
392
+ }
393
+
394
+ // ! returns passed time of the last iteration in seconds.
395
+ CV_WRAP double getLastTimeSec () const
396
+ {
397
+ return (double )getLastTimeTicks () / getTickFrequency ();
398
+ }
399
+
375
400
// ! returns internal counter value.
376
401
CV_WRAP int64 getCounter () const
377
402
{
@@ -404,15 +429,17 @@ class CV_EXPORTS_W TickMeter
404
429
// ! resets internal values.
405
430
CV_WRAP void reset ()
406
431
{
407
- startTime = 0 ;
408
- sumTime = 0 ;
409
432
counter = 0 ;
433
+ sumTime = 0 ;
434
+ startTime = 0 ;
435
+ lastTime = 0 ;
410
436
}
411
437
412
438
private:
413
439
int64 counter;
414
440
int64 sumTime;
415
441
int64 startTime;
442
+ int64 lastTime;
416
443
};
417
444
418
445
/* * @brief output operator
0 commit comments