diff options
author | Ernie Rael <errael@raelity.com> | 2023-03-16 21:43:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-03-16 21:43:15 +0000 |
commit | 076de79ad832558267b3ff903c048df2f4c1a5d6 (patch) | |
tree | e0412a99ca8e44db8702b98a6a1cec93a0c561b9 /src/vim.h | |
parent | 16110ccf11de7a41cb0db0ae1ecb829e5a1b98fc (diff) |
patch 9.0.1411: accuracy of profiling is not optimalv9.0.1411
Problem: Accuracy of profiling is not optimal.
Solution: Use CLOCK_MONOTONIC if possible. (Ernie Rael, closes #12129)
Diffstat (limited to 'src/vim.h')
-rw-r--r-- | src/vim.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1869,8 +1869,27 @@ typedef void *vim_acl_T; // dummy to pass an ACL to a function #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO) # ifdef MSWIN typedef LARGE_INTEGER proftime_T; +# define PROF_TIME_BLANK " " +# define PROF_TOTALS_HEADER "count total (s) self (s)" # else + // Use tv_fsec for fraction of second (micro or nano) of proftime_T +# if defined(HAVE_TIMER_CREATE) +typedef struct timespec proftime_T; +# define PROF_GET_TIME(tm) clock_gettime(CLOCK_MONOTONIC, tm) +# define tv_fsec tv_nsec +# define TV_FSEC_SEC 1000000000L +# define PROF_TIME_FORMAT "%3ld.%09ld" +# define PROF_TIME_BLANK " " +# define PROF_TOTALS_HEADER "count total (s) self (s)" +# else typedef struct timeval proftime_T; +# define PROF_GET_TIME(tm) gettimeofday(tm, NULL) +# define tv_fsec tv_usec +# define TV_FSEC_SEC 1000000 +# define PROF_TIME_FORMAT "%3ld.%06ld" +# define PROF_TIME_BLANK " " +# define PROF_TOTALS_HEADER "count total (s) self (s)" +# endif # endif #else typedef int proftime_T; // dummy for function prototypes |