I don't really like adding this to gxe_system_canvas_refresh(), because this function is only invoked if the application manually initiates a canvas refresh operation. Typically the canvas refresh operation is not invoked manually, it is invoked internally by GUIX when the GUIX event queue is emptied. When GUIX internally invokes the canvas refresh, it does not go through the error-checking "_gxe" wrapper.
I would like to dive into why the display_driver_drawing_complete isn't giving you accurate results. As you can see this is invoked only when the canvas drawing operation "unwinds" and we are done with a drawing sequence, as the code snippet in canvas_drawing_complete below:
if (canvas -> gx_canvas_draw_nesting > 0)
{
if (display -> gx_display_driver_drawing_complete)
{
display -> gx_display_driver_drawing_complete(display, canvas);
}
If you are getting here multiple times for each drawing sequence, it sounds like you are manually invoking the canvas refresh and you are doing this for each dirty widget, rather than combining all the updates into one canvas refresh? That could slow things down considerably, because we also toggle frame buffers when a canvas refresh sequence is complete. So in your example, if you update three dials individually, that would trigger three frame bugger toggle operations. Better to wrap all three updates into one sequence. So like this in pseudo-code:
gx_canvas_drawing_initiate() // mark the beginning
for each dial:
gx_canvas_drawing_initiate()
dial->gx_widget_draw()
gx_canvas_drawing_complete()
gx_canvas_drawing_complete() // the end, buffer toggle and FPS count
This happens for you automatically if you just mark the widgets dirty and let GUIX do the canvas refresh internally. If you are manually invoking canvas refresh, then you have control over how this happens. I would generally advise just to mark the widgets dirty and let GUIX take care of redrawing what needs to be redrawn, but you could have very good reasons for doing things as you are, every application is different.
Hope this helps,
Ken