how can i check bottle neck in my code while node is running?
So i have a node that subscribes pointcloud2 msgs which generated from moving line scanner. (about 200hz publish rate) I tried to concatenate(add) pointcloud every subscribe callback but it seems very slow. about 20hz, i tested by publish back from callback function which could make little slow yet 20hz seems too slow. (i used ros::spin.)
There is definitely bottle neck in my code. Is there anyway i can check the code bottle neck while ros node is running? Only idea i have is to print curret time every line that matters in the code, but this seem very tedious. so if there is any solution it would be great! any idea is also welcome :) thx.
more general info about what i am trying to do
each pointcloud has 800 point (xyz) pointcloud data will be added and when node is finished it will save total point cloud.