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/importers/fuchsia/fuchsia_record.h" 18 19 namespace perfetto { 20 namespace trace_processor { 21 InsertString(uint32_t index,StringPool::Id string_id)22void FuchsiaRecord::InsertString(uint32_t index, StringPool::Id 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)30StringPool::Id FuchsiaRecord::GetString(uint32_t index) { 31 for (const auto& entry : string_entries_) { 32 if (entry.index == index) 33 return entry.string_id; 34 } 35 return StringPool::Id(); 36 } 37 InsertThread(uint32_t index,FuchsiaThreadInfo info)38void FuchsiaRecord::InsertThread(uint32_t index, FuchsiaThreadInfo info) { 39 ThreadTableEntry entry; 40 entry.index = index; 41 entry.info = info; 42 43 thread_entries_.push_back(entry); 44 } 45 GetThread(uint32_t index)46FuchsiaThreadInfo FuchsiaRecord::GetThread(uint32_t index) { 47 for (const auto& entry : thread_entries_) { 48 if (entry.index == index) 49 return entry.info; 50 } 51 return FuchsiaThreadInfo(); 52 } 53 54 } // namespace trace_processor 55 } // namespace perfetto 56