From owner-freebsd-dtrace@FreeBSD.ORG Thu Aug 28 15:17:59 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A496872B for ; Thu, 28 Aug 2014 15:17:59 +0000 (UTC) Received: from mailuogwhop.emc.com (mailuogwhop.emc.com [168.159.213.141]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mailuogwprd01.lss.emc.com", Issuer "RSA Corporate Server CA v2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5585B1443 for ; Thu, 28 Aug 2014 15:17:58 +0000 (UTC) Received: from maildlpprd06.lss.emc.com (maildlpprd06.lss.emc.com [10.253.24.38]) by mailuogwprd03.lss.emc.com (Sentrion-MTA-4.3.0/Sentrion-MTA-4.3.0) with ESMTP id s7SEpT6f022963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Aug 2014 10:51:30 -0400 X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd03.lss.emc.com s7SEpT6f022963 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=emc.com; s=jan2013; t=1409237490; bh=GhbnDDR2D/txf4uZitTVJSuHQtk=; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; b=ercyiEIZOoQxcHwHwYDZDf/RKdJSZS1uxhmWB+gz5Zhi2RpXPkSPFp5pty1JO9MEF hOj7aiGECoXEAf0C4OSxWxKP/ObvqcuhGR9GyjJ772Jp4sVGLabgLQYXx6j43/j2gj c4fBznlsMc6U6LyCoE2Ud0WpMtw/uTqXdAvcKaPo= X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd03.lss.emc.com s7SEpT6f022963 Received: from mailusrhubprd52.lss.emc.com (mailusrhubprd52.lss.emc.com [10.106.48.25]) by maildlpprd06.lss.emc.com (RSA Interceptor) for ; Thu, 28 Aug 2014 10:50:58 -0400 Received: from mxhub35.corp.emc.com (mxhub35.corp.emc.com [10.254.93.83]) by mailusrhubprd52.lss.emc.com (Sentrion-MTA-4.3.0/Sentrion-MTA-4.3.0) with ESMTP id s7SEp0kM031889 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Thu, 28 Aug 2014 10:51:11 -0400 Received: from mx30a.corp.emc.com ([169.254.1.101]) by mxhub35.corp.emc.com ([::1]) with mapi; Thu, 28 Aug 2014 10:51:08 -0400 From: "Kendrick, Stuart" To: "freebsd-dtrace@freebsd.org" Date: Thu, 28 Aug 2014 10:52:54 -0400 Subject: printing time Thread-Topic: printing time Thread-Index: Ac/Cz3/7GHTm1IdHSButHaRdm4GXGw== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.3.140616 acceptlanguage: en-US MIME-Version: 1.0 X-Sentrion-Hostname: mailusrhubprd52.lss.emc.com X-RSA-Classifications: public Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2014 15:17:59 -0000 How else might I print a timestamp, other than using =91printf =85 walltime= stamp=92? I=92m running dtrace on a platform (modified version of FreeBSD 7) where = =91printf %Y=92 only ever returns the one timestamp: 1969 Dec 31 18:00:00 So I=92m casting around for another approach: suggestions? My script =91watch-file.d=92: # 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) !=3D NULL/ { printf("%Y %5d %5d %5d %5d %-12s %-10s %s\n", walltimestamp, gid, uid, pid, ppid, execname, probefunc, string= of(copyinstr(arg0))); } Typically run as follows: ./watch-file.d =91=93/etc/foo=94=92 | tee /var/tmp/foo.log where /etc/foo is the file I want to watch =97 i.e. something is updating t= his 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/lo= cal.xml 1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/lo= cal.xml 1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/lo= cal.xml 1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /et= c/ifs/local.xml 1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /et= c/ifs/local.xml 1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /et= c/ifs/local.xml 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /et= c/ifs/local.xml 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /et= c/ifs/local.xml 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /et= c/ifs/local.xml 1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /et= c/ifs/local.xml ~ =97sk Stuart Kendrick EMC Isilon