blob: ed7570a6389d6f2b4da6d7bf6a5e27c113891a54 (
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
42
43
44
45
46
47
48
49
|
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "perfresourcecounter.h"
#include <tracing/timelinemodelaggregator.h>
#include <QHash>
#include <unordered_map>
namespace PerfProfiler::Internal {
class PerfEvent;
class PerfEventType;
class PerfTimelineModel;
class PerfTimelineModelManager : public Timeline::TimelineModelAggregator
{
public:
PerfTimelineModelManager();
~PerfTimelineModelManager();
void loadEvent(const PerfEvent &event, const PerfEventType &type);
void initialize();
void finalize();
void clear();
PerfResourceCounter<>::Container *resourceContainer(quint32 pid)
{
std::unique_ptr<PerfResourceCounter<>::Container> &container = m_resourceContainers[pid];
if (!container)
container.reset(new PerfResourceCounter<>::Container);
return container.get();
}
private:
using ContainerMap
= typename std::unordered_map<quint32, std::unique_ptr<PerfResourceCounter<>::Container>>;
QHash<quint32, PerfTimelineModel *> m_unfinished;
ContainerMap m_resourceContainers;
};
PerfTimelineModelManager &modelManager();
} // namespace PerfProfiler::Internal
|