Files
qt-creator/src/libs/utils/benchmarker.h
Tobias Hunger b41cf10d71 Utils: Make Benchmarker log to a configurable loggingcategory
Change-Id: I2bb6b42af775827dae1c1cc41f9dabf63edf58e7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-05 12:15:56 +00:00

64 lines
2.2 KiB
C++

/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "utils_global.h"
#include <QString>
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
class QLoggingCategory;
QT_END_NAMESPACE
namespace Utils {
class QTCREATOR_UTILS_EXPORT Benchmarker
{
public:
Benchmarker(const QString &testsuite, const QString &testcase,
const QString &tagData = QString());
Benchmarker(const QLoggingCategory &cat, const QString &testsuite, const QString &testcase,
const QString &tagData = QString());
~Benchmarker();
void report(qint64 ms);
static void report(const QString &testsuite, const QString &testcase,
qint64 ms, const QString &tags = QString());
static void report(const QLoggingCategory &cat,
const QString &testsuite, const QString &testcase,
qint64 ms, const QString &tags = QString());
private:
const QLoggingCategory &m_category;
QElapsedTimer m_timer;
QString m_tagData;
QString m_testsuite;
QString m_testcase;
};
} // namespace Utils