mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +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,8 +16,12 @@ namespace Catch {
|
|||||||
: m_info( info ),
|
: m_info( info ),
|
||||||
m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
|
m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
|
||||||
{
|
{
|
||||||
|
// Non-"included" sections will not use the timing information
|
||||||
|
// anyway, so don't bother with the potential syscall.
|
||||||
|
if (m_sectionIncluded) {
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Section::~Section() {
|
Section::~Section() {
|
||||||
if( m_sectionIncluded ) {
|
if( m_sectionIncluded ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user