diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/dexanalyze/dexanalyze.cc | 3 | ||||
| -rw-r--r-- | tools/dexanalyze/dexanalyze_experiments.cc | 7 | ||||
| -rw-r--r-- | tools/dexanalyze/dexanalyze_experiments.h | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/tools/dexanalyze/dexanalyze.cc b/tools/dexanalyze/dexanalyze.cc index 46c48520e3..083de7066d 100644 --- a/tools/dexanalyze/dexanalyze.cc +++ b/tools/dexanalyze/dexanalyze.cc @@ -49,7 +49,7 @@ class DexAnalyze { << "Usage " << argv[0] << " [options] <dex files>\n" << " [options] is a combination of the following\n" << " -count_indices (Count dex indices accessed from code items)\n" - << " -i (Ignore DEX checksum failure)\n" + << " -i (Ignore Dex checksum and verification failures)\n" << " -a (Run all experiments)\n" << " -d (Dump on per DEX basis)\n"; return kExitCodeUsageError; @@ -62,6 +62,7 @@ class DexAnalyze { const std::string arg = argv[i]; if (arg == "-i") { verify_checksum_ = false; + run_dex_file_verifier_ = false; } else if (arg == "-a") { run_all_experiments_ = true; } else if (arg == "-count-indices") { diff --git a/tools/dexanalyze/dexanalyze_experiments.cc b/tools/dexanalyze/dexanalyze_experiments.cc index 312a7b3159..82cb0d28ab 100644 --- a/tools/dexanalyze/dexanalyze_experiments.cc +++ b/tools/dexanalyze/dexanalyze_experiments.cc @@ -126,11 +126,13 @@ void CountDexIndices::ProcessDexFile(const DexFile& dex_file) { num_field_ids_ += dex_file.NumFieldIds(); num_type_ids_ += dex_file.NumTypeIds(); num_class_defs_ += dex_file.NumClassDefs(); + std::set<size_t> unique_code_items; for (ClassAccessor accessor : dex_file.GetClasses()) { std::set<size_t> unique_method_ids; std::set<size_t> unique_string_ids; accessor.VisitMethods([&](const ClassAccessor::Method& method) { dex_code_bytes_ += method.GetInstructions().InsnsSizeInBytes(); + unique_code_items.insert(method.GetCodeItemOffset()); for (const DexInstructionPcPair& inst : method.GetInstructions()) { switch (inst->Opcode()) { case Instruction::CONST_STRING: { @@ -190,6 +192,7 @@ void CountDexIndices::ProcessDexFile(const DexFile& dex_file) { total_unique_method_idx_ += unique_method_ids.size(); total_unique_string_ids_ += unique_string_ids.size(); } + total_unique_code_items_ += unique_code_items.size(); } void CountDexIndices::Dump(std::ostream& os, uint64_t total_size) const { @@ -212,7 +215,9 @@ void CountDexIndices::Dump(std::ostream& os, uint64_t total_size) const { os << "Same class invoke: " << same_class_total << "\n"; os << "Other class invoke: " << other_class_total << "\n"; os << "Invokes from code: " << (same_class_total + other_class_total) << "\n"; - os << "Total dex size: " << total_size << "\n"; + os << "Total Dex code bytes: " << Percent(dex_code_bytes_, total_size) << "\n"; + os << "Total unique code items: " << total_unique_code_items_ << "\n"; + os << "Total Dex size: " << total_size << "\n"; } } // namespace art diff --git a/tools/dexanalyze/dexanalyze_experiments.h b/tools/dexanalyze/dexanalyze_experiments.h index 0fb4d32005..c84b082955 100644 --- a/tools/dexanalyze/dexanalyze_experiments.h +++ b/tools/dexanalyze/dexanalyze_experiments.h @@ -63,6 +63,7 @@ class CountDexIndices : public Experiment { size_t num_string_ids_from_code_ = 0; size_t total_unique_method_idx_ = 0; size_t total_unique_string_ids_ = 0; + uint64_t total_unique_code_items_ = 0u; // Other dex ids. size_t dex_code_bytes_ = 0; |