DanyBv icon

Time elapsed

DanyBv | PRO | 11/22/18 07:40:05 AM UTC | 0 ⭐ | 194 👁️ | Never ⏰ | []
C++ |

460 B

|

None

|

0 👍

/

0 👎

#include <iostream>
#include <chrono>
#define TIME_ELAPSED(code) auto start = std::chrono::high_resolution_clock::now(); code auto end = std::chrono::high_resolution_clock::now(); std::cout << "Time elapsed : " << static_cast<double>(std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count()) / 1000000000.0 << "s";
 
int main()
{
    TIME_ELAPSED(
        for (auto index = 0; index < 100000; ++index)
            std::cout << "Bla bla bla";
    )
    return 0;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