Given that the library is considered part of your program, one way would be to implement a dimension in your code. The following minimal example is implemented in C ++ 11, performing only one function from a hypothetical library:
#include <chrono> #include <iostream> #include <hypothetical> int main() { using namespace std::chrono; system_clock systemClock; system_clock::time_point startingTime{systemClock.now()}; hypothetical::function(); system_clock::duration libraryTime{systemClock.now() - startingTime}; std::cout << "Hypothetical library took " << duration_cast<seconds>(libraryTime).count() << " seconds to run.\n"; return 0; }
You will need to extend this to all the functions that your program calls from your library.
source share