开发者

Send signal to a process inside valgrind?

开发者 https://www.devze.com 2022-12-20 05:19 出处:网络
How can 开发者_Python百科I send a signal to my process which runs inside valgrind to check its memory usage status?

How can 开发者_Python百科I send a signal to my process which runs inside valgrind to check its memory usage status?

Thanks!


To send a signal to valgrind, pkill -USR1 valgrind doesn't want to work for me.

pkill -USR1 memcheck

does the trick.


There is not a signal that tells valgrind to check its memory usage status. If you are interested in the amount of memory used by your program over time and where that memory is allocated, valgrind's massif tool can record that information, which can then be displayed using its ms_print utility. Massif records snapshots of the program's memory usage automatically throughout the execution of the program, including a peak snapshot representing the point at which the memory usage was at its peak (within 1% using the default options).

To run your program under valgrind's massif tool:

valgrind --tool=massif yourprogram

A binary file massif.out.pid will be created. Use ms_print to format the information in text form:

ms_print massif.out.12345
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号