riptable.rt_timers
Functions
Returns: a long integer in unix epoch nanoseconds |
|
|
Returns: a long integer from the CPUs's current time stamp counter |
|
Call tic() followed by code followed by toc() to time a routine in nanoseconds. |
|
Call ticf() followed by code followed by tocf() to time fastarrays |
|
Call ticp() followed by code followed by tocp() to profile function calls |
|
Call ticx() followed by code followed by tocx() to time a routine in TSC |
|
Call tic() followed by code followed by toc() to time a routine in nanoseconds. |
|
Call ticf() followed by code followed by tocf() to time fastarrays |
|
Call ticp() followed by code followed by tocp() to profile anything between the ticp/tocp |
|
Call ticx() followed by code followed by tocx() to time a routine in TSC |
|
tictoc time an expression in nanoseconds. use ; to separate lines |
|
tictoc time an expression in TSC (time stamp counters). use ; to separate lines |
|
Call |
- riptable.rt_timers.GetNanoTime()
Returns: a long integer in unix epoch nanoseconds Note: this function is written as fast as possible for both Windows and Linux
- riptable.rt_timers.GetTSC()
Returns: a long integer from the CPUs’s current time stamp counter
time stamp counter (TSC) are based on the CPUs’s clock cycle, which is often above 1GHz thus GetTSC return values are guaranteed to be both unique and subsample below 1 nanosecond
Note: this function is written as fast as possible for both Windows and Linux
- riptable.rt_timers.tic()
Call tic() followed by code followed by toc() to time a routine in nanoseconds.
- riptable.rt_timers.ticf()
Call ticf() followed by code followed by tocf() to time fastarrays
See also: toc, ticx, ticp, ticf
- riptable.rt_timers.ticp()
Call ticp() followed by code followed by tocp() to profile function calls
See also: toc, ticx, ticp, ticf
- riptable.rt_timers.ticx()
Call ticx() followed by code followed by tocx() to time a routine in TSC
See also: toc, ticx, ticp, ticf
- riptable.rt_timers.toc(logger=None)
Call tic() followed by code followed by toc() to time a routine in nanoseconds.
- Parameters:
logger (logging.Logger, optional) – An optionally-specified logger where the collected timing information is recorded. If not specified (the default), the timing information is written to stdout.
- riptable.rt_timers.tocf(dataset=True)
Call ticf() followed by code followed by tocf() to time fastarrays
- Parameters:
dataset (bool, defaults to True.) – If specified, returns a Dataset. Set to False to print out instead.
- riptable.rt_timers.tocp(dataset=True, logfile=None, sort='time', strip=True, stats=False, calls=False, find=None)
Call ticp() followed by code followed by tocp() to profile anything between the ticp/tocp tocp() may be called again to retrieve data in a different manner
Examples
ticp(); ds.sort_copy(by=’Symbol’); tocp()._H ticp(); ds.sort_copy(by=’Symbol’); tocp().sort_view(‘cumtime’)._A ticp(); ds.sort_copy(by=’Symbol’); tocp(find=’rt_fastarray.py:332’)._H ticp(); ds.sort_copy(by=’Symbol’); tocp(find=’rt_fastarray.py’)._H ticp(); ds.sort_copy(by=’Symbol’); ds=tocp(calls=True); ds.gb(‘filepath’).sum()._H tocp(calls=True).gb([‘function’,’filepath’])[‘tottime’].sum().sort_view(‘tottime’)._A ticp(); ds.sort_copy(by=’Symbol’); stats=tocp(stats=True); ticp(); ds.sort_copy(by=’Symbol’); tocp(False); ticp(); ds.sort_copy(by=’Symbol’); tocp(False, strip=False); ticp(); ds.sort_copy(by=’Symbol’); tocp(False, sort=’cumtime’);
- Parameters:
output (dataset=False. set to True to return a Dataset otherwise use pstats) –
format (logfile=None. set to filename to save the Dataset in SDS) – NOTE: consider pickling the result when stats=True to save for later analysis
dataset=False (sort='time' by default when) –
info (calls=False. set to True to include 'callee' and 'filepath' to determine caller) –
'filename (find=None. set to a string with) –
dataset=False – “calls” –> “call count” “ncalls” –> “call count” “cumtime” –> “cumulative time” “cumulative”–> “cumulative time” “file” –> “file name” “filename” –> “file name” “line” –> “line number” “module” –> “file name” “name” –> “function name” “nfl” –> “name/file/line” “pcalls” –> “primitive call count” “stdname” –> “standard name” “time” –> “internal time” “tottime” –> “internal time”
include (other options) – “calls” –> “call count” “ncalls” –> “call count” “cumtime” –> “cumulative time” “cumulative”–> “cumulative time” “file” –> “file name” “filename” –> “file name” “line” –> “line number” “module” –> “file name” “name” –> “function name” “nfl” –> “name/file/line” “pcalls” –> “primitive call count” “stdname” –> “standard name” “time” –> “internal time” “tottime” –> “internal time”
_lsprof.c (stats=False. set to True to return all stats collected by) –
return all information collected by the profiler. Each profiler_entry is a tuple-like object with the following attributes:
code code object callcount how many times this was called reccallcount how many times called recursively totaltime total time in this entry inlinetime inline time in this entry (not in subcalls) calls details of the calls
The calls attribute is either None or a list of profiler_subentry objects:
code called code object callcount how many times this is called reccallcount how many times this is called recursively totaltime total time spent in this call inlinetime inline time (not in further subcalls)
- riptable.rt_timers.tocx(logger=None)
Call ticx() followed by code followed by tocx() to time a routine in TSC
- Parameters:
logger (logging.Logger, optional) – An optionally-specified logger where the collected timing information is recorded. If not specified (the default), the timing information is written to stdout.
also (See) –
- riptable.rt_timers.tt(expression, loops=1, return_time=False)
tictoc time an expression in nanoseconds. use ; to separate lines
- Parameters:
execute (arg2 is optional and is how many loops to) –
execute –
- riptable.rt_timers.ttx(expression, loops=1)
tictoc time an expression in TSC (time stamp counters). use ; to separate lines
- Parameters:
execute (arg2 is optional and is how many loops to) –
execute –
- riptable.rt_timers.utcnow(count=1)
Call
GetNanoTime
one or more times and return the timestamps in aDateTimeNano
array.- Parameters:
count (int, default to 1) – The number of timestamp samples to collect.
- Returns:
A DateTimeNano array containing the sampled timestamps (representing the current time in UTC nanoseconds).
- Return type:
Examples
>>> import riptable as rt >>> rt.utcnow() DateTimeNano([20190215 11:29:44.022382600]) >>> rt.utcnow()._fa FastArray([1550248297734812800], dtype=int64)
To make an array containing multiple timestamps:
>>> len(rt.utcnow(1_000_000)) 1000000
See also