Ian Matchett
2007-Feb-06 14:27 UTC
[dtrace-discuss] dtrace date stamps falling behind, can I do any better?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Is there a more efficient way to print date than doing this?<br>
system("date");<br>
<br>
<br>
My dtrace script is falling behind<br>
<br>
profile:::tick-1sec<br>
{<br>
system("date");<br>
printa( @Size );<br>
printa( @Io );<br>
printa( @Time );<br>
trunc( @Size );<br>
trunc( @Io );<br>
trunc( @Time );<br>
}<br>
<br>
<br>
The output should have a date stamp every second but many of the stamps
have the same time<br>
<br>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
timestamps.<br>
<br>
egrep ''^Sun'' output > dateonly<br>
uniq -c dateonly |sort -nr |head -10<br>
37 Sun Feb 4 12:04:49 2007<br>
10 Sun Feb 4 12:09:38 2007<br>
7 Sun Feb 4 12:24:10 2007<br>
6 Sun Feb 4 12:26:22 2007<br>
6 Sun Feb 4 12:26:16 2007<br>
6 Sun Feb 4 12:26:11 2007<br>
6 Sun Feb 4 12:26:05 2007<br>
6 Sun Feb 4 12:25:53 2007<br>
6 Sun Feb 4 12:25:47 2007<br>
6 Sun Feb 4 12:25:41 2007<br>
<br>
In fact 89 date stamps had the same second.<br>
Some worse than others.<br>
<br>
Is there a more efficient way to print date than doing<br>
system("date");<br>
?<br>
<br>
Part of the cause was we had the system paging very badly even swapping
<br>
dtrace system("date") did a catch up but got many common
timestamps.<br>
<br>
IanM<br>
<br>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Type" content="text/html; ">
<title>Ian Matchett</title>
<link rel="stylesheet" media="all"
type="text/css"
href="http://home.comcast.net/%7Eian-matchett/sig3.css">
<style media="all" type="text/css">
div.sig {color:#fff; background-color:#58a; width:350px; height:150px;}
div.sig a, div.sig span{height:14px;
font-size:12px;font-family:Arial,Helvetica,FreeSans,"Luxi-sans","Nimbus
Sans L",sans-serif;}
div.sig span:hover {background-color:#000;}
div.sig a {color:#fff; text-decoration:none;}
div.sig a:hover {background:#00c;text-decoration:underline;}
div.sig a:visited {color:#fff;text-decoration:underline;}
</style>
<div class="sig">
<div
style="margin-top: 3px; margin-right: 15px; float: right; text-align:
center;"><span>Ian
Matchett</span> <span>Sun Microsystems</span><br>
<span>Burlington</span> <span>MA 01803
USA</span><br>
<span>Phone x22043</span>
<span>781-442-2043</span><br>
<a href="mailto:Ian.Matchett@Sun.COM" title="Send Me
Email">Email</a><br>
<span>Mobile 413 237 6599</span><br>
<a
href="http://www.vtext.com/customer_site/jsp/messaging_lo.jsp?min=ian.matchett@vtext.com"
title="Text My Mobile">Vtext Webservice</a> <a
href="mailto:Ian.Matchett@vtext.com" title="Email My
Mobile">SMS Email</a><br>
<a
href="http://www.mapquest.com/maps/map.adp?formtype=address&cat=Hotels&zipcode=01803-2756"
title="Burlington Maps">Map and Hotels</a><br>
</div>
<a href="http://www.sun.com/" title="Sun.COM"><img
class="sun_img"
alt="Sun.COM" moz-do-not-send="true"
src="http://www.sun.com/im/a.gif"
height="121" width="136"></a>
<a href="http://www.sun.com/software/solaris/get.jsp"
title="Solaris Download"><img class="get_img"
alt="Solaris Download"
moz-do-not-send="true" src="http://www.sun.com/im/a.gif"
height="26"
width="100%"></a></div>
</div>
</body>
</html>
Michael Schuster
2007-Feb-06 14:34 UTC
[dtrace-discuss] dtrace date stamps falling behind, can I do any better?
Ian Matchett wrote:> Is there a more efficient way to print date than doing this? > system("date");have a look at the builtin variable walltimestamp. HTH -- Michael Schuster Sun Microsystems, Inc. Recursion, n.: see ''Recursion''
Michael Schuster
2007-Feb-06 14:38 UTC
[dtrace-discuss] dtrace date stamps falling behind, can I do any better?
> Ian Matchett wrote: >> Is there a more efficient way to print date than doing this? >> system("date"); > > have a look at the builtin variable walltimestamp.... und use "%Y" in printf :-) HTH -- Michael Schuster Sun Microsystems, Inc. Recursion, n.: see ''Recursion''
Chip Bennett
2007-Feb-06 14:53 UTC
[dtrace-discuss] dtrace date stamps falling behind, can I do any better?
Ian,
There are two parts to D processing: the kernel DIF program (D internal
format) which is the compiled D program, and the DTrace command reading
of trace data from the buffer, which then displays it.
The DIF programs run in the kernel, with interrupts turned off. This is
the execution of the probe clause when the probe fires. It can''t do
anything that''s going to generate an interrupt, like run another
command. It just does the calculations and put the raw trace data into
a buffer.
The DTrace command reads the trace data from the buffer, including the
instruction to execute a "system" function, which then happens in the
context of the DTrace command. So there is a delay from the time the
probe fires, until the instruction to run the command gets through the
buffer.
If you want the date at the moment the probe fires, it has be generated
as trace data using printf, which I think Micheal has already told you
while I was typing this. :-) But just to round it out, printf
("%Y",
walltimestamp);
Chip
Ian Matchett wrote:> Is there a more efficient way to print date than doing this?
> system("date");