1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBENCHMARKVALGRIND_P_H
5#define QBENCHMARKVALGRIND_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtTest/private/qbenchmarkmeasurement_p.h>
19#include <QtTest/private/qbenchmarkmetric_p.h>
20#include <QtCore/qmap.h>
21#include <QtCore/qstring.h>
22
23QT_REQUIRE_CONFIG(valgrind);
24
25QT_BEGIN_NAMESPACE
26
27class QBenchmarkValgrindUtils
28{
29public:
30 static bool haveValgrind();
31 static bool rerunThroughCallgrind(const QStringList &origAppArgs, int &exitCode);
32 static bool runCallgrindSubProcess(const QStringList &origAppArgs, int &exitCode);
33 static qint64 extractResult(const QString &fileName);
34 static QString getNewestFileName();
35 static qint64 extractLastResult();
36 static void cleanup();
37 static QString outFileBase(qint64 pid = -1);
38};
39
40class QBenchmarkCallgrindMeasurer : public QBenchmarkMeasurerBase
41{
42public:
43 void start() override;
44 QList<Measurement> stop() override;
45 bool isMeasurementAccepted(Measurement measurement) override;
46 int adjustIterationCount(int) override;
47 int adjustMedianCount(int) override;
48 bool needsWarmupIteration() override;
49};
50
51QT_END_NAMESPACE
52
53#endif // QBENCHMARKVALGRIND_H
54

source code of qtbase/src/testlib/qbenchmarkvalgrind_p.h