aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/run-time-clock.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdbsupport/run-time-clock.h')
-rw-r--r--gdbsupport/run-time-clock.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/gdbsupport/run-time-clock.h b/gdbsupport/run-time-clock.h
index a961f4c..2743514 100644
--- a/gdbsupport/run-time-clock.h
+++ b/gdbsupport/run-time-clock.h
@@ -51,6 +51,33 @@ struct system_cpu_time_clock
static time_point now () noexcept = delete;
};
+/* Whether to measure time run time for the whole process or just one
+ thread. */
+
+enum class run_time_scope
+{
+ process,
+ thread,
+};
+
+/* Return the user/system time as separate time points, if
+ supported. If not supported, then the combined user+kernel time
+ is returned in USER and SYSTEM is set to zero.
+
+ SCOPE indicates whether to return the run time for the whole
+ process or just for the calling thread. If the latter isn't
+ supported, then returns the run time for the whole process even if
+ run_time_scope::thread is requested. */
+
+void get_run_time (user_cpu_time_clock::time_point &user,
+ system_cpu_time_clock::time_point &system,
+ run_time_scope scope) noexcept;
+
+/* Returns true if is it possible for get_run_time above to return the
+ run time for just the calling thread. */
+
+bool get_run_time_thread_scope_available ();
+
/* Count the total amount of time spent executing in userspace+kernel
mode. */
@@ -64,12 +91,6 @@ struct run_time_clock
static constexpr bool is_steady = true;
static time_point now () noexcept;
-
- /* Return the user/system time as separate time points, if
- supported. If not supported, then the combined user+kernel time
- is returned in USER and SYSTEM is set to zero. */
- static void now (user_cpu_time_clock::time_point &user,
- system_cpu_time_clock::time_point &system) noexcept;
};
#endif /* GDBSUPPORT_RUN_TIME_CLOCK_H */