printing time

Adam Leventhal ahl at delphix.com
Thu Aug 28 15:24:52 UTC 2014


Hi Stuart

Is walltimestamp always 0? Could you use timestamp as an alternative (you could do some math to convert it to wall time).

Adam

--
Adam Leventhal
CTO, Delphix
Sent from my mobile

On Aug 28, 2014, at 7:52 AM, "Kendrick, Stuart" <Stuart.Kendrick at emc.com> wrote:

> How else might I print a timestamp, other than using ‘printf … walltimestamp’?
> 
> I’m running dtrace on a platform (modified version of FreeBSD 7) where ‘printf %Y’ only ever returns the one timestamp:  1969 Dec 31 18:00:00
> 
> So I’m casting around for another approach:  suggestions?
> 
> My script ‘watch-file.d’:
> 
> 
> # pragma D option quiet
> 
> 
> BEGIN
> 
> {
> 
> printf("\n   Timestamp           gid   uid   pid  ppid execname   function\n\n");
> 
> }
> 
> 
> syscall::open*:entry, syscall::unlink:entry, syscall::rename:entry
> 
> /strstr(stringof(copyinstr(arg0)), $1) != NULL/
> 
> {
> 
>       printf("%Y %5d %5d %5d %5d %-12s %-10s %s\n",
> 
>            walltimestamp, gid, uid, pid, ppid, execname, probefunc, stringof(copyinstr(arg0)));
> 
> }
> 
> Typically run as follows:
> ./watch-file.d ‘“/etc/foo”’ | tee /var/tmp/foo.log
> where /etc/foo is the file I want to watch — i.e. something is updating this file at awkward moments, and I want to identify what process does this.
> 
> 
> 
> [...]
> 
> 1969 Dec 31 18:00:00    0       0  2739 1 isi_rpc_d     open    /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  2739 1 isi_rpc_d     open    /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  2739 1 isi_rpc_d     open    /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3131 1 isi_celog_monitor open        /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3131 1 isi_celog_monitor open        /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3131 1 isi_celog_monitor open        /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3099 1 isi_celog_coalescer open      /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3099 1 isi_celog_coalescer open      /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3099 1 isi_celog_coalescer open      /etc/ifs/local.xml
> 1969 Dec 31 18:00:00    0       0  3099 1 isi_celog_coalescer open      /etc/ifs/local.xml
> ~
> 
> 
> —sk
> 
> Stuart Kendrick
> EMC Isilon
> _______________________________________________
> freebsd-dtrace at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
> To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe at freebsd.org"


More information about the freebsd-dtrace mailing list