Skip to content

Logger: add a progress bar when reversing the offsets

The first step after a simulation is to reverse the offset of a simulation. To do so, we need to go through the whole file. It can be long, therefore we should show a progress bar for this step.

Maybe we should also include an estimate of the total time?

I am planning to do something like this:

Processing the file: [=====        ] 40% Remaining time: 2h10min

The remaining time can be computed from the percentage of file processed and the time since the start of the computation.

A possible way to get the window size:

#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>

int main (int argc, char **argv)
{
    struct winsize w;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);

    printf ("lines %d\n", w.ws_row);
    printf ("columns %d\n", w.ws_col);
    return 0;  // make sure your main returns int
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information