mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Only start Section's timer if the duration will be used
This is a small potential runtime optimization on systems with virtual syscalls, and a significant runtime optimization on systems without.
This commit is contained in:
parent
5ca68829e1
commit
5f6990d746
@ -16,7 +16,11 @@ namespace Catch {
|
||||
: m_info( info ),
|
||||
m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
|
||||
{
|
||||
m_timer.start();
|
||||
// Non-"included" sections will not use the timing information
|
||||
// anyway, so don't bother with the potential syscall.
|
||||
if (m_sectionIncluded) {
|
||||
m_timer.start();
|
||||
}
|
||||
}
|
||||
|
||||
Section::~Section() {
|
||||
|
Loading…
Reference in New Issue
Block a user