Skip to content

Commit

Permalink
removed cycle count print
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas committed Oct 29, 2024
1 parent 03b12bd commit a65caa3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ext/orbetto/metrics/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ is to do regression testing and fuzzing with statistics derived from the instruc
- Thread progress vs semaphores
- Callstack changes (code coverage) [Done].

All these metrics need to be combined into a large latent space that can be diffed (a kind of distance measure) between different versions of PX4.
of PX4 to detect bugs in the code before it flies.
All these metrics need to be combined into a large latent space that can be diffed (a kind of distance measure) between different versions of PX4
to detect bugs in the code before it flies.

## GCOV

Expand All @@ -48,7 +48,7 @@ Two files are required for gcov to display code coverage:
- .gcno, which is an advanced source file you get when compiling with the GCC -ftest-coverage option
- .gcda, which is created when the GCC -fprofile-arcs option is run.

It should be a simple .gcno file as the flag is already a compile option in PX4.
It should be simple to get the .gcno file as the flag is already a compile option in PX4.
Theoretically it should be possible to reverse engineer the .gcda file just from the PC values,
(documentation can be found here: https://github.com/gcc-mirror/gcc/blob/master/gcc/gcov-io.h)
However, it is unclear how long this will take and how robust it will be.
10 changes: 8 additions & 2 deletions ext/orbetto/src/mortrall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ class Mortrall
/* The number of overflows is one metrics that represents the quality of the trace */
/* If there are many overflows try implicit tracing */
printf("Overflows: %llu - %llu\n",cpu->overflows,cpu->ASyncs);
if (cpu->overflows > 0)
{
printf("Warning: When tracing implicit, it is very likely overflows corrupt the Call Stack.\n");
}
printf("PC bitmap cardinality = %llu\n", r1.cardinality());
// Serialize the bitmap to a file
// Step 1: Get the size of the serialized bitmap
Expand Down Expand Up @@ -289,7 +293,7 @@ class Mortrall
/* Check for Cycle Count update to reset instruction count*/
if (TRACEStateChanged( &Mortrall::r->i, EV_CH_CYCLECOUNT) )
{
Mortrall::_generate_protobuf_cycle_counts();
// Mortrall::_generate_protobuf_cycle_counts();
Mortrall::_flush_proto_buffer();
Mortrall::r->instruction_count = 0;
Mortrall::update_itm_timestamp(cpu->cycleCount);
Expand Down Expand Up @@ -858,6 +862,7 @@ class Mortrall
/* Handle the context switch after a exception */
if (Mortrall::r->exceptionEntry)
{
Mortrall::_generate_protobuf_cycle_counts();
/* Check if exception Id is in the map */
if(!Mortrall::exception_names.contains(Mortrall::r->exceptionId))
{
Expand All @@ -879,8 +884,9 @@ class Mortrall
{
/* As there is no exception exit packet the exit has to be detected by ending of the "arm_exception" function */
/* If highaddr is reached its the end of exception (highaddr might be offset by a 1/2 byte) */
if(r->exceptionActive && func && strstr(func->funcname,"arm_exception") && (Mortrall::r->op.workingAddr >= (func->highaddr - 0xf))&& (Mortrall::r->op.workingAddr <= (func->highaddr)))
if(r->exceptionActive && func && strstr(func->funcname,"arm_exception") && (Mortrall::r->op.workingAddr >= (func->highaddr - 0x1f))&& (Mortrall::r->op.workingAddr <= (func->highaddr + 0xf)))
{
Mortrall::_generate_protobuf_cycle_counts();
/* Clear the exception call stack */
_removeRetFromStack(Mortrall::r);
_generate_protobuf_entries_single(Mortrall::r->op.workingAddr);
Expand Down

0 comments on commit a65caa3

Please sign in to comment.