On Thu, July 5, 2012 11:06 am, Pritha Ghoshal wrote: > Hi, > > I am trying to generate a packet trace file from within GEM5. Every time a > packet is transmitted, I am writing the information into a file and also > printing to the screen. I used printf and fprintf for these as I wanted to > use gem5.fast which does not support DPRINTF. But I face some issues with > this. > > The printf shows the last 10 lines as: > > tail /tmp/pritha/firewall_equ2_co_1000_20_150000 > 138755 > 138762 > 138852 > 138853 > 138854 > 138855 > 138856 > 138857 > 138859 > 138 > > The last line is not complete.. The fprintf shows: > > tail /tmp/pritha/firewall_co_1000_op_20_150000 > 0 9680731166 1 2 147945 52 > 0 9681118640 1 2 148034 67 > 0 9681541226 1 2 148036 52 > 0 9681970586 1 2 148037 52 > 0 9682164968 1 2 148038 1500 > 0 9682465576 1 2 148039 52 > 0 9683138086 1 2 148043 52 > 0 9683565390 1 2 148045 52 > 0 9683988566 1 2 148047 52 > 0 9684415204 1 2 148048 > > Again the last line is not complete, but the fifth column number should > match the printf number.. The fprintf has a much higher number than the > one > shown in printf. How should I fix this? I have the printf line in the same > place as I had the DPRINTF and the DPRINTF used to work properly. >
I am not convinced that your observation implies that printf/fprintf are working incorrectly. I am kind of sure that you are overlooking some thing. Remember that stdout is a buffered stream, so things written to stdout do not appear immediately. printf uses stdout, but with fprintf, you can specify stderr (which is not buffered) so that output appears immediately. -- Nilay _______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
