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 #include "src/trace_processor/importers/archive/archive_entry.h" 18 19 #include <tuple> 20 21 namespace perfetto::trace_processor { 22 operator <(const ArchiveEntry & rhs) const23bool ArchiveEntry::operator<(const ArchiveEntry& rhs) const { 24 // Traces with symbols should be the last ones to be read. 25 // TODO(carlscab): Proto traces with just ModuleSymbols packets should be an 26 // exception. We actually need those are the very end (once whe have all the 27 // Frames). Alternatively we could build a map address -> symbol during 28 // tokenization and use this during parsing to resolve symbols. 29 if (trace_type == kSymbolsTraceType) { 30 return false; 31 } 32 if (rhs.trace_type == kSymbolsTraceType) { 33 return true; 34 } 35 36 // Proto traces should always parsed first as they might contains clock sync 37 // data needed to correctly parse other traces. 38 if (rhs.trace_type == TraceType::kProtoTraceType) { 39 return false; 40 } 41 if (trace_type == TraceType::kProtoTraceType) { 42 return true; 43 } 44 45 if (rhs.trace_type == TraceType::kGzipTraceType) { 46 return false; 47 } 48 if (trace_type == TraceType::kGzipTraceType) { 49 return true; 50 } 51 52 return std::tie(name, index) < std::tie(rhs.name, rhs.index); 53 } 54 55 } // namespace perfetto::trace_processor 56