Conversation
|
never really missed that class.. But I think it could be more useful if it allowed computing the average time over multiple runs instead of just auto start = cv::getTickCount();
...
(cv::getTickCount() - start)/cv::getTickFrequency(); |
|
@paroj actually it allows to calculate the average time over multiple runs output: thresholding a 1000x1000 Mat 5000 times Total Time in microseconds :317603 |
|
Hello @sturkmen72 in relation to issue #6502, do you know if the tickMeter reports the same time in both windows and linux systems? I am looking for a universal way of providing time, even if multicore processing is being used. |
|
@StevenPuttemans Sorry i have no idea about linux systems :( |
| class CV_EXPORTS_W TickMeter | ||
| { | ||
| public: | ||
| //! the default constructor |
There was a problem hiding this comment.
any help about explanation of methods is appreciated.
what i added can be seen http://pullrequest.opencv.org/buildbot/export/pr/6584/docs/d9/d6f/classcv_1_1TickMeter.html. my english is not good. so additions and corrections are welcome.
|
Time is tricky. It is so critical to modern computing there's an ISO standard: iso.20.11.7 Do your own timing with C++ methods in std::chrono and you should get comparable results on any modern OS or computer. A simple example from Stroustrup The C++ Programming Language, 4th edition. Section 35.2. steady_clock_time::time_point t = steady_clock::now(); There's nothing easier than that. Really precise timing might get weird on a "really cheap" CPU such as Raspberry Pi or Arduino. Even these errors would be so small they would likely be meaningless unless you're an astrophysicist. |
|
I kind of agree with @FredFG that the absence of ISO standards for time and the introduction of them using C++11 can help us to make a more universal approach. However, C++11 is far from the standard compiler for now, so maybe we should add the 2 cases
|
modules/core/src/system.cpp
Outdated
| startTime = 0; | ||
| } | ||
|
|
||
| std::ostream& operator << (std::ostream& out, const TickMeter& tm) { return out << tm.getTimeSec() << "sec"; } |
There was a problem hiding this comment.
This implementation is very light, so I suggest to put all methods it into header directly (if bindings generator is fine to bypass this code).
Especially for ostream-based operator <<
dd1ca6f to
34ab5c3
Compare
modules/core/src/system.cpp
Outdated
|
|
||
| #endif | ||
|
|
||
| std::ostream& operator << (std::ostream& out, const TickMeter& tm) |
There was a problem hiding this comment.
@alalek i tried to move this part in utility.hpp but get errors. what do you suggest?
indeed i see this part is trivial. it can be removed.
There was a problem hiding this comment.
What kind of errors do you have? Did you try "static inline" without CV_EXPORTS?
There was a problem hiding this comment.
@alalek thanks. it is OK with "static inline"
6898513 to
a38830e
Compare
a38830e to
d2bad6f
Compare
|
this PR will be recreated because of CI issues |
resolves #6582
What does this PR change?
moves cv::TickMeter class in the core library
initial commit