In DTrace, why does timestamp increase after a call to chill() but vtimestamp and walltimestamp do not?
Date: Mon, 21 Nov 2022 17:19:16 UTC
Hello all,
I'd like to understand why calling chill() in a DTrace action block increases the timestampvariable, but not vtimestamp and walltimestamp.
Here's an example showing timestamp increasing after a call to chill():
# dtrace -w -c true -n 'pid$target:::entry {self->t = $1; chill(1); printf("%d\n", $1 - self->t);}' timestamp
dtrace: description 'pid$target:::entry ' matched 3082 probes
dtrace: allowing destructive actions
dtrace: pid 6734 has exited
CPU ID FUNCTION:NAME
5 83475 _r_debug_postinit:entry 11258
5 85771 atexit:entry 2218
5 86468 __libc_atexit:entry 491
5 86428 exit:entry 441
5 85397 __cxa_thread_call_dtors:entry 441
5 86213 __cxa_finalize:entry 447
5 86213 __cxa_finalize:entry 565
5 83470 _rtld_addr_phdr:entry 454
5 86213 __cxa_finalize:entry 431
5 83470 _rtld_addr_phdr:entry 1645
5 84405 _exit:entry 432
If we run the same script but use walltimestamp (or vtimestamp), we'll see the counter did not increase:
# dtrace -w -c true -n 'pid$target:::entry {self->t = $1; chill(1); printf("%d\n", $1 - self->t);}' walltimestamp
dtrace: description 'pid$target:::entry ' matched 3082 probes
dtrace: allowing destructive actions
dtrace: pid 6707 has exited
CPU ID FUNCTION:NAME
4 83475 _r_debug_postinit:entry 0
4 85771 atexit:entry 0
4 86468 __libc_atexit:entry 0
4 86428 exit:entry 0
4 85397 __cxa_thread_call_dtors:entry 0
4 86213 __cxa_finalize:entry 0
4 86213 __cxa_finalize:entry 0
4 83470 _rtld_addr_phdr:entry 0
4 86213 __cxa_finalize:entry 0
4 83470 _rtld_addr_phdr:entry 0
4 84405 _exit:entry 0
This is understandable for vtimestamp, as it does not increase when executing DTrace code, but I don't understand walltimestamp's behavior here.
I'm running FreeBSD 13.1-RELEASE-p1 here on amd64.
Best,
Mateusz