MCPcopy Create free account
hub / github.com/Extra-Creativity/Modern-Cpp-Basics / measure

Function measure

08-String & Stream/code/Profile.cpp:122–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120
121template<typename T>
122void measure(std::string s, T func)
123{
124 auto t0 = std::chrono::steady_clock::now();
125 func(1000); // measure
126 auto t1 = std::chrono::steady_clock::now();
127 std::chrono::duration<double, std::milli> diff{ t1 - t0 };
128 std::cout << s << ": " << diff.count() << "ms\n ";
129 func(1); // show output
130}
131
132int main()
133{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected