1 //===----------------------------------------------------------------------===////
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===////
12 // Define LIBCXXABI_USE_TIMER to enable testing with a timer.
13 #if defined(LIBCXXABI_USE_TIMER)
20 typedef std::chrono::high_resolution_clock Clock
;
21 typedef Clock::time_point TimePoint
;
22 typedef std::chrono::microseconds MicroSeconds
;
24 timer() : m_start(Clock::now()) {}
26 timer(timer
const &) = delete;
27 timer
& operator=(timer
const &) = delete;
31 using std::chrono::duration_cast
;
32 TimePoint end
= Clock::now();
33 MicroSeconds us
= duration_cast
<MicroSeconds
>(end
- m_start
);
34 std::printf("%d microseconds\n", us
.count());
41 #else /* LIBCXXABI_USE_TIMER */
47 timer(timer
const &) = delete;
48 timer
& operator=(timer
const &) = delete;
52 #endif /* LIBCXXABI_USE_TIMER */