Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frosted Glass Instrumentation

This is an instrumentation library to capture function exection traces on an ESP32. It is meant to be used together with the visualization tool on the frontend, which can be found here

To get the tracer working:

  1. Initialize the logging module (we currently only have Serial available, but we aim to add UDP in the future)
SerialLogger logger("\r\n");
  1. Initialize the tracer module
Tracer tracer(logger, QUEUE_SIZE);
  1. During setup() capture restart information and sync the tracer with the backend. Also initialize a logging task which will collect the logs and send them over UART.
void setup() {
    Serial.begin(460800);
    delay(100);

    if (!logger.begin()) {
        Serial.printf("Welp!");
    }

    TRACER_SYNC_AND_INIT();
    // ...

    xTaskCreatePinnedToCore(
        Tracer::static_log_traces,
        "logging task",
        4096,
        &tracer,
        1,
        NULL,
        0
    );
}
  1. Wrap all functions you want to trace in the TRACE_BLOCK macro
int try_fib(int a) {
    return TRACE_BLOCK({
        if (a <= 1) {
            return a;
        }
        return try_fib(a - 2) + try_fib(a - 1);
    }, a);
}

Current issues

  1. Even though the full program in example.ino is dedicated to tracing, the queue still overflows and drops packets, leading to reading issues on the backend. I think it might be because UART communication is too slow.

Todos

  • Add support for streaming data over UDP
  • Consider other structures besides FreeRTOS queue, since that locks on reads and writes

About

Ice-cool instrumentation

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages