Re: [cmake-developers] Profile Cmake scripts

2015-12-27 Thread Alexander Neundorf
On Sunday, December 27, 2015 18:40:27 Dimitar Yordanov wrote:
> Hi all,
> 
> 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.

I actually simply used valgrind/callgrind and got useful results from that.
Usually you see mostly string handling related functions.

Alex

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

[cmake-developers] Profile Cmake scripts

2015-12-27 Thread Dimitar Yordanov
Hi all,

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.

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.

Alternatively, the trace could output a time stamp at the beginning and at
the end of each command. But that would produce larger traces.

So, I would like to ask you for your opinion and if there is willingness to
integrate such a patch in CMake.

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.

1 - https://github.com/volo-zyko/cmake-profile-stats

Regards,
Dimitar
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Profile Cmake scripts

2015-12-27 Thread Dimitar Yordanov
2015-12-27 21:05 GMT+01:00 Alexander Neundorf :
>
> On Sunday, December 27, 2015 18:40:27 Dimitar Yordanov wrote:
>
> > Hi all,
>
> >
>
> > 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.
>
>
>
> I actually simply used valgrind/callgrind and got useful results from that.

I agree with you. Running valgrind directly on the cmake binary
provides useful information: I can see which internal cmake functions
are used the most and consume most of the time.

Nevertheless, I think it would be useful to have a higher level
overview. E.g. to see if there are some issues with the scripts
themselves that I use in my project ...

> Usually you see mostly string handling related functions.

malloc and free are on the top of what I see for a random project used
mostly by std::string. Maybe we can optimize something here too?

Regards,
Dimitar
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers