Remove dead code related to profile collection.

This code had been dead since
    https://android-review.googlesource.com/411660 .

Test: m
Change-Id: I17440d80971bb14ec062ed8b982b9cdd70383efb
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index 7382a97..f5eeeb7 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -28,6 +28,7 @@
 #include <iostream>
 #include <memory>
 #include <sstream>
+#include <unordered_set>
 #include <vector>
 
 #include "android-base/stringprintf.h"
diff --git a/libdexfile/dex/dex_cache_resolved_classes.h b/libdexfile/dex/dex_cache_resolved_classes.h
deleted file mode 100644
index 4c9acbf..0000000
--- a/libdexfile/dex/dex_cache_resolved_classes.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_LIBDEXFILE_DEX_DEX_CACHE_RESOLVED_CLASSES_H_
-#define ART_LIBDEXFILE_DEX_DEX_CACHE_RESOLVED_CLASSES_H_
-
-#include <string>
-#include <unordered_set>
-#include <vector>
-
-#include "dex/dex_file_types.h"
-
-namespace art {
-
-// Data structure for passing around which classes belonging to a dex cache / dex file are resolved.
-class DexCacheResolvedClasses {
- public:
-  DexCacheResolvedClasses(const std::string& dex_location,
-                          const std::string& base_location,
-                          uint32_t location_checksum,
-                          uint32_t num_method_ids)
-      : dex_location_(dex_location),
-        base_location_(base_location),
-        location_checksum_(location_checksum),
-        num_method_ids_(num_method_ids) {}
-
-  // Only compare the key elements, ignore the resolved classes.
-  int Compare(const DexCacheResolvedClasses& other) const {
-    if (location_checksum_ != other.location_checksum_) {
-      return static_cast<int>(location_checksum_ - other.location_checksum_);
-    }
-    // Don't need to compare base_location_ since dex_location_ has more info.
-    return dex_location_.compare(other.dex_location_);
-  }
-
-  bool AddClass(dex::TypeIndex index) const {
-    return classes_.insert(index).second;
-  }
-
-  template <class InputIt>
-  void AddClasses(InputIt begin, InputIt end) const {
-    classes_.insert(begin, end);
-  }
-
-  const std::string& GetDexLocation() const {
-    return dex_location_;
-  }
-
-  const std::string& GetBaseLocation() const {
-    return base_location_;
-  }
-
-  uint32_t GetLocationChecksum() const {
-    return location_checksum_;
-  }
-
-  const std::unordered_set<dex::TypeIndex>& GetClasses() const {
-    return classes_;
-  }
-
-  size_t NumMethodIds() const {
-    return num_method_ids_;
-  }
-
- private:
-  const std::string dex_location_;
-  const std::string base_location_;
-  const uint32_t location_checksum_;
-  const uint32_t num_method_ids_;
-  // Array of resolved class def indexes.
-  mutable std::unordered_set<dex::TypeIndex> classes_;
-};
-
-inline bool operator<(const DexCacheResolvedClasses& a, const DexCacheResolvedClasses& b) {
-  return a.Compare(b) < 0;
-}
-
-}  // namespace art
-
-#endif  // ART_LIBDEXFILE_DEX_DEX_CACHE_RESOLVED_CLASSES_H_
diff --git a/libprofile/profile/profile_compilation_info.h b/libprofile/profile/profile_compilation_info.h
index 5fe9fa6..fa70e8b 100644
--- a/libprofile/profile/profile_compilation_info.h
+++ b/libprofile/profile/profile_compilation_info.h
@@ -28,7 +28,6 @@
 #include "base/malloc_arena_pool.h"
 #include "base/mem_map.h"
 #include "base/safe_map.h"
-#include "dex/dex_cache_resolved_classes.h"
 #include "dex/dex_file.h"
 #include "dex/dex_file_types.h"
 #include "dex/method_reference.h"
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index d14dd01..81fa614 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -9782,99 +9782,6 @@
   }
 }
 
