File indexing completed on 2025-03-09 03:52:05

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-02-11
0007  * Description : a tool to show image using an OpenGL interface.
0008  *
0009  * SPDX-FileCopyrightText: 2007-2008 by Markus Leuthold <kusi at forum dot titlis dot org>
0010  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "glviewertimer.h"
0017 
0018 // Qt includes
0019 
0020 #include <QDateTime>
0021 #include <QElapsedTimer>
0022 
0023 // Local includes
0024 
0025 #include "digikam_debug.h"
0026 
0027 namespace DigikamGenericGLViewerPlugin
0028 {
0029 
0030 class Q_DECL_HIDDEN GLViewerTimer::Private
0031 {
0032 public:
0033 
0034     explicit Private()
0035     {
0036         meantime = 0;
0037     }
0038 
0039     QElapsedTimer timer;
0040     int           meantime;
0041 };
0042 
0043 GLViewerTimer::GLViewerTimer()
0044     : d(new Private)
0045 {
0046 }
0047 
0048 GLViewerTimer::~GLViewerTimer()
0049 {
0050     delete d;
0051 }
0052 
0053 void GLViewerTimer::start()
0054 {
0055     d->timer.start();
0056     d->meantime = 0;
0057 }
0058 
0059 void GLViewerTimer::at(const QString& s)
0060 {
0061     d->meantime = d->timer.elapsed() - d->meantime;
0062 
0063     qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "stopwatch:" << s
0064                                          << ": " << d->meantime
0065                                          << " ms    overall: "
0066                                          << d->timer.elapsed() << " ms";
0067 }
0068 
0069 } // namespace DigikamGenericGLViewerPlugin