Date: Thu, 28 Aug 2014 08:24:43 -0700 From: Adam Leventhal <ahl@delphix.com> To: "Kendrick, Stuart" <Stuart.Kendrick@emc.com> Cc: "freebsd-dtrace@freebsd.org" <freebsd-dtrace@freebsd.org> Subject: Re: printing time Message-ID: <CDD0540E-873F-4FB8-9EAC-3E4C4DC01DF9@delphix.com> In-Reply-To: <D0249056.15458%stuart.kendrick@emc.com> References: <D0249056.15458%stuart.kendrick@emc.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Stuart Is walltimestamp always 0? Could you use timestamp as an alternative (you co= uld 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@emc.com> wr= ote: > How else might I print a timestamp, other than using =E2=80=98printf =E2=80= =A6 walltimestamp=E2=80=99? >=20 > I=E2=80=99m running dtrace on a platform (modified version of FreeBSD 7) w= here =E2=80=98printf %Y=E2=80=99 only ever returns the one timestamp: 1969 D= ec 31 18:00:00 >=20 > So I=E2=80=99m casting around for another approach: suggestions? >=20 > My script =E2=80=98watch-file.d=E2=80=99: >=20 >=20 > # pragma D option quiet >=20 >=20 > BEGIN >=20 > { >=20 > printf("\n Timestamp gid uid pid ppid execname function= \n\n"); >=20 > } >=20 >=20 > syscall::open*:entry, syscall::unlink:entry, syscall::rename:entry >=20 > /strstr(stringof(copyinstr(arg0)), $1) !=3D NULL/ >=20 > { >=20 > printf("%Y %5d %5d %5d %5d %-12s %-10s %s\n", >=20 > walltimestamp, gid, uid, pid, ppid, execname, probefunc, string= of(copyinstr(arg0))); >=20 > } >=20 > Typically run as follows: > ./watch-file.d =E2=80=98=E2=80=9C/etc/foo=E2=80=9D=E2=80=99 | tee /var/tmp= /foo.log > where /etc/foo is the file I want to watch =E2=80=94 i.e. something is upd= ating this file at awkward moments, and I want to identify what process does= this. >=20 >=20 >=20 > [...] >=20 > 1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/l= ocal.xml > 1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/l= ocal.xml > 1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/l= ocal.xml > 1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /e= tc/ifs/local.xml > 1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /e= tc/ifs/local.xml > 1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /e= tc/ifs/local.xml > 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /e= tc/ifs/local.xml > 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /e= tc/ifs/local.xml > 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /e= tc/ifs/local.xml > 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /e= tc/ifs/local.xml > ~ >=20 >=20 > =E2=80=94sk >=20 > Stuart Kendrick > EMC Isilon > _______________________________________________ > freebsd-dtrace@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CDD0540E-873F-4FB8-9EAC-3E4C4DC01DF9>