Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohosjscallbatchtrace.h
Go to the documentation of this file.
1// Copyright (C) 2026 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 QOHOSJSCALLBATCHTRACE_H
5#define QOHOSJSCALLBATCHTRACE_H
6
7#include <QtCore/qglobal.h>
8#include <cstddef>
9#include <optional>
10#include <string>
11#include <vector>
12
13QT_BEGIN_NAMESPACE
14
15namespace QtOhos {
16
17// logs what QtOhos::JsCallBatch batches in the qt.ohos.jscallbatch category, used on the Qt thread only
19{
20public:
21 void recordBatchStart(const char *batchContextName);
22 void recordBatchEnd(const char *batchContextName, std::size_t queuedCallCount);
23 void recordQueuedCall(const std::string &callerContextName);
24 void recordBlockingCall(std::size_t queuedCallCount, const std::string &callerContextName);
25 void recordRunForcedBy(std::size_t queuedCallCount, const std::string &runCause);
26
27private:
28 struct TracedBatch
29 {
30 const char *contextName;
31 int callCount = 0;
32 int firstQueuedCall = 1;
33 int roundTripCount = 0;
34 std::optional<std::string> optPendingSplitCause;
35 std::vector<std::string> splitCauses;
36 };
37
38 void recordRunAtEnd(std::size_t queuedCallCount);
39 void logSummary() const;
40 std::string describeQueuedCalls(std::size_t queuedCallCount) const;
41 static std::string describeCount(int count, const char *noun);
42
43 int m_liveBatchCount = 0;
44 std::optional<TracedBatch> m_optTracedBatch;
45};
46
47}
48
49QT_END_NAMESPACE
50
51#endif
void recordRunForcedBy(std::size_t queuedCallCount, const std::string &runCause)
void recordBatchStart(const char *batchContextName)
void recordBatchEnd(const char *batchContextName, std::size_t queuedCallCount)
void recordQueuedCall(const std::string &callerContextName)
void recordBlockingCall(std::size_t queuedCallCount, const std::string &callerContextName)
Combined button and popup list for selecting options.