-class GetResolvedClassesVisitor : public ClassVisitor {
- public:
-  GetResolvedClassesVisitor(std::set<DexCacheResolvedClasses>* result, bool ignore_boot_classes)
-      : result_(result),
-        ignore_boot_classes_(ignore_boot_classes),
-        last_resolved_classes_(result->end()),
-        last_dex_file_(nullptr),
-        vlog_is_on_(VLOG_IS_ON(class_linker)),
-        extra_stats_(),
-        last_extra_stats_(extra_stats_.end()) { }
-
-  bool operator()(ObjPtr<mirror::Class> klass) override REQUIRES_SHARED(Locks::mutator_lock_) {
-    if (!klass->IsProxyClass() &&
-        !klass->IsArrayClass() &&
-        klass->IsResolved() &&
-        !klass->IsErroneousResolved() &&
-        (!ignore_boot_classes_ || klass->GetClassLoader() != nullptr)) {
-      const DexFile& dex_file = klass->GetDexFile();
-      if (&dex_file != last_dex_file_) {
-        last_dex_file_ = &dex_file;
-        DexCacheResolvedClasses resolved_classes(
-            dex_file.GetLocation(),
-            DexFileLoader::GetBaseLocation(dex_file.GetLocation()),
-            dex_file.GetLocationChecksum(),
-            dex_file.NumMethodIds());
-        last_resolved_classes_ = result_->find(resolved_classes);
-        if (last_resolved_classes_ == result_->end()) {
-          last_resolved_classes_ = result_->insert(resolved_classes).first;
-        }
-      }
-      bool added = last_resolved_classes_->AddClass(klass->GetDexTypeIndex());
-      if (UNLIKELY(vlog_is_on_) && added) {
-        const DexCacheResolvedClasses* resolved_classes = std::addressof(*last_resolved_classes_);
-        if (last_extra_stats_ == extra_stats_.end() ||
-            last_extra_stats_->first != resolved_classes) {
-          last_extra_stats_ = extra_stats_.find(resolved_classes);
-          if (last_extra_stats_ == extra_stats_.end()) {
-            last_extra_stats_ =
-                extra_stats_.emplace(resolved_classes, ExtraStats(dex_file.NumClassDefs())).first;
-          }
-        }
-      }
-    }
-    return true;
-  }
-
-  void PrintStatistics() const {
-    if (vlog_is_on_) {
-      for (const DexCacheResolvedClasses& resolved_classes : *result_) {
-        auto it = extra_stats_.find(std::addressof(resolved_classes));
-        DCHECK(it != extra_stats_.end());
-        const ExtraStats& extra_stats = it->second;
-        LOG(INFO) << "Dex location " << resolved_classes.GetDexLocation()
-                  << " has " << resolved_classes.GetClasses().size() << " / "
-                  << extra_stats.number_of_class_defs_ << " resolved classes";
-      }
-    }
-  }
-
- private:
-  struct ExtraStats {
-    explicit ExtraStats(uint32_t number_of_class_defs)
-        : number_of_class_defs_(number_of_class_defs) {}
-    uint32_t number_of_class_defs_;
-  };
-
-  std::set<DexCacheResolvedClasses>* result_;
-  bool ignore_boot_classes_;
-  std::set<DexCacheResolvedClasses>::iterator last_resolved_classes_;
-  const DexFile* last_dex_file_;
-
-  // Statistics.
-  bool vlog_is_on_;
-  std::map<const DexCacheResolvedClasses*, ExtraStats> extra_stats_;
-  std::map<const DexCacheResolvedClasses*, ExtraStats>::iterator last_extra_stats_;
-};
-
-std::set<DexCacheResolvedClasses> ClassLinker::GetResolvedClasses(bool ignore_boot_classes) {
-  ScopedTrace trace(__PRETTY_FUNCTION__);
-  ScopedObjectAccess soa(Thread::Current());
-  ScopedAssertNoThreadSuspension ants(__FUNCTION__);
-  std::set<DexCacheResolvedClasses> ret;
-  VLOG(class_linker) << "Collecting resolved classes";
-  const uint64_t start_time = NanoTime();
-  GetResolvedClassesVisitor visitor(&ret, ignore_boot_classes);
-  VisitClasses(&visitor);
-  if (VLOG_IS_ON(class_linker)) {
-    visitor.PrintStatistics();
-    LOG(INFO) << "Collecting class profile took " << PrettyDuration(NanoTime() - start_time);
-  }
-  return ret;
-}
-
 class ClassLinker::FindVirtualMethodHolderVisitor : public ClassVisitor {
  public:
   FindVirtualMethodHolderVisitor(const ArtMethod* method, PointerSize pointer_size)
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index f993d17..23ebf0a 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -32,7 +32,6 @@
 #include "base/locks.h"
 #include "base/macros.h"
 #include "dex/class_accessor.h"
-#include "dex/dex_cache_resolved_classes.h"
 #include "dex/dex_file_types.h"
 #include "gc_root.h"
 #include "handle.h"
@@ -697,9 +696,6 @@
   static bool ShouldUseInterpreterEntrypoint(ArtMethod* method, const void* quick_code)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  std::set<DexCacheResolvedClasses> GetResolvedClasses(bool ignore_boot_classes)
-      REQUIRES(!Locks::dex_lock_);
-
   static bool IsBootClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
                                 ObjPtr<mirror::ClassLoader> class_loader)
       REQUIRES_SHARED(Locks::mutator_lock_);
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index be52051..fe551f3b 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -98,7 +98,6 @@
       total_number_of_failed_writes_(0),
       total_ms_of_sleep_(0),
       total_ns_of_work_(0),
