[GRASS-dev] [GRASS GIS] #3007: pygrass.messages.Messenger.percent() smallest step is 2

#3007: pygrass.messages.Messenger.percent() smallest step is 2
---------------------+-------------------------
Reporter: lrntct | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: PyGRASS | Version: svn-trunk
Keywords: | CPU: x86-64
Platform: Linux |
---------------------+-------------------------
Even when the measured task is several hours long, Messenger.percent()
displays steps two by two, instead of an expected one by one. This could
give the false impression that the execution has stalled.

Bellow is a minimum working example:

{{{
from grass.pygrass.messages import Messenger
import time
total_time = 1000
msgr = Messenger()
for i in range(total_time):
     msgr.percent(i, total_time, 1)
     time.sleep(0.5)
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3007&gt;
GRASS GIS <https://grass.osgeo.org>

#3007: pygrass.messages.Messenger.percent() smallest step is 2
---------------------+-------------------------
  Reporter: lrntct | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.0
Component: LibGIS | Version: svn-trunk
Resolution: | Keywords:
       CPU: x86-64 | Platform: Linux
---------------------+-------------------------
Changes (by zarch):

* component: PyGRASS => LibGIS

Comment:

I change the component fom pygrass to LibGis since I see the problem also
with C code:

{{{
#include<unistd.h>
#include <grass/gis.h>

int main()
{
         int row;
         int nrows = 1352;

         G_message("Percent complete...");
         for (row = 0; row < nrows; row++)
         {
                 G_percent(row, nrows, 1);
                 usleep(10000);
         }
         G_percent(1, 1, 1);
         return 0;
}

}}}

Looking at the `G_percent` code I don't understand when is used the
function `G_set_percent_routine(int (*percent_routine) (int))` within the
GRASS code and where the default percent_routine is defined.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3007#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>