[DTrace-devel] semantics of "timestamp"

Eugene Loh eugene.loh at oracle.com
Thu Jul 16 13:09:09 PDT 2020


On 07/16/2020 12:57 PM, Eugene Loh wrote:

> What are the semantics of the built-in variable "timestamp"?
> Specifically, does it record a fresh time stamp each time it is called?
> Or it is measured once upon probe (or clause) entry and then reused?
>
> The documentation isn't real specific, but it seems to imply a fresh
> time on each call.  Meanwhile, DTv1 seems to get a fresh call for each
> clause and then reuse that value during that clause.  In contrast, DTv2
> seems to get a fresh value with each clause.

Blech.  I meant DTv2 gets a fresh value with each call.

> Is the change from DTv1 to
> DTv2 intentional?  Should the legacy behavior be preserved?
>
> FWIW, here are some experiments:
>
>        +-------------------------------------+---------------------------+
>        |      BEGIN {trace(timestamp);       | BEGIN {trace(timestamp);} |
>        |             trace(timestamp);       | BEGIN {trace(timestamp);} |
>        |             trace(timestamp);       | BEGIN {trace(timestamp);} |
>        |             trace(timestamp);       | BEGIN {trace(timestamp);} |
>        |             trace(timestamp);       | BEGIN {trace(timestamp);} |
>        |             trace(timestamp);       | BEGIN {trace(timestamp);  |
>        |             exit(0)                 |        exit(0)            |
>        |            }                        |       }                   |
>        +-------------------------------------+---------------------------+
>        |        DTv1:            DTv2:       | DTv1:                     |
>        |  3823194824541746 1645711727876826  | 3823604430297094          |
>        |  3823194824541746 1645711727876873  | 3823604430297975          |
>        |  3823194824541746 1645711727876917  | 3823604430298302          |
>        |  3823194824541746 1645711727876950  | 3823604430298700          |
>        |  3823194824541746 1645711727876982  | 3823604430299590          |
>        |  3823194824541746 1645711727877017  | 3823604430300004          |
>        +-------------------------------------+---------------------------+




More information about the DTrace-devel mailing list