aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/sqlite/sqlitetracing.cpp
blob: 700546f14677ae5af88706b8a5aff71652f9de53 (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
// 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"

namespace Sqlite {

TraceFile &traceFile()
{
    static TraceFile traceFile{"tracing.json"};

    return traceFile;
}

namespace {

thread_local NanotraceHR::EventQueue<NanotraceHR::StringViewWithStringArgumentsTraceEvent,
                                     sqliteTracingStatus()>
    eventQueue(traceFile());

} // namespace

NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> &sqliteLowLevelCategory()
{
    thread_local NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()>
        sqliteLowLevelCategory_{"sqlite low level"_t, eventQueue, sqliteLowLevelCategory};
    return sqliteLowLevelCategory_;
}

NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()> &sqliteHighLevelCategory()
{
    thread_local NanotraceHR::StringViewWithStringArgumentsCategory<sqliteTracingStatus()>
        sqliteHighLevelCategory_{"sqlite high level"_t, eventQueue, sqliteHighLevelCategory};

    return sqliteHighLevelCategory_;
}

} // namespace Sqlite