#include #include constexpr auto tenMill = 10000000; class MySingleton{ public: static MySingleton& getInstance(){ static MySingleton instance; return instance; } private: MySingleton() = default; ~MySingleton() = default; MySingleton(const MySingleton&) = delete; MySingleton& operator=(const MySingleton&) = delete; }; int main(){ auto begin = std::chrono::steady_clock:: now(); for (size_t i = 0; i <= tenMill; ++i){ MySingleton::getInstance(); } std::chrono::duration res= std::chrono::steady_clock::now() - begin; std::cout << res.count() << std::endl; }