aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/sqlite/sqlitetracing.cpp
blob: 11bfee9f19a27d333d5d5124667bfb9776a85963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "sqlitetracing.h"

#include <nanotrace/tracefile.h>

namespace Sqlite {

#ifdef ENABLE_SQLITE_TRACING

namespace {

thread_local NanotraceHR::EnabledEventQueueWithoutArguments eventQueue(NanotraceHR::traceFile());
thread_local NanotraceHR::EnabledEventQueueWithoutArguments eventQueueWithoutArguments(
    NanotraceHR::traceFile());

} // namespace

NanotraceHR::EnabledCategory &sqliteLowLevelCategory()
{
    thread_local NanotraceHR::EnabledCategory sqliteLowLevelCategory_{"sqlite low level",
                                                                      eventQueue,
                                                                      eventQueueWithoutArguments,
                                                                      sqliteLowLevelCategory};
    return sqliteLowLevelCategory_;
}

NanotraceHR::EnabledCategory &sqliteHighLevelCategory()
{
    thread_local NanotraceHR::EnabledCategory sqliteHighLevelCategory_{"sqlite high level",
                                                                       eventQueue,
                                                                       eventQueueWithoutArguments,
                                                                       sqliteHighLevelCategory};

    return sqliteHighLevelCategory_;
}

#endif

} // namespace Sqlite