diff options
author | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-05-13 17:36:17 +0000 |
---|---|---|
committer | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-05-13 17:36:17 +0000 |
commit | 2d88955f3606f79bb63d7485737e3aec143a0fc2 (patch) | |
tree | 5e1277529350eef7c455d5318360c49fe3622edd /rtems-coverage | |
parent | a21b35eb0974177c763ac1b863d71a70111e9cfd (diff) |
2010-05-13 Jennifer Averett <Jennifer.Averett@OARcorp.com
* DesiredSymbols.cc, DesiredSymbols.h, covoar.cc: Added a statistics
class to consilidate statistical information. Note, that all new
values are still 0 and are not yet calculated.
Diffstat (limited to 'rtems-coverage')
-rw-r--r-- | rtems-coverage/ChangeLog | 6 | ||||
-rw-r--r-- | rtems-coverage/DesiredSymbols.cc | 28 | ||||
-rw-r--r-- | rtems-coverage/DesiredSymbols.h | 121 | ||||
-rw-r--r-- | rtems-coverage/covoar.cc | 2 |
4 files changed, 112 insertions, 45 deletions
diff --git a/rtems-coverage/ChangeLog b/rtems-coverage/ChangeLog index aef8d42..d5a0301 100644 --- a/rtems-coverage/ChangeLog +++ b/rtems-coverage/ChangeLog @@ -1,3 +1,9 @@ +2010-05-13 Jennifer Averett <Jennifer.Averett@OARcorp.com + + * DesiredSymbols.cc, DesiredSymbols.h, covoar.cc: Added a statistics + class to consilidate statistical information. Note, that all new + values are still 0 and are not yet calculated. + 2010-05-13 Joel Sherrill <joel.sherrilL@OARcorp.com> * do_coverage: Provide capability to only analyze one configuration. diff --git a/rtems-coverage/DesiredSymbols.cc b/rtems-coverage/DesiredSymbols.cc index da9048f..37ab56c 100644 --- a/rtems-coverage/DesiredSymbols.cc +++ b/rtems-coverage/DesiredSymbols.cc @@ -24,10 +24,6 @@ namespace Coverage { DesiredSymbols::DesiredSymbols() { - branchesAlwaysTaken = 0; - branchesFound = 0; - branchesNeverTaken = 0; - uncoveredRanges = 0; } DesiredSymbols::~DesiredSymbols() @@ -163,7 +159,7 @@ namespace Coverage { sitr->second.uncoveredBranches = theBranches; // Now scan through the coverage map of this symbol. - endAddress = sitr->second.sizeInBytes - 1; + endAddress = sitr->second.stats.sizeInBytes - 1; a = 0; while (a <= endAddress) { @@ -177,7 +173,7 @@ namespace Coverage { ; ha--; - uncoveredRanges++; + stats.uncoveredRanges++; theRanges->add( sitr->second.baseAddress + la, sitr->second.baseAddress + ha, @@ -189,7 +185,7 @@ namespace Coverage { // If an address is a branch instruction, add any uncovered branches // to the uncoverd branches. else if (theCoverageMap->isBranch( a )) { - branchesFound++; + stats.branchesFound++; la = a; for (ha=a+1; ha<=endAddress && !theCoverageMap->isStartOfInstruction( ha ); @@ -198,7 +194,7 @@ namespace Coverage { ha--; if (theCoverageMap->wasAlwaysTaken( la )) { - branchesAlwaysTaken++; + stats.branchesAlwaysTaken++; theBranches->add( sitr->second.baseAddress + la, sitr->second.baseAddress + ha, @@ -215,7 +211,7 @@ namespace Coverage { } else if (theCoverageMap->wasNeverTaken( la )) { - branchesNeverTaken++; + stats.branchesNeverTaken++; theBranches->add( sitr->second.baseAddress + la, sitr->second.baseAddress + ha, @@ -265,7 +261,7 @@ namespace Coverage { if (itr->second.unifiedCoverageMap) { // ensure that the specified size matches the existing size. - if (itr->second.sizeInBytes != size) { + if (itr->second.stats.sizeInBytes != size) { fprintf( stderr, @@ -301,7 +297,7 @@ namespace Coverage { symbolName.c_str(), 0, highAddress ); itr->second.unifiedCoverageMap = aCoverageMap; - itr->second.sizeInBytes = size; + itr->second.stats.sizeInBytes = size; } } @@ -480,19 +476,19 @@ namespace Coverage { } uint32_t DesiredSymbols::getNumberBranchesAlwaysTaken( void ) const { - return branchesAlwaysTaken; + return stats.branchesAlwaysTaken; }; uint32_t DesiredSymbols::getNumberBranchesFound( void ) const { - return branchesFound; + return stats.branchesFound; }; uint32_t DesiredSymbols::getNumberBranchesNeverTaken( void ) const { - return branchesNeverTaken; + return stats.branchesNeverTaken; }; uint32_t DesiredSymbols::getNumberUncoveredRanges( void ) const { - return uncoveredRanges; + return stats.uncoveredRanges; }; bool DesiredSymbols::isDesired ( @@ -540,7 +536,7 @@ namespace Coverage { // Ensure that the source and destination coverage maps // are the same size. - dMapSize = itr->second.sizeInBytes; + dMapSize = itr->second.stats.sizeInBytes; sBaseAddress = sourceCoverageMap->getLowAddress(); sMapSize = sourceCoverageMap->getHighAddress() - sBaseAddress + 1; if (dMapSize != sMapSize) { diff --git a/rtems-coverage/DesiredSymbols.h b/rtems-coverage/DesiredSymbols.h index 90b659a..be6a2e2 100644 --- a/rtems-coverage/DesiredSymbols.h +++ b/rtems-coverage/DesiredSymbols.h @@ -22,6 +22,90 @@ namespace Coverage { + + /*! @class Stats + * + * This class defines the statistics that are tracked. + */ + class Statistics { + public: + + /*! + * This member variable contains the total number of branches always + * taken. + */ + int branchesAlwaysTaken; + + /*! + * This member variable contains the total number of branches found. + */ + int branchesFound; + + /*! + * This member variable contains the total number of branches never + * taken. + */ + int branchesNeverTaken; + + /*! + * This member contains the size in Bytes. + */ + uint32_t sizeInBytes; + + /*! + * This member contains the size in Bytes. + */ + uint32_t sizeInInstructions; + + /*! + * This member variable contains the total number of uncovered bytes. + */ + int uncoveredBytes; + + /*! + * This member variable contains the total number of uncovered assembly + * instructions. + */ + int uncoveredInstructions; + + /*! + * This member variable contains the total number of uncovered ranges. + */ + int uncoveredRanges; + + /*! + * This method returns the percentage of uncovered instructions. + * + * @return Returns the percent uncovered instructions + */ + uint32_t getPercentUncoveredInstructions( void ) const; + + /*! + * This method returns the percentage of uncovered bytes. + * + * @return Returns the percent uncovered bytes + */ + uint32_t getPercentUncoveredBytes( void ) const; + + /*! + * This method constructs a Statistics instance. + */ + Statistics(): + branchesAlwaysTaken(0), + branchesFound(0), + branchesNeverTaken(0), + sizeInBytes(0), + sizeInInstructions(0), + uncoveredBytes(0), + uncoveredInstructions(0), + uncoveredRanges(0) + { + } + + + + }; + /*! @class SymbolInformation * * This class defines the information kept for each symbol that is @@ -36,10 +120,6 @@ namespace Coverage { */ uint32_t baseAddress; - /*! - * This member contains the size of the symbol. - */ - uint32_t sizeInBytes; /*! * This member contains the disassembly associated with a symbol. @@ -53,6 +133,11 @@ namespace Coverage { std::string sourceFile; /*! + * This member contains the statistics kept on each symbol. + */ + Statistics stats; + + /*! * This member contains information about the branch instructions of * a symbol that were not fully covered (i.e. taken/not taken). */ @@ -75,7 +160,6 @@ namespace Coverage { */ SymbolInformation() : baseAddress( 0 ), - sizeInBytes( 0 ), uncoveredBranches( NULL ), uncoveredRanges( NULL ), unifiedCoverageMap( NULL ) @@ -215,31 +299,12 @@ namespace Coverage { */ void preprocess( void ); - private: - /*! - * This member variable contains the total number of branches always - * taken for all analyzed symbols. - */ - int branchesAlwaysTaken; + * This member contains the statistics kept on each symbol. + */ + Statistics stats; - /*! - * This member variable contains the total number of branches found - * for all analyzed symbols. - */ - int branchesFound; - - /*! - * This member variable contains the total number of branches never - * taken for all analyzed symbols. - */ - int branchesNeverTaken; - - /* - * This member variable contains the total number of uncovered ranges - * for all analyzed symbols. - */ - int uncoveredRanges; + private: /*! * This method uses the specified executable file to determine the diff --git a/rtems-coverage/covoar.cc b/rtems-coverage/covoar.cc index 9ee231d..3c58cea 100644 --- a/rtems-coverage/covoar.cc +++ b/rtems-coverage/covoar.cc @@ -395,7 +395,7 @@ int main( theCoverageMap = itr->second.unifiedCoverageMap; if (theCoverageMap) { - endAddress = itr->second.sizeInBytes - 1; + endAddress = itr->second.stats.sizeInBytes - 1; for (a = 0; a <= endAddress; a++) { totalBytes++; |