offline_profiling_info.cc revision b8697b15145834c9861bebfb03daa745ecbe53e8
1/* 2 * Copyright (C) 2015 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 "offline_profiling_info.h" 18 19#include "errno.h" 20#include <limits.h> 21#include <vector> 22#include <sys/file.h> 23#include <sys/stat.h> 24#include <sys/uio.h> 25 26#include "art_method-inl.h" 27#include "base/mutex.h" 28#include "base/scoped_flock.h" 29#include "base/stl_util.h" 30#include "base/systrace.h" 31#include "base/unix_file/fd_file.h" 32#include "jit/profiling_info.h" 33#include "os.h" 34#include "safe_map.h" 35 36namespace art { 37 38const uint8_t ProfileCompilationInfo::kProfileMagic[] = { 'p', 'r', 'o', '\0' }; 39const uint8_t ProfileCompilationInfo::kProfileVersion[] = { '0', '0', '1', '\0' }; 40 41static constexpr uint16_t kMaxDexFileKeyLength = PATH_MAX; 42 43// Transform the actual dex location into relative paths. 44// Note: this is OK because we don't store profiles of different apps into the same file. 45// Apps with split apks don't cause trouble because each split has a different name and will not 46// collide with other entries. 47std::string ProfileCompilationInfo::GetProfileDexFileKey(const std::string& dex_location) { 48 DCHECK(!dex_location.empty()); 49 size_t last_sep_index = dex_location.find_last_of('/'); 50 if (last_sep_index == std::string::npos) { 51 return dex_location; 52 } else { 53 DCHECK(last_sep_index < dex_location.size()); 54 return dex_location.substr(last_sep_index + 1); 55 } 56} 57 58bool ProfileCompilationInfo::AddMethodsAndClasses( 59 const std::vector<ArtMethod*>& methods, 60 const std::set<DexCacheResolvedClasses>& resolved_classes) { 61 ScopedObjectAccess soa(Thread::Current()); 62 for (ArtMethod* method : methods) { 63 const DexFile* dex_file = method->GetDexFile(); 64 if (!AddMethodIndex(GetProfileDexFileKey(dex_file->GetLocation()), 65 dex_file->GetLocationChecksum(), 66 method->GetDexMethodIndex())) { 67 return false; 68 } 69 } 70 for (const DexCacheResolvedClasses& dex_cache : resolved_classes) { 71 if (!AddResolvedClasses(dex_cache)) { 72 return false; 73 } 74 } 75 return true; 76} 77 78bool ProfileCompilationInfo::MergeAndSave(const std::string& filename, uint64_t* bytes_written) { 79 ScopedTrace trace(__PRETTY_FUNCTION__); 80 ScopedFlock flock; 81 std::string error; 82 if (!flock.Init(filename.c_str(), O_RDWR | O_NOFOLLOW | O_CLOEXEC, /* block */ false, &error)) { 83 LOG(WARNING) << "Couldn't lock the profile file " << filename << ": " << error; 84 return false; 85 } 86 87 int fd = flock.GetFile()->Fd(); 88 89 // Load the file but keep a copy around to be able to infer if the content has changed. 90 ProfileCompilationInfo fileInfo; 91 if (!fileInfo.Load(fd)) { 92 LOG(WARNING) << "Could not load previous profile data from file " << filename; 93 return false; 94 } 95 96 // Merge the content of file into the current object. 97 if (!MergeWith(fileInfo)) { 98 LOG(WARNING) << "Could not merge previous profile data from file " << filename; 99 } 100 101 // If after the merge we have the same data as what is the file there's no point 102 // in actually doing the write. The file will be exactly the same as before. 103 if (Equals(fileInfo)) { 104 if (bytes_written != nullptr) { 105 *bytes_written = 0; 106 } 107 return true; 108 } 109 110 // We need to clear the data because we don't support append to the profiles yet. 111 if (!flock.GetFile()->ClearContent()) { 112 PLOG(WARNING) << "Could not clear profile file: " << filename; 113 return false; 114 } 115 116 // This doesn't need locking because we are trying to lock the file for exclusive 117 // access and fail immediately if we can't. 118 bool result = Save(fd); 119 if (result) { 120 VLOG(profiler) << "Successfully saved profile info to " << filename 121 << " Size: " << GetFileSizeBytes(filename); 122 if (bytes_written != nullptr) { 123 *bytes_written = GetFileSizeBytes(filename); 124 } 125 } else { 126 VLOG(profiler) << "Failed to save profile info to " << filename; 127 } 128 return result; 129} 130 131bool ProfileCompilationInfo::SaveProfilingInfo( 132 const std::string& filename, 133 const std::vector<ArtMethod*>& methods, 134 const std::set<DexCacheResolvedClasses>& resolved_classes, 135 uint64_t* bytes_written) { 136 if (methods.empty() && resolved_classes.empty()) { 137 VLOG(profiler) << "No info to save to " << filename; 138 if (bytes_written != nullptr) { 139 *bytes_written = 0; 140 } 141 return true; 142 } 143 144 ProfileCompilationInfo info; 145 if (!info.AddMethodsAndClasses(methods, resolved_classes)) { 146 LOG(WARNING) << "Checksum mismatch when processing methods and resolved classes for " 147 << filename; 148 if (bytes_written != nullptr) { 149 *bytes_written = 0; 150 } 151 return false; 152 } 153 return info.MergeAndSave(filename, bytes_written); 154} 155 156// Returns true if all the bytes were successfully written to the file descriptor. 157static bool WriteBuffer(int fd, const uint8_t* buffer, size_t byte_count) { 158 while (byte_count > 0) { 159 int bytes_written = TEMP_FAILURE_RETRY(write(fd, buffer, byte_count)); 160 if (bytes_written == -1) { 161 return false; 162 } 163 byte_count -= bytes_written; // Reduce the number of remaining bytes. 164 buffer += bytes_written; // Move the buffer forward. 165 } 166 return true; 167} 168 169// Add the string bytes to the buffer. 170static void AddStringToBuffer(std::vector<uint8_t>* buffer, const std::string& value) { 171 buffer->insert(buffer->end(), value.begin(), value.end()); 172} 173 174// Insert each byte, from low to high into the buffer. 175template <typename T> 176static void AddUintToBuffer(std::vector<uint8_t>* buffer, T value) { 177 for (size_t i = 0; i < sizeof(T); i++) { 178 buffer->push_back((value >> (i * kBitsPerByte)) & 0xff); 179 } 180} 181 182static constexpr size_t kLineHeaderSize = 183 3 * sizeof(uint16_t) + // method_set.size + class_set.size + dex_location.size 184 sizeof(uint32_t); // checksum 185 186/** 187 * Serialization format: 188 * magic,version,number_of_lines 189 * dex_location1,number_of_methods1,number_of_classes1,dex_location_checksum1, \ 190 * method_id11,method_id12...,class_id1,class_id2... 191 * dex_location2,number_of_methods2,number_of_classes2,dex_location_checksum2, \ 192 * method_id21,method_id22...,,class_id1,class_id2... 193 * ..... 194 **/ 195bool ProfileCompilationInfo::Save(int fd) { 196 ScopedTrace trace(__PRETTY_FUNCTION__); 197 DCHECK_GE(fd, 0); 198 199 // Cache at most 5KB before writing. 200 static constexpr size_t kMaxSizeToKeepBeforeWriting = 5 * KB; 201 // Use a vector wrapper to avoid keeping track of offsets when we add elements. 202 std::vector<uint8_t> buffer; 203 WriteBuffer(fd, kProfileMagic, sizeof(kProfileMagic)); 204 WriteBuffer(fd, kProfileVersion, sizeof(kProfileVersion)); 205 AddUintToBuffer(&buffer, static_cast<uint16_t>(info_.size())); 206 207 for (const auto& it : info_) { 208 if (buffer.size() > kMaxSizeToKeepBeforeWriting) { 209 if (!WriteBuffer(fd, buffer.data(), buffer.size())) { 210 return false; 211 } 212 buffer.clear(); 213 } 214 const std::string& dex_location = it.first; 215 const DexFileData& dex_data = it.second; 216 if (dex_data.method_set.empty() && dex_data.class_set.empty()) { 217 continue; 218 } 219 220 if (dex_location.size() >= kMaxDexFileKeyLength) { 221 LOG(WARNING) << "DexFileKey exceeds allocated limit"; 222 return false; 223 } 224 225 // Make sure that the buffer has enough capacity to avoid repeated resizings 226 // while we add data. 227 size_t required_capacity = buffer.size() + 228 kLineHeaderSize + 229 dex_location.size() + 230 sizeof(uint16_t) * (dex_data.class_set.size() + dex_data.method_set.size()); 231 232 buffer.reserve(required_capacity); 233 234 DCHECK_LE(dex_location.size(), std::numeric_limits<uint16_t>::max()); 235 DCHECK_LE(dex_data.method_set.size(), std::numeric_limits<uint16_t>::max()); 236 DCHECK_LE(dex_data.class_set.size(), std::numeric_limits<uint16_t>::max()); 237 AddUintToBuffer(&buffer, static_cast<uint16_t>(dex_location.size())); 238 AddUintToBuffer(&buffer, static_cast<uint16_t>(dex_data.method_set.size())); 239 AddUintToBuffer(&buffer, static_cast<uint16_t>(dex_data.class_set.size())); 240 AddUintToBuffer(&buffer, dex_data.checksum); // uint32_t 241 242 AddStringToBuffer(&buffer, dex_location); 243 244 for (auto method_it : dex_data.method_set) { 245 AddUintToBuffer(&buffer, method_it); 246 } 247 for (auto class_id : dex_data.class_set) { 248 AddUintToBuffer(&buffer, class_id); 249 } 250 DCHECK_EQ(required_capacity, buffer.size()) 251 << "Failed to add the expected number of bytes in the buffer"; 252 } 253 254 return WriteBuffer(fd, buffer.data(), buffer.size()); 255} 256 257ProfileCompilationInfo::DexFileData* ProfileCompilationInfo::GetOrAddDexFileData( 258 const std::string& dex_location, 259 uint32_t checksum) { 260 auto info_it = info_.find(dex_location); 261 if (info_it == info_.end()) { 262 info_it = info_.Put(dex_location, DexFileData(checksum)); 263 } 264 if (info_it->second.checksum != checksum) { 265 LOG(WARNING) << "Checksum mismatch for dex " << dex_location; 266 return nullptr; 267 } 268 return &info_it->second; 269} 270 271bool ProfileCompilationInfo::AddResolvedClasses(const DexCacheResolvedClasses& classes) { 272 const std::string dex_location = GetProfileDexFileKey(classes.GetDexLocation()); 273 const uint32_t checksum = classes.GetLocationChecksum(); 274 DexFileData* const data = GetOrAddDexFileData(dex_location, checksum); 275 if (data == nullptr) { 276 return false; 277 } 278 data->class_set.insert(classes.GetClasses().begin(), classes.GetClasses().end()); 279 return true; 280} 281 282bool ProfileCompilationInfo::AddMethodIndex(const std::string& dex_location, 283 uint32_t checksum, 284 uint16_t method_idx) { 285 DexFileData* const data = GetOrAddDexFileData(dex_location, checksum); 286 if (data == nullptr) { 287 return false; 288 } 289 data->method_set.insert(method_idx); 290 return true; 291} 292 293bool ProfileCompilationInfo::AddClassIndex(const std::string& dex_location, 294 uint32_t checksum, 295 uint16_t class_idx) { 296 DexFileData* const data = GetOrAddDexFileData(dex_location, checksum); 297 if (data == nullptr) { 298 return false; 299 } 300 data->class_set.insert(class_idx); 301 return true; 302} 303 304bool ProfileCompilationInfo::ProcessLine(SafeBuffer& line_buffer, 305 uint16_t method_set_size, 306 uint16_t class_set_size, 307 uint32_t checksum, 308 const std::string& dex_location) { 309 for (uint16_t i = 0; i < method_set_size; i++) { 310 uint16_t method_idx = line_buffer.ReadUintAndAdvance<uint16_t>(); 311 if (!AddMethodIndex(dex_location, checksum, method_idx)) { 312 return false; 313 } 314 } 315 316 for (uint16_t i = 0; i < class_set_size; i++) { 317 uint16_t class_def_idx = line_buffer.ReadUintAndAdvance<uint16_t>(); 318 if (!AddClassIndex(dex_location, checksum, class_def_idx)) { 319 return false; 320 } 321 } 322 return true; 323} 324 325// Tests for EOF by trying to read 1 byte from the descriptor. 326// Returns: 327// 0 if the descriptor is at the EOF, 328// -1 if there was an IO error 329// 1 if the descriptor has more content to read 330static int testEOF(int fd) { 331 uint8_t buffer[1]; 332 return TEMP_FAILURE_RETRY(read(fd, buffer, 1)); 333} 334 335// Reads an uint value previously written with AddUintToBuffer. 336template <typename T> 337T ProfileCompilationInfo::SafeBuffer::ReadUintAndAdvance() { 338 static_assert(std::is_unsigned<T>::value, "Type is not unsigned"); 339 CHECK_LE(ptr_current_ + sizeof(T), ptr_end_); 340 T value = 0; 341 for (size_t i = 0; i < sizeof(T); i++) { 342 value += ptr_current_[i] << (i * kBitsPerByte); 343 } 344 ptr_current_ += sizeof(T); 345 return value; 346} 347 348bool ProfileCompilationInfo::SafeBuffer::CompareAndAdvance(const uint8_t* data, size_t data_size) { 349 if (ptr_current_ + data_size > ptr_end_) { 350 return false; 351 } 352 if (memcmp(ptr_current_, data, data_size) == 0) { 353 ptr_current_ += data_size; 354 return true; 355 } 356 return false; 357} 358 359ProfileCompilationInfo::ProfileLoadSatus ProfileCompilationInfo::SafeBuffer::FillFromFd( 360 int fd, 361 const std::string& source, 362 /*out*/std::string* error) { 363 size_t byte_count = ptr_end_ - ptr_current_; 364 uint8_t* buffer = ptr_current_; 365 while (byte_count > 0) { 366 int bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, byte_count)); 367 if (bytes_read == 0) { 368 *error += "Profile EOF reached prematurely for " + source; 369 return kProfileLoadBadData; 370 } else if (bytes_read < 0) { 371 *error += "Profile IO error for " + source + strerror(errno); 372 return kProfileLoadIOError; 373 } 374 byte_count -= bytes_read; 375 buffer += bytes_read; 376 } 377 return kProfileLoadSuccess; 378} 379 380ProfileCompilationInfo::ProfileLoadSatus ProfileCompilationInfo::ReadProfileHeader( 381 int fd, 382 /*out*/uint16_t* number_of_lines, 383 /*out*/std::string* error) { 384 // Read magic and version 385 const size_t kMagicVersionSize = 386 sizeof(kProfileMagic) + 387 sizeof(kProfileVersion) + 388 sizeof(uint16_t); // number of lines 389 390 SafeBuffer safe_buffer(kMagicVersionSize); 391 392 ProfileLoadSatus status = safe_buffer.FillFromFd(fd, "ReadProfileHeader", error); 393 if (status != kProfileLoadSuccess) { 394 return status; 395 } 396 397 if (!safe_buffer.CompareAndAdvance(kProfileMagic, sizeof(kProfileMagic))) { 398 *error = "Profile missing magic"; 399 return kProfileLoadVersionMismatch; 400 } 401 if (!safe_buffer.CompareAndAdvance(kProfileVersion, sizeof(kProfileVersion))) { 402 *error = "Profile version mismatch"; 403 return kProfileLoadVersionMismatch; 404 } 405 *number_of_lines = safe_buffer.ReadUintAndAdvance<uint16_t>(); 406 return kProfileLoadSuccess; 407} 408 409ProfileCompilationInfo::ProfileLoadSatus ProfileCompilationInfo::ReadProfileLineHeader( 410 int fd, 411 /*out*/ProfileLineHeader* line_header, 412 /*out*/std::string* error) { 413 SafeBuffer header_buffer(kLineHeaderSize); 414 ProfileLoadSatus status = header_buffer.FillFromFd(fd, "ReadProfileHeader", error); 415 if (status != kProfileLoadSuccess) { 416 return status; 417 } 418 419 uint16_t dex_location_size = header_buffer.ReadUintAndAdvance<uint16_t>(); 420 line_header->method_set_size = header_buffer.ReadUintAndAdvance<uint16_t>(); 421 line_header->class_set_size = header_buffer.ReadUintAndAdvance<uint16_t>(); 422 line_header->checksum = header_buffer.ReadUintAndAdvance<uint32_t>(); 423 424 if (dex_location_size == 0 || dex_location_size > kMaxDexFileKeyLength) { 425 *error = "DexFileKey has an invalid size: " + std::to_string(dex_location_size); 426 return kProfileLoadBadData; 427 } 428 429 SafeBuffer location_buffer(dex_location_size); 430 status = location_buffer.FillFromFd(fd, "ReadProfileHeaderDexLocation", error); 431 if (status != kProfileLoadSuccess) { 432 return status; 433 } 434 line_header->dex_location.assign( 435 reinterpret_cast<char*>(location_buffer.Get()), dex_location_size); 436 return kProfileLoadSuccess; 437} 438 439ProfileCompilationInfo::ProfileLoadSatus ProfileCompilationInfo::ReadProfileLine( 440 int fd, 441 const ProfileLineHeader& line_header, 442 /*out*/std::string* error) { 443 // Make sure that we don't try to read everything in memory (in case the profile if full). 444 // Split readings in chunks of at most 10kb. 445 static constexpr uint16_t kMaxNumberOfEntriesToRead = 5120; 446 uint16_t methods_left_to_read = line_header.method_set_size; 447 uint16_t classes_left_to_read = line_header.class_set_size; 448 449 while ((methods_left_to_read > 0) || (classes_left_to_read > 0)) { 450 uint16_t methods_to_read = std::min(kMaxNumberOfEntriesToRead, methods_left_to_read); 451 uint16_t max_classes_to_read = kMaxNumberOfEntriesToRead - methods_to_read; 452 uint16_t classes_to_read = std::min(max_classes_to_read, classes_left_to_read); 453 454 size_t line_size = sizeof(uint16_t) * (methods_to_read + classes_to_read); 455 SafeBuffer line_buffer(line_size); 456 457 ProfileLoadSatus status = line_buffer.FillFromFd(fd, "ReadProfileLine", error); 458 if (status != kProfileLoadSuccess) { 459 return status; 460 } 461 if (!ProcessLine(line_buffer, 462 methods_to_read, 463 classes_to_read, 464 line_header.checksum, 465 line_header.dex_location)) { 466 *error = "Error when reading profile file line"; 467 return kProfileLoadBadData; 468 } 469 methods_left_to_read -= methods_to_read; 470 classes_left_to_read -= classes_to_read; 471 } 472 return kProfileLoadSuccess; 473} 474 475bool ProfileCompilationInfo::Load(int fd) { 476 std::string error; 477 ProfileLoadSatus status = LoadInternal(fd, &error); 478 479 if (status == kProfileLoadSuccess) { 480 return true; 481 } else { 482 PLOG(WARNING) << "Error when reading profile " << error; 483 return false; 484 } 485} 486 487ProfileCompilationInfo::ProfileLoadSatus ProfileCompilationInfo::LoadInternal( 488 int fd, std::string* error) { 489 ScopedTrace trace(__PRETTY_FUNCTION__); 490 DCHECK_GE(fd, 0); 491 492 struct stat stat_buffer; 493 if (fstat(fd, &stat_buffer) != 0) { 494 return kProfileLoadIOError; 495 } 496 // We allow empty profile files. 497 // Profiles may be created by ActivityManager or installd before we manage to 498 // process them in the runtime or profman. 499 if (stat_buffer.st_size == 0) { 500 return kProfileLoadSuccess; 501 } 502 // Read profile header: magic + version + number_of_lines. 503 uint16_t number_of_lines; 504 ProfileLoadSatus status = ReadProfileHeader(fd, &number_of_lines, error); 505 if (status != kProfileLoadSuccess) { 506 return status; 507 } 508 509 while (number_of_lines > 0) { 510 ProfileLineHeader line_header; 511 // First, read the line header to get the amount of data we need to read. 512 status = ReadProfileLineHeader(fd, &line_header, error); 513 if (status != kProfileLoadSuccess) { 514 return status; 515 } 516 517 // Now read the actual profile line. 518 status = ReadProfileLine(fd, line_header, error); 519 if (status != kProfileLoadSuccess) { 520 return status; 521 } 522 number_of_lines--; 523 } 524 525 // Check that we read everything and that profiles don't contain junk data. 526 int result = testEOF(fd); 527 if (result == 0) { 528 return kProfileLoadSuccess; 529 } else if (result < 0) { 530 return kProfileLoadIOError; 531 } else { 532 *error = "Unexpected content in the profile file"; 533 return kProfileLoadBadData; 534 } 535} 536 537bool ProfileCompilationInfo::MergeWith(const ProfileCompilationInfo& other) { 538 for (const auto& other_it : other.info_) { 539 const std::string& other_dex_location = other_it.first; 540 const DexFileData& other_dex_data = other_it.second; 541 542 auto info_it = info_.find(other_dex_location); 543 if (info_it == info_.end()) { 544 info_it = info_.Put(other_dex_location, DexFileData(other_dex_data.checksum)); 545 } 546 if (info_it->second.checksum != other_dex_data.checksum) { 547 LOG(WARNING) << "Checksum mismatch for dex " << other_dex_location; 548 return false; 549 } 550 info_it->second.method_set.insert(other_dex_data.method_set.begin(), 551 other_dex_data.method_set.end()); 552 info_it->second.class_set.insert(other_dex_data.class_set.begin(), 553 other_dex_data.class_set.end()); 554 } 555 return true; 556} 557 558bool ProfileCompilationInfo::ContainsMethod(const MethodReference& method_ref) const { 559 auto info_it = info_.find(GetProfileDexFileKey(method_ref.dex_file->GetLocation())); 560 if (info_it != info_.end()) { 561 if (method_ref.dex_file->GetLocationChecksum() != info_it->second.checksum) { 562 return false; 563 } 564 const std::set<uint16_t>& methods = info_it->second.method_set; 565 return methods.find(method_ref.dex_method_index) != methods.end(); 566 } 567 return false; 568} 569 570uint32_t ProfileCompilationInfo::GetNumberOfMethods() const { 571 uint32_t total = 0; 572 for (const auto& it : info_) { 573 total += it.second.method_set.size(); 574 } 575 return total; 576} 577 578uint32_t ProfileCompilationInfo::GetNumberOfResolvedClasses() const { 579 uint32_t total = 0; 580 for (const auto& it : info_) { 581 total += it.second.class_set.size(); 582 } 583 return total; 584} 585 586std::string ProfileCompilationInfo::DumpInfo(const std::vector<const DexFile*>* dex_files, 587 bool print_full_dex_location) const { 588 std::ostringstream os; 589 if (info_.empty()) { 590 return "ProfileInfo: empty"; 591 } 592 593 os << "ProfileInfo:"; 594 595 const std::string kFirstDexFileKeySubstitute = ":classes.dex"; 596 for (const auto& it : info_) { 597 os << "\n"; 598 const std::string& location = it.first; 599 const DexFileData& dex_data = it.second; 600 if (print_full_dex_location) { 601 os << location; 602 } else { 603 // Replace the (empty) multidex suffix of the first key with a substitute for easier reading. 604 std::string multidex_suffix = DexFile::GetMultiDexSuffix(location); 605 os << (multidex_suffix.empty() ? kFirstDexFileKeySubstitute : multidex_suffix); 606 } 607 for (const auto method_it : dex_data.method_set) { 608 if (dex_files != nullptr) { 609 const DexFile* dex_file = nullptr; 610 for (size_t i = 0; i < dex_files->size(); i++) { 611 if (location == (*dex_files)[i]->GetLocation()) { 612 dex_file = (*dex_files)[i]; 613 } 614 } 615 if (dex_file != nullptr) { 616 os << "\n " << PrettyMethod(method_it, *dex_file, true); 617 } 618 } 619 os << ", " << method_it; 620 } 621 } 622 return os.str(); 623} 624 625bool ProfileCompilationInfo::Equals(const ProfileCompilationInfo& other) { 626 return info_.Equals(other.info_); 627} 628 629std::set<DexCacheResolvedClasses> ProfileCompilationInfo::GetResolvedClasses() const { 630 std::set<DexCacheResolvedClasses> ret; 631 for (auto&& pair : info_) { 632 const std::string& profile_key = pair.first; 633 const DexFileData& data = pair.second; 634 DexCacheResolvedClasses classes(profile_key, data.checksum); 635 classes.AddClasses(data.class_set.begin(), data.class_set.end()); 636 ret.insert(classes); 637 } 638 return ret; 639} 640 641void ProfileCompilationInfo::ClearResolvedClasses() { 642 for (auto& pair : info_) { 643 pair.second.class_set.clear(); 644 } 645} 646 647} // namespace art 648