dtrace_probe() always has the timestamp
dtrace_probe() always calls dtrace_gethrtime() (for cpu_dtrace_nsec), so we should always save it in dtms_timestamp.
Updated by Matthew Ahrens over 6 years ago
When you use the "timestamp" variable in a dtrace program, dtrace_probe() records the timestamp (from dtrace_gethrtime()) in dtms_timestamp. All references to "timestamp" in this probe firing will see the same value of timestamp (from dtms_timestamp) (unless the dtrace program does a "chill()" action which will clear DTRACE_MSTATE_TIMESTAMP, causing a new timestamp value to be retrieved).
dtrace_probe() is fairly careful to minimize the number of times it calls dtrace_gethrtime(), presumably for performance reasons. Now that it always calls dtrace_gethrtime() (to calculate the amount of time spent in dtrace_probe()), we might as well use this value of dtrace_gethrtime() to satisfy references to the "timestamp" variable as well, by storing it in dtms_timestamp. This reduces the number of times that dtrace_probe() calls dtrace_gethrtime() from 3 to 2 (assuming that the "timestamp" variable is used but "chill()" is not used).
Updated by Electric Monk over 6 years ago
commit 82d86f4e8b1400610e24f161032c16e049f173a0 Author: Matthew Ahrens <email@example.com> Date: 2014-04-22T17:36:36.000Z 4767 dtrace_probe() always has the timestamp Reviewed by: Adam Leventhal <firstname.lastname@example.org> Reviewed by: Sebastien Roy <email@example.com> Reviewed by: Robert Mustacchi <firstname.lastname@example.org> Reviewed by: Richard Lowe <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>