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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/trace_processor/importers/ftrace/mali_gpu_event_tracker.h"
#include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
#include "protos/perfetto/trace/ftrace/mali.pbzero.h"
#include "src/trace_processor/importers/common/async_track_set_tracker.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/common/track_tracker.h"
namespace perfetto {
namespace trace_processor {
MaliGpuEventTracker::MaliGpuEventTracker(TraceProcessorContext* context)
: context_(context),
mali_KCPU_CQS_SET_id_(
context->storage->InternString("mali_KCPU_CQS_SET")),
mali_KCPU_CQS_WAIT_id_(
context->storage->InternString("mali_KCPU_CQS_WAIT")),
mali_KCPU_FENCE_SIGNAL_id_(
context->storage->InternString("mali_KCPU_FENCE_SIGNAL")),
mali_KCPU_FENCE_WAIT_id_(
context->storage->InternString("mali_KCPU_FENCE_WAIT")) {}
void MaliGpuEventTracker::ParseMaliGpuEvent(int64_t ts,
int32_t field_id,
uint32_t pid) {
using protos::pbzero::FtraceEvent;
UniqueTid utid = context_->process_tracker->GetOrCreateThread(pid);
TrackId track_id = context_->track_tracker->InternThreadTrack(utid);
switch (field_id) {
case FtraceEvent::kMaliMaliKCPUCQSSETFieldNumber: {
ParseMaliKcpuCqsSet(ts, track_id);
break;
}
case FtraceEvent::kMaliMaliKCPUCQSWAITSTARTFieldNumber: {
ParseMaliKcpuCqsWaitStart(ts, track_id);
break;
}
case FtraceEvent::kMaliMaliKCPUCQSWAITENDFieldNumber: {
ParseMaliKcpuCqsWaitEnd(ts, track_id);
break;
}
case FtraceEvent::kMaliMaliKCPUFENCESIGNALFieldNumber: {
ParseMaliKcpuFenceSignal(ts, track_id);
break;
}
case FtraceEvent::kMaliMaliKCPUFENCEWAITSTARTFieldNumber: {
ParseMaliKcpuFenceWaitStart(ts, track_id);
break;
}
case FtraceEvent::kMaliMaliKCPUFENCEWAITENDFieldNumber: {
ParseMaliKcpuFenceWaitEnd(ts, track_id);
break;
}
default:
PERFETTO_DFATAL("Unexpected field id");
break;
}
}
void MaliGpuEventTracker::ParseMaliKcpuCqsSet(int64_t timestamp,
TrackId track_id) {
context_->slice_tracker->Scoped(timestamp, track_id, kNullStringId,
mali_KCPU_CQS_SET_id_, 0);
}
void MaliGpuEventTracker::ParseMaliKcpuCqsWaitStart(int64_t timestamp,
TrackId track_id) {
context_->slice_tracker->Begin(timestamp, track_id, kNullStringId,
mali_KCPU_CQS_WAIT_id_);
}
void MaliGpuEventTracker::ParseMaliKcpuCqsWaitEnd(int64_t timestamp,
TrackId track_id) {
context_->slice_tracker->End(timestamp, track_id, kNullStringId,
mali_KCPU_CQS_WAIT_id_);
}
void MaliGpuEventTracker::ParseMaliKcpuFenceSignal(int64_t timestamp,
TrackId track_id) {
context_->slice_tracker->Scoped(timestamp, track_id, kNullStringId,
mali_KCPU_FENCE_SIGNAL_id_, 0);
}
void MaliGpuEventTracker::ParseMaliKcpuFenceWaitStart(int64_t timestamp,
TrackId track_id) {
context_->slice_tracker->Begin(timestamp, track_id, kNullStringId,
mali_KCPU_FENCE_WAIT_id_);
}
void MaliGpuEventTracker::ParseMaliKcpuFenceWaitEnd(int64_t timestamp,
TrackId track_id) {
context_->slice_tracker->End(timestamp, track_id, kNullStringId,
mali_KCPU_FENCE_WAIT_id_);
}
} // namespace trace_processor
} // namespace perfetto
|