Coverage Report

Created: 2026-07-30 07:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/goo/GooTimer.cc
Line
Count
Source
1
//========================================================================
2
//
3
// GooTimer.cc
4
//
5
// This file is licensed under GPLv2 or later
6
//
7
// Copyright 2005 Jonathan Blandford <jrb@redhat.com>
8
// Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
9
// Copyright 2010 Hib Eris <hib@hiberis.nl>
10
// Copyright 2025 Albert Astals cid <aacid@kde.org>
11
// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team
12
//
13
//========================================================================
14
15
#include "GooTimer.h"
16
17
//------------------------------------------------------------------------
18
// GooTimer
19
//------------------------------------------------------------------------
20
21
GooTimer::GooTimer()
22
0
{
23
0
    start();
24
0
}
25
26
void GooTimer::start()
27
0
{
28
0
    start_time = std::chrono::steady_clock::now();
29
0
    active = true;
30
0
}
31
32
void GooTimer::stop()
33
0
{
34
0
    end_time = std::chrono::steady_clock::now();
35
0
    active = false;
36
0
}
37
38
double GooTimer::getElapsed()
39
0
{
40
0
    if (active) {
41
0
        end_time = std::chrono::steady_clock::now();
42
0
    }
43
44
0
    const auto microseconds = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count();
45
46
0
    return microseconds / 1000000.0;
47
0
}