Stop the background thread that periodically writes system usage metrics of the current R process to a log file.

log_stop()

Value

NULL (invisibly). Called for its side effects.

Details

The background thread is detached, so is there no way to directly terminate it (other than terminating the main thread, i.e. restarting R). log_stop() merely signals to the thread using a static C variable protected by a mutex. It may take time for the thread to notice, depending on the value of seconds you supplied to log_start(). For this reason, you may see one or two lines in the log even after you call log_stop().

Examples

  path <- tempfile()
  log_start(seconds = 0.5, path = path)
  Sys.sleep(2)
  log_stop()
  log_read(path)
#>      version       phase  pid  name status time  core cpu resident  virtual
#> 1 0.1.2.9000 __DEFAULT__ 7616 local      0  0.0 0.000 0.0 157.8639 886.4809
#> 2 0.1.2.9000 __DEFAULT__ 7616 local      0  0.5 0.000 0.0 157.8639 886.4809
#> 3 0.1.2.9000 __DEFAULT__ 7616 local      0  1.0 1.999 0.5 157.8639 886.4809
#> 4 0.1.2.9000 __DEFAULT__ 7616 local      0  1.5 0.000 0.0 157.8639 886.4809
  unlink(path)