1 /* 2 * Copyright (C) 2024 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 #ifndef SRC_TRACE_PROCESSOR_IMPORTERS_INSTRUMENTS_ROW_H_ 18 #define SRC_TRACE_PROCESSOR_IMPORTERS_INSTRUMENTS_ROW_H_ 19 20 #include "src/trace_processor/containers/string_pool.h" 21 #include "src/trace_processor/util/build_id.h" 22 23 namespace perfetto::trace_processor::instruments_importer { 24 25 // TODO(leszeks): Would be nice if these were strong type aliases, to be 26 // type safe. 27 using ThreadId = uint32_t; 28 using ProcessId = uint32_t; 29 using BacktraceId = uint32_t; 30 using BacktraceFrameId = uint32_t; 31 using BinaryId = uint32_t; 32 33 constexpr uint32_t kNullId = 0u; 34 35 struct Binary { 36 std::string path; 37 BuildId uuid = BuildId::FromRaw(std::string("")); 38 long long load_addr = 0; 39 long long max_addr = 0; 40 }; 41 42 struct Frame { 43 long long addr = 0; 44 std::string name; 45 BinaryId binary = kNullId; 46 }; 47 48 struct Process { 49 int pid = 0; 50 StringPool::Id fmt = StringPool::Id::Null(); 51 }; 52 53 struct Thread { 54 int tid = 0; 55 StringPool::Id fmt = StringPool::Id::Null(); 56 ProcessId process = kNullId; 57 }; 58 59 struct Backtrace { 60 std::vector<BacktraceFrameId> frames; 61 }; 62 63 struct alignas(8) Row { 64 int64_t timestamp_; 65 uint32_t core_id; 66 ThreadId thread = kNullId; 67 BacktraceId backtrace = kNullId; 68 }; 69 70 } // namespace perfetto::trace_processor::instruments_importer 71 72 #endif // SRC_TRACE_PROCESSOR_IMPORTERS_INSTRUMENTS_ROW_H_ 73