<div dir="ltr"><div><div><div><div><div>Hi all,<br><br></div>I was searching for a way to profile CMake scripts in order to find bottlenecks and possibilities to improve performance. I found out that someone already invested time on that [1] providing a minimal solution. The idea behind it is to use the cmake "--trace" option and to output a time stamp and a stack depth with each executed command. The trace log is afterwards used by a Python script, which transforms it into a more readable format.<br><br></div>In [1] there existed already a patch for CMake 2.8. This can be easily adapted for CMake 3.4. One of the issues with that approach is that the add_subdirectory() command creates a new stack and thus starts the depth count back from one again. I think it would be more appropriate to work around that in the Python script, which does the processing. A time stamp at the end of the whole execution would also be needed in order to calculate the time needed for the last command.<br><br>Alternatively, the trace could output a time stamp at the beginning and at the end of each command. But that would produce larger traces.<br><br></div>So, I would like to ask you for your opinion and if there is willingness to integrate such a patch in CMake.<br><br></div><div>For the Python script itself I thought that it would maybe make sense to
 create an output in the Callgrind format. No idea if it is possible 
though.  </div><div><br>1 - <a href="https://github.com/volo-zyko/cmake-profile-stats" target="_blank">https://github.com/volo-zyko/cmake-profile-stats</a><br><br></div>Regards,<br></div>Dimitar<br></div><span>
</span>