From ad71d0519fa76758a65e71cb4c96cb7f4d6b3c6e Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Mon, 24 Feb 2025 22:36:33 -0500 Subject: [PATCH] re-organize --- lectures/optimization/gprof/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lectures/optimization/gprof/README.md b/lectures/optimization/gprof/README.md index d588c13..38bea16 100644 --- a/lectures/optimization/gprof/README.md +++ b/lectures/optimization/gprof/README.md @@ -61,7 +61,6 @@ int main() { - **Flat Profile**: Shows execution time spent in each function. - **Call Graph**: Displays function call relationships and their execution time. -The profiling results show that heavyComputation() takes significantly more execution time than lightComputation(), even though lightComputation() is called 1000 times. The flat profile from gprof also indicates the percentage of time spent in each function, helping to identify bottlenecks. For the above test program, the flat profile is like this: ```plaintext @@ -73,6 +72,8 @@ Each sample counts as 0.01 seconds. 0.00 0.28 0.00 1 0.00 0.00 __static_initialization_and_destruction_0(int, int) ``` +As can be seen, the profiling results show that heavyComputation() takes significantly more execution time than lightComputation(), even though lightComputation() is called 1000 times. + Note: The __static_initialization_and_destruction_0(int, int) function is generated by the compiler during the static initialization and destruction phases of a program, particularly for global or static variables. ## Best Practices for Using `gprof`