Ticket #1909: covoar_branch_report.patch

File covoar_branch_report.patch, 3.2 KB (added by Pawel, on Sep 1, 2011 at 9:26:28 PM)

patch adding taken /not taken counts to branch report

  • rtems-testing/covoar/ReportsHtml.cc

    RCS file: /usr1/CVS/rtems-testing/covoar/ReportsHtml.cc,v
    retrieving revision 1.4
    diff -u -8 -p -r1.4 ReportsHtml.cc
    namespace Coverage { 
    198198           TABLE_HEADER_CLASS "\">\n"
    199199        "<thead>\n"
    200200        "<tr>\n"
    201201        "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
    202202        "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
    203203        "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
    204204        "<th class=\"table-sortable:numeric\" align=\"left\">Size </br>Bytes</th>\n"
    205205        "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
     206        "<th class=\"table-sortable:default\" align=\"left\">Taken / Not Taken</th>\n"
    206207        "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
    207208        "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
    208209        "</tr>\n"
    209210        "</thead>\n"
    210211        "<tbody>\n",
    211212        asctime( localtime(&timestamp_m) )
    212213      );
    213214    }
    namespace Coverage { 
    503504    unsigned int                                     count,
    504505    Coverage::DesiredSymbols::symbolSet_t::iterator  symbolPtr,
    505506    Coverage::CoverageRanges::ranges_t::iterator     rangePtr
    506507  )
    507508  {
    508509    const Coverage::Explanation* explanation;
    509510    std::string                  temp;
    510511    int                          i;
     512    uint32_t                     bAddress = 0;
     513    uint32_t                     lowAddress = 0;
     514    Coverage::CoverageMapBase*   theCoverageMap = NULL;
    511515
    512516    // Mark the background color different for odd and even lines.
    513517    if ( ( count%2 ) != 0 )
    514518      fprintf( report, "<tr class=\"covoar-tr-odd\">\n");
    515519    else
    516520      fprintf( report, "<tr>\n");
    517521
    518522    // symbol
    namespace Coverage { 
    555559      );
    556560    else if (rangePtr->reason ==
    557561      Coverage::CoverageRanges::UNCOVERED_REASON_BRANCH_NEVER_TAKEN)
    558562      fprintf(
    559563        report,
    560564        "<td class=\"covoar-td\" align=\"center\">Never Taken</td>\n"
    561565      );
    562566
     567    // Taken / Not taken counts
     568    lowAddress = rangePtr->lowAddress;
     569    bAddress = symbolPtr->second.baseAddress;
     570    theCoverageMap = symbolPtr->second.unifiedCoverageMap;
     571    fprintf(
     572      report,
     573      "<td class=\"covoar-td\" align=\"center\">%d / %d</td>\n",
     574      theCoverageMap->getWasTaken( lowAddress - bAddress ),
     575      theCoverageMap->getWasNotTaken( lowAddress - bAddress )
     576    );
     577
    563578    // See if an explanation is available and write the Classification and
    564579    // the Explination Columns.
    565580    explanation = AllExplanations->lookupExplanation( rangePtr->lowSourceLine );
    566581    if ( !explanation ) {
    567       // Write Classification
     582      // Write Classificationditr->second.baseAddress
    568583      fprintf(
    569584        report,
    570585        "<td class=\"covoar-td\" align=\"center\">NONE</td>\n"
    571586        "<td class=\"covoar-td\" align=\"center\">No Explanation</td>\n"
    572587      );
    573588    } else {
    574589      char explanationFile[48];
    575590      sprintf( explanationFile, "explanation%d.html", rangePtr->id );