Skip to content

Commit

Permalink
Now with added testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Jan 3, 2025
1 parent f142a7a commit 1ec6487
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Src/msgDecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static bool _handleDWTEvent( struct ITMPacket *packet, struct dwtMsg *decoded )

{
decoded->msgtype = MSG_DWT_EVENT;
decoded->event = packet->d[1] & 0x2F;
decoded->event = packet->d[0] & 0x2F;
return true;
}
// ====================================================================================================
Expand Down
36 changes: 19 additions & 17 deletions Src/orbtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define MSG_REORDER_BUFLEN (10) /* Maximum number of samples to re-order for timekeeping */

#define DWT_NUM_EVENTS 6
const char *evName[DWT_NUM_EVENTS] = {"CPI", "Exc", "Sleep", "LSU", "Fold", "Cyc"};
const char *evName[DWT_NUM_EVENTS] = {"CPI", "Exc", "Slp", "LSU", "Fld", "Cyc"};

struct visitedAddr /* Structure for Hashmap of visited/observed addresses */
{
Expand Down Expand Up @@ -148,7 +148,7 @@ struct
uint32_t TSPkt; /* Number of TS Packets received */
uint32_t HWPkt; /* Number of HW Packets received */
uint32_t dwt_event_acc[DWT_NUM_EVENTS]; /* Accumulator for DWT events */

FILE *jsonfile; /* File where json output is being dumped */
uint32_t interrupts;
uint32_t sleeps;
Expand Down Expand Up @@ -356,7 +356,7 @@ void _handleDWTEvent( struct dwtMsg *m, struct ITMPacket *p )
{
if ( m->event & ( 1 << i ) )
{
_r.dwt_event_acc[i]++;
_r.dwt_event_acc[i]++;
}
}
}
Expand Down Expand Up @@ -725,19 +725,21 @@ static void _outputTop( uint32_t total, uint32_t reportLines, struct reportLine
}

bool havePrinted = false;

/* DWT Event counters */
for ( uint32_t i = 0; i < DWT_NUM_EVENTS; i++ )
{
if ( _r.dwt_event_acc[i] )
{
havePrinted = true;
genericsPrintf( "%4s:%8d ",evName[i],_r.dwt_event_acc[i] );
if ( _r.dwt_event_acc[i] )
{
havePrinted = true;
genericsPrintf( "%4s:" C_DATA "%7d " C_RESET, evName[i], _r.dwt_event_acc[i] );
}
}

if ( havePrinted )
{
genericsPrintf( EOL );
}
{
genericsPrintf( EOL );
}

if ( options.outputExceptions )
{
Expand Down Expand Up @@ -1108,7 +1110,7 @@ errcode _processOptions( int argc, char *argv[] )
if ( !isdigit( *optarg ) )
{
genericsReport( V_ERROR, "-v requires a numeric argument." EOL );
return ERR;
return ERR;
}

genericsSetReportLevel( atoi( optarg ) );
Expand Down Expand Up @@ -1518,12 +1520,12 @@ int main( int argc, char *argv[] )
_r.er[e].visits = _r.er[e].maxDepth = _r.er[e].totalTime = _r.er[e].minTime = _r.er[e].maxTime = _r.er[e].maxWallTime = 0;
}

/* ... and the event counters */
for ( uint32_t i = 0; i < DWT_NUM_EVENTS; i++ )
{
_r.dwt_event_acc[i]=0;
}
/* ... and the event counters */
for ( uint32_t i = 0; i < DWT_NUM_EVENTS; i++ )
{
_r.dwt_event_acc[i] = 0;
}


/* It's safe to update these here because the ticks won't be updated until more
* records arrive. */
Expand Down

0 comments on commit 1ec6487

Please sign in to comment.