From 2738e75b0400da523b094edd7491701c6a38545e Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Tue, 3 May 2016 11:20:39 +0100 Subject: [PATCH] Print out array sizes --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 1171180..a0fbaf9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,6 +56,13 @@ void run() std::vector a(ARRAY_SIZE, 1.0); std::vector b(ARRAY_SIZE, 2.0); std::vector c(ARRAY_SIZE, 0.0); + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(1) << std::fixed + << "Array size: " << ARRAY_SIZE*sizeof(T)*1.0E-6 << " MB" + << " (=" << ARRAY_SIZE*sizeof(T)*1.0E-9 << " GB)" << std::endl; + std::cout << "Total size: " << 3.0*ARRAY_SIZE*sizeof(T)*1.0E-6 << " MB" + << " (=" << 3.0*ARRAY_SIZE*sizeof(T)*1.0E-9 << " GB)" << std::endl; + std::cout.precision(ss); Stream *stream;