re-organize

This commit is contained in:
Jidong Xiao
2025-02-24 22:36:33 -05:00
committed by JamesFlare
parent 165034d3da
commit ad71d0519f

View File

@@ -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`