Using gcc
, I compile and link with -pg
(as explained e.g. here), then continue by running the program (according to the principles also suggested at that URL) and using gprof
. The tools will vary if you're using different compilers &c, but the URL is still recommended, even then, for the parts that are about general ideas on how and why to profile your code.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…