-      max_number_of_profile_entries_cached_(0),
       total_number_of_hot_spikes_(0),
       total_number_of_wake_ups_(0),
       options_(options) {
@@ -439,10 +438,8 @@
                                   &hot_methods,
                                   &sampled_methods);
   MutexLock mu(self, *Locks::profiler_lock_);
-  uint64_t total_number_of_profile_entries_cached = 0;
 
   for (const auto& it : tracked_dex_base_locations_) {
-    std::set<DexCacheResolvedClasses> resolved_classes_for_location;
     const std::string& filename = it.first;
     auto info_it = profile_cache_.find(filename);
     if (info_it == profile_cache_.end()) {
@@ -507,11 +504,7 @@
         VLOG(profiler) << "Location not found " << base_location;
       }
     }
-    total_number_of_profile_entries_cached += resolved_classes_for_location.size();
   }
-  max_number_of_profile_entries_cached_ = std::max(
-      max_number_of_profile_entries_cached_,
-      total_number_of_profile_entries_cached);
   VLOG(profiler) << "Profile saver recorded " << hot_methods.NumReferences() << " hot methods and "
                  << sampled_methods.NumReferences() << " sampled methods with threshold "
                  << hot_method_sample_threshold << " in "
@@ -913,8 +906,6 @@
      << "ProfileSaver total_number_of_failed_writes=" << total_number_of_failed_writes_ << '\n'
      << "ProfileSaver total_ms_of_sleep=" << total_ms_of_sleep_ << '\n'
      << "ProfileSaver total_ms_of_work=" << NsToMs(total_ns_of_work_) << '\n'
-     << "ProfileSaver max_number_profile_entries_cached="
-     << max_number_of_profile_entries_cached_ << '\n'
      << "ProfileSaver total_number_of_hot_spikes=" << total_number_of_hot_spikes_ << '\n'
      << "ProfileSaver total_number_of_wake_ups=" << total_number_of_wake_ups_ << '\n';
 }
diff --git a/runtime/jit/profile_saver.h b/runtime/jit/profile_saver.h
index ed0ba9f..60959d2 100644
--- a/runtime/jit/profile_saver.h
+++ b/runtime/jit/profile_saver.h
@@ -150,7 +150,6 @@
   uint64_t total_ms_of_sleep_;
   uint64_t total_ns_of_work_;
   // TODO(calin): replace with an actual size.
-  uint64_t max_number_of_profile_entries_cached_;
   uint64_t total_number_of_hot_spikes_;
   uint64_t total_number_of_wake_ups_;