Profiling
Go over the Project 4
Profiling is an activity we undergo in order to reason about the speed of our programs
How fast does it execute overall?
Which functions take the most time to execute?
Which functions are executed the most?
Useful for when we need to focus on optimizing prohrams for speed
For more, see profiling
We need to:
Create a directory called sort_report in your cs23001 folder
Copy the sort.cpp
, sort_lib.cpp
, and sort_lib.h
files from shared/project4 into your sort_report folder
Let's profile the sort program
clang++ -std=c++11 -pg sort.cpp sprt_lib.cpp
./a.out -sz 30000 -bs
-- will create the gmon.out
file
gprof ./a.out > out.txt
-- will run the profiler and put the output in out.txt
Use the profiler on the sort program and report on which functions take the longest. How long do they take? Why do you think they're slow?
In sort_report/explanation.txt
, tell us what function in the sort program took the longest and give a small explanation (a few sentences) as to why this function(s) are bottlenecks.
The following should be true when you are done, NAMES MUST MATCH EXACTLY:
In your cs23001 directory you have created a directory named sort_report.
In the directory sort_report you have the following files:
The copied sort.cpp
, sort_lib.cpp
, sort_lib.h
files from shared/project4
out.txt
, containing the results of running the profiler
explanation.txt
, detailing what function took the longest and why
There are NO executables in the repository.