Thanks for replying! 
Once I set "stereo_to_depth" to true, the grid map stoped from being created, so it is now set to false. But, as you said, to build the 2D grid, the disparity function is called anyway. Using "boost::stacktrace::stacktrace()" inside 
rtabmap::util2d::disparityFromStereoImages  I traced the function and realized that it is called 
here. Finally, I could define well the timers I need. 
Btw, I also replicated your modifications regarding  RtabmapROS/TimeMsgConversion/ms in the ROS2 branch. Let me know if a PR is welcome.
Thank you for your help!