[gdb] Fix more typos
[binutils-gdb.git] / gdbsupport / run-time-clock.h
blob41944b1a80e00bb60e6606a071da2742d184eb83
1 /* User/system CPU time clocks that follow the std::chrono interface.
2 Copyright (C) 2016-2023 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #ifndef COMMON_RUN_TIME_CLOCK_H
20 #define COMMON_RUN_TIME_CLOCK_H
22 #include <chrono>
24 /* Count the total amount of time spent executing in user mode. */
26 struct user_cpu_time_clock
28 using duration = std::chrono::microseconds;
29 using rep = duration::rep;
30 using period = duration::period;
31 using time_point = std::chrono::time_point<user_cpu_time_clock>;
33 static constexpr bool is_steady = true;
35 /* Use run_time_clock::now instead. */
36 static time_point now () noexcept = delete;
39 /* Count the total amount of time spent executing in kernel mode. */
41 struct system_cpu_time_clock
43 using duration = std::chrono::microseconds;
44 using rep = duration::rep;
45 using period = duration::period;
46 using time_point = std::chrono::time_point<system_cpu_time_clock>;
48 static constexpr bool is_steady = true;
50 /* Use run_time_clock::now instead. */
51 static time_point now () noexcept = delete;
54 /* Count the total amount of time spent executing in userspace+kernel
55 mode. */
57 struct run_time_clock
59 using duration = std::chrono::microseconds;
60 using rep = duration::rep;
61 using period = duration::period;
62 using time_point = std::chrono::time_point<run_time_clock>;
64 static constexpr bool is_steady = true;
66 static time_point now () noexcept;
68 /* Return the user/system time as separate time points, if
69 supported. If not supported, then the combined user+kernel time
70 is returned in USER and SYSTEM is set to zero. */
71 static void now (user_cpu_time_clock::time_point &user,
72 system_cpu_time_clock::time_point &system) noexcept;
75 #endif /* COMMON_RUN_TIME_CLOCK_H */