Functions
profile.c File Reference
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include "nvim/profile.h"
#include "nvim/os/time.h"
#include "nvim/func_attr.h"
#include "nvim/os/os_defs.h"
#include "nvim/globals.h"

Functions

proftime_T profile_start (void)
 
proftime_T profile_end (proftime_T tm) FUNC_ATTR_WARN_UNUSED_RESULT
 
const char * profile_msg (proftime_T tm) FUNC_ATTR_WARN_UNUSED_RESULT
 
proftime_T profile_setlimit (int64_t msec) FUNC_ATTR_WARN_UNUSED_RESULT
 
bool profile_passed_limit (proftime_T tm) FUNC_ATTR_WARN_UNUSED_RESULT
 
proftime_T profile_zero (void)
 
proftime_T profile_divide (proftime_T tm, int count) FUNC_ATTR_CONST
 
proftime_T profile_add (proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST
 
proftime_T profile_sub (proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST
 
proftime_T profile_self (proftime_T self, proftime_T total, proftime_T children) FUNC_ATTR_CONST
 
proftime_T profile_get_wait (void)
 
void profile_set_wait (proftime_T wait)
 profile_set_wait - set the current waittime More...
 
proftime_T profile_sub_wait (proftime_T tm, proftime_T tma) FUNC_ATTR_PURE
 
bool profile_equal (proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST
 
int profile_cmp (proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST
 
void time_push (proftime_T *rel, proftime_T *start)
 
void time_pop (proftime_T tp)
 
void time_start (const char *message)
 
void time_msg (const char *mesg, const proftime_T *start)
 

Function Documentation

proftime_T profile_add ( proftime_T  tm1,
proftime_T  tm2 
)

profile_add - add the time tm2 to tm1

Returns
tm1 + tm2
int profile_cmp ( proftime_T  tm1,
proftime_T  tm2 
)

profile_cmp - compare profiling times

Only guarantees correct results if both input times are not more than 150 years apart.

Returns
<0, 0 or >0 if tm2 < tm1, tm2 == tm1 or tm2 > tm1
proftime_T profile_divide ( proftime_T  tm,
int  count 
)

profile_divide - divide the time tm by count.

Returns
0 if count <= 0, otherwise tm / count
proftime_T profile_end ( proftime_T  tm)

profile_end - compute the time elapsed

Returns
the elapsed time from tm until now.
bool profile_equal ( proftime_T  tm1,
proftime_T  tm2 
)

profile_equal - check if tm1 is equal to tm2

Returns
true if tm1 == tm2
proftime_T profile_get_wait ( void  )

profile_get_wait - get the current waittime

Returns
the current waittime
const char* profile_msg ( proftime_T  tm)

profile_msg - return a string that represents the time in tm

Warning
Do not modify or free this string, not multithread-safe.
Parameters
tmThe time to be represented
Returns
a static string representing tm in the form "seconds.microseconds".
bool profile_passed_limit ( proftime_T  tm)

profile_passed_limit - check if current time has passed tm

Returns
true if the current time is past tm, false if not or if the timer was not set.
proftime_T profile_self ( proftime_T  self,
proftime_T  total,
proftime_T  children 
)

profile_self - add the self time from the total time and the children's time

Returns
if total <= children, then self, otherwise self + total - children
void profile_set_wait ( proftime_T  wait)

profile_set_wait - set the current waittime

proftime_T profile_setlimit ( int64_t  msec)

profile_setlimit - return the time msec into the future

Parameters
msecmilliseconds, the maximum number of milliseconds is (2^63 / 10^6) - 1 = 9.223372e+12.
Returns
if msec > 0, returns the time msec past now. Otherwise returns the zero time.
proftime_T profile_start ( void  )

profile_start - return the current time

Returns
the current time
proftime_T profile_sub ( proftime_T  tm1,
proftime_T  tm2 
)

profile_sub - subtract tm2 from tm1

Returns
tm1 - tm2
proftime_T profile_sub_wait ( proftime_T  tm,
proftime_T  tma 
)

profile_sub_wait - subtract the passed waittime since tm

Returns
tma - (waittime - tm)
proftime_T profile_zero ( void  )

profile_zero - obtain the zero time

Returns
the zero time
void time_msg ( const char *  mesg,
const proftime_T start 
)

time_msg - print out timing info

Warning
don't forget to call time_start() once before calling this.
Parameters
mesgthe message to display next to the timing information
startonly for do_source: start time
void time_pop ( proftime_T  tp)

time_pop - compute the prev time after doing something that could nest

Subtracts tp from the static global g_prev_time.

Parameters
tpthe time to subtract
void time_push ( proftime_T rel,
proftime_T start 
)

time_push - save the previous time before doing something that could nest

After calling this function, the static global g_prev_time will contain the current time.

Parameters
[out]relto the time elapsed so far
[out]startthe current time
void time_start ( const char *  message)

time_start - initialize the startuptime code

Needs to be called once before calling other startuptime code (such as time_{push,pop,msg,...}).

Parameters
messagethe message that will be displayed