]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbsupport: move run_time_clock::now(user, system) out of run_time_clock
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 17 Apr 2025 19:23:52 +0000 (15:23 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Apr 2025 19:10:11 +0000 (15:10 -0400)
It is completely unrelated to run_time_clock, so I don't think it makes
sense to have it as a static function there.

Move it to be a free function named "get_run_time".

Change-Id: I0c3e4d3cc44ca37e523c94d72f7cd66add95645e
Approved-By: Tom Tromey <tom@tromey.com>
gdb/mi/mi-main.c
gdbsupport/run-time-clock.cc
gdbsupport/run-time-clock.h

index 850a9ab33418fd1d42bef2bc998ba1df05145f57..aea8fa9a02e8d435d634f8c51b41517dfba82c6f 100644 (file)
@@ -2218,7 +2218,7 @@ timestamp (struct mi_timestamp *tv)
   using namespace std::chrono;
 
   tv->wallclock = steady_clock::now ();
-  run_time_clock::now (tv->utime, tv->stime);
+  get_run_time (tv->utime, tv->stime);
 }
 
 static void
index 43da1d9b07fd343a42c2349ece72862c2c8e1416..d8de0313148adc91b85d46bebc979429d30be9ed 100644 (file)
@@ -38,8 +38,8 @@ timeval_to_microseconds (struct timeval *tv)
 #endif
 
 void
-run_time_clock::now (user_cpu_time_clock::time_point &user,
-                    system_cpu_time_clock::time_point &system) noexcept
+get_run_time (user_cpu_time_clock::time_point &user,
+             system_cpu_time_clock::time_point &system) noexcept
 {
 #ifdef HAVE_GETRUSAGE
   struct rusage rusage;
index a961f4cff6eff85fc440714e5404b123e8a82174..c789e9dcf7993ee1bd38aafb32f8a4ba011682ef 100644 (file)
@@ -51,6 +51,13 @@ struct system_cpu_time_clock
   static time_point now () noexcept = delete;
 };
 
+/* 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.  */
+
+void get_run_time (user_cpu_time_clock::time_point &user,
+                  system_cpu_time_clock::time_point &system) noexcept;
+
 /* Count the total amount of time spent executing in userspace+kernel
    mode.  */
 
@@ -64,12 +71,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 */