diff options
author | Jean Christophe Beyler <jean.christophe.beyler@intel.com> | 2014-05-22 15:43:50 -0700 |
---|---|---|
committer | Jean Christophe Beyler <jean.christophe.beyler@intel.com> | 2014-05-23 09:31:27 -0700 |
commit | 520f37bb5c34c5d86ad0091cb84a84c163a2fa9c (patch) | |
tree | 8c1ebd76a690dfa328821cd26b78d48531848cfa /runtime/base/bit_vector.cc | |
parent | b8033db2a8dc6f7c7e29b1552177542964f56e44 (diff) | |
download | android_art-520f37bb5c34c5d86ad0091cb84a84c163a2fa9c.tar.gz android_art-520f37bb5c34c5d86ad0091cb84a84c163a2fa9c.tar.bz2 android_art-520f37bb5c34c5d86ad0091cb84a84c163a2fa9c.zip |
ART: Added print indices back to BitVector Dumper
- Added an API to get the indices set instead of 001...0 format
Change-Id: I75841e41ca9b7ef77a0717715669dbe12506d6a1
Signed-Off-By: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
Diffstat (limited to 'runtime/base/bit_vector.cc')
-rw-r--r-- | runtime/base/bit_vector.cc | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/runtime/base/bit_vector.cc b/runtime/base/bit_vector.cc index a3e2b15232..8fe6b27a64 100644 --- a/runtime/base/bit_vector.cc +++ b/runtime/base/bit_vector.cc @@ -401,14 +401,12 @@ uint32_t BitVector::NumSetBits(const uint32_t* storage, uint32_t end) { void BitVector::Dump(std::ostream& os, const char *prefix) const { std::ostringstream buffer; - DumpHelper(buffer, prefix); + DumpHelper(prefix, buffer); os << buffer.str() << std::endl; } -void BitVector::DumpDot(FILE* file, const char* prefix, bool last_entry) const { - std::ostringstream buffer; - Dump(buffer, prefix); +void BitVector::DumpDotHelper(bool last_entry, FILE* file, std::ostringstream& buffer) const { // Now print it to the file. fprintf(file, " {%s}", buffer.str().c_str()); @@ -421,7 +419,32 @@ void BitVector::DumpDot(FILE* file, const char* prefix, bool last_entry) const { fprintf(file, "\\\n"); } -void BitVector::DumpHelper(std::ostringstream& buffer, const char* prefix) const { +void BitVector::DumpDot(FILE* file, const char* prefix, bool last_entry) const { + std::ostringstream buffer; + DumpHelper(prefix, buffer); + DumpDotHelper(last_entry, file, buffer); +} + +void BitVector::DumpIndicesDot(FILE* file, const char* prefix, bool last_entry) const { + std::ostringstream buffer; + DumpIndicesHelper(prefix, buffer); + DumpDotHelper(last_entry, file, buffer); +} + +void BitVector::DumpIndicesHelper(const char* prefix, std::ostringstream& buffer) const { + // Initialize it. + if (prefix != nullptr) { + buffer << prefix; + } + + for (size_t i = 0; i < number_of_bits_; i++) { + if (IsBitSet(i)) { + buffer << i << " "; + } + } +} + +void BitVector::DumpHelper(const char* prefix, std::ostringstream& buffer) const { // Initialize it. if (prefix != nullptr) { buffer << prefix; |