createTimer: Create a timer object

Description Usage Arguments Value Examples

View source: R/timer_function.R

Description

Create a timer object

Usage

1
createTimer(verbose = T, precision = "s")

Arguments

verbose

A parameter to control whether to print messages while using methods. Default to TRUE.

precision

Precision for time, default to s, valid values are: s,ms and us

Value

a timer object.

Examples

1
2
3
4
5
timer1 <- createTimer() # print is enabled
timer1 <- createTimer(FALSE) # print is disabled
timer1$start("event1") # start timing for event 1
timer1$stop("event1", comment = "event 1 stopped") # stop timing for event 1(comment is optional)
getTimer(timer1) # get all records in a data frame

Example output

sh: 1: timedatectl: Permission denied
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 126
2: In file(con, "r") : cannot open file '/etc/timezone': Permission denied
   event               start                 end timeElapsed         comment
1 event1 2021-01-18 06:54:03 2021-01-18 06:54:03           0 event 1 stopped

timeR documentation built on July 1, 2020, 5:39 p.m.