summaryrefslogtreecommitdiff
path: root/src/libs/utils/scopedtimer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* ScopedTimer: Make it possible to provide optional message stringJarek Kobus2023-05-171-19/+22
| | | | | | | | | | | | | When optional message argument is provided, both macros print the message instead of __FILE__ and __LINE__ info. It helps to ease the identification of the exact place in code when many macros are added - custom message may be more informative that the file and line location. Change-Id: I7a3ccbdaca2858b44dcbd51a8f9330160dab73e9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Utils: Introduce QTC_STATIC_SCOPED_TIMER()Jarek Kobus2023-05-091-0/+64
This macro, similar to QTC_SCOPED_TIMER(), measures the time spent in a block of code. In addition, the time spent in a block is saved in a static variable. This macro enables measuring a cumulative time spent inside a certain block of code for all invocations. When a long freeze is being tracked, and QTC_SCOPED_TIMER() indicates that the most of the freeze is spent inside a loop with a big amount of iterations, placing QTC_STATIC_SCOPED_TIMER() inside the loop may detect the part of the loop that composes in total for the longest freeze. In contrary to the QTC_SCOPED_TIMER(), this macro it doesn't print the message when it's entered. It prints the output at first hit, and later, as not to clog the debug output, only at 10ms resolution. Change-Id: I3360a3ab9147d544f90ce914fb78359f7179c767 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>