• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "src/trace_processor/fuchsia_provider_view.h"
18 
19 namespace perfetto {
20 namespace trace_processor {
21 
InsertString(uint32_t index,StringId string_id)22 void FuchsiaProviderView::InsertString(uint32_t index, StringId string_id) {
23   StringTableEntry entry;
24   entry.index = index;
25   entry.string_id = string_id;
26 
27   string_entries_.push_back(entry);
28 }
29 
GetString(uint32_t index)30 StringId FuchsiaProviderView::GetString(uint32_t index) {
31   for (const auto& entry : string_entries_) {
32     if (entry.index == index)
33       return entry.string_id;
34   }
35   return StringId();
36 }
37 
InsertThread(uint32_t index,fuchsia_trace_utils::ThreadInfo info)38 void FuchsiaProviderView::InsertThread(uint32_t index,
39                                        fuchsia_trace_utils::ThreadInfo info) {
40   ThreadTableEntry entry;
41   entry.index = index;
42   entry.info = info;
43 
44   thread_entries_.push_back(entry);
45 }
46 
GetThread(uint32_t index)47 fuchsia_trace_utils::ThreadInfo FuchsiaProviderView::GetThread(uint32_t index) {
48   for (const auto& entry : thread_entries_) {
49     if (entry.index == index)
50       return entry.info;
51   }
52   return fuchsia_trace_utils::ThreadInfo();
53 }
54 
55 }  // namespace trace_processor
56 }  // namespace perfetto
57