Hi, I''m forwarding the output from Dtrace into a file, and my Dtrace program always run in the background, and I never want it to stop, so it''s keeping appending new line into the file. However, I want to process that file at some point, maybe like everything 60 seconds, I can''t do it this way because I only have one file, when I process that file, information will keep coming to the file, and cause many problem? I was thinking it''s there something like a file swap function like that when I process a file, Dtrace will redirect to output to a different file. Thanks in advance for any input. This message posted from opensolaris.org
jack wrote:> Hi, > > I''m forwarding the output from Dtrace into a file, and my Dtrace program always run in the background, and I never want it to stop, so it''s keeping appending new line into the file. > > However, I want to process that file at some point, maybe like everything 60 seconds, I can''t do it this way because I only have one file, when I process that file, information will keep coming to the file, and cause many problem? > > I was thinking it''s there something like a file swap function like that when I process a file, Dtrace will redirect to output to a different file. > > Thanks in advance for any input.make your script put a sequence number on the lines. Then keep track in your processing program of the last sequence number you processed.
On Mon 19 Mar 2007 at 07:55PM, jack wrote:> Hi, > > I''m forwarding the output from Dtrace into a file, and my Dtrace > program always run in the background, and I never want it to stop, so > it''s keeping appending new line into the file. > > However, I want to process that file at some point, maybe like > everything 60 seconds, I can''t do it this way because I only have one > file, when I process that file, information will keep coming to the > file, and cause many problem? > > I was thinking it''s there something like a file swap function like > that when I process a file, Dtrace will redirect to output to a > different file.Hi Jack, I think you want freopen(), perhaps combined with a 60s tick probe. Also perhaps ftruncate(). See this thread: http://www.opensolaris.org/jive/thread.jspa?threadID=25596&tstart=0 And this thread: http://opensolaris.org/jive/thread.jspa?messageID=92844𖪬 I think you could fire the freopen from a tick probe, like: dtrace -n profile:::tick-5s (or 60s in your example) Hope that helps... -dp -- Daniel Price - Solaris Kernel Engineering - dp at eng.sun.com - blogs.sun.com/dp
jack wrote:> Hi, > > I''m forwarding the output from Dtrace into a file, and my Dtrace program always run in the background, and I never want it to stop, so it''s keeping appending new line into the file. > > However, I want to process that file at some point, maybe like everything 60 seconds, I can''t do it this way because I only have one file, when I process that file, information will keep coming to the file, and cause many problem? > > I was thinking it''s there something like a file swap function like that when I process a file, Dtrace will redirect to output to a different file. > > Thanks in advance for any input. > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.orgDoes freopen() do what you need? http://www.opensolaris.org/jive/thread.jspa?threadID=23848&tstart=30 -- Bart Smaalders Solaris Kernel Performance barts at cyber.eng.sun.com http://blogs.sun.com/barts
On Monday 19 March 2007 08:03 pm, Dan Price wrote:> dtrace -n profile:::tick-5s (or 60s in your example)That''s very cool. That second link was much more helpful, but had some odd character in the link you posted. Here''s a clean link. http://opensolaris.org/jive/thread.jspa?messageID=99928𘙘 -- Alan DuBoff - Solaris x86 Engineering - IHV/OEM Group Advocate of insourcing at Sun - hire people that care about our company!