aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix/erl_unix_sys.h
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-05-21 16:56:41 +0200
committerLukas Larsson <[email protected]>2018-05-21 16:56:41 +0200
commit29871fb6086b535104b10703dd524781e87e0800 (patch)
tree1436b47255d78be4f1b35a8364b5eec024d863d9 /erts/emulator/sys/unix/erl_unix_sys.h
parent9cc697fe2cda12ed2d32fb134ed5584f248f9377 (diff)
parentd5dc5584884488c8fcb5710997a14c2c418692f3 (diff)
downloadotp-29871fb6086b535104b10703dd524781e87e0800.tar.gz
otp-29871fb6086b535104b10703dd524781e87e0800.tar.bz2
otp-29871fb6086b535104b10703dd524781e87e0800.zip
Merge branch 'lukas/erts/cpu_time_thread/OTP-15090'
* lukas/erts/cpu_time_thread/OTP-15090: erts: Make cpu_timestamp use per thread on Linux
Diffstat (limited to 'erts/emulator/sys/unix/erl_unix_sys.h')
-rw-r--r--erts/emulator/sys/unix/erl_unix_sys.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/erts/emulator/sys/unix/erl_unix_sys.h b/erts/emulator/sys/unix/erl_unix_sys.h
index 10adf80875..5bfe5a8e2d 100644
--- a/erts/emulator/sys/unix/erl_unix_sys.h
+++ b/erts/emulator/sys/unix/erl_unix_sys.h
@@ -292,6 +292,8 @@ erts_sys_perf_counter()
/*
* Functions for measuring CPU time
+ *
+ * Note that gethrvtime is time per process and clock_gettime is per thread.
*/
#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME_CPU_TIME))
@@ -300,15 +302,15 @@ typedef struct timespec SysTimespec;
#if defined(HAVE_GETHRVTIME)
#define sys_gethrvtime() gethrvtime()
-#define sys_get_proc_cputime(t,tp) (t) = sys_gethrvtime(), \
- (tp).tv_sec = (time_t)((t)/1000000000LL), \
- (tp).tv_nsec = (long)((t)%1000000000LL)
+#define sys_get_cputime(t,tp) (t) = sys_gethrvtime(), \
+ (tp).tv_sec = (time_t)((t)/1000000000LL), \
+ (tp).tv_nsec = (long)((t)%1000000000LL)
int sys_start_hrvtime(void);
int sys_stop_hrvtime(void);
#elif defined(HAVE_CLOCK_GETTIME_CPU_TIME)
#define sys_clock_gettime(cid,tp) clock_gettime((cid),&(tp))
-#define sys_get_proc_cputime(t,tp) sys_clock_gettime(CLOCK_PROCESS_CPUTIME_ID,(tp))
+#define sys_get_cputime(t,tp) sys_clock_gettime(CLOCK_THREAD_CPUTIME_ID,(tp))
#endif
#endif