The c++ timing library can be used to measure the time cost for a program or the subroutines in the program.