changeset ce12f1cf978c in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=ce12f1cf978c
description:
        Make etherdump timestamps zero-based.
        We previously used the actual wall time for the base timestamps,
        making etherdumps non-deterministic.  This fixes that problem and
        gets rid of the "malformed packet" at the front that we needed to
        provide the right base timestamp to wireshark/tcpdump.

diffstat:

2 files changed, 2 insertions(+), 17 deletions(-)
src/dev/etherdump.cc |   17 ++---------------
src/dev/etherdump.hh |    2 --

diffs (57 lines):

diff -r 9fe574944f31 -r ce12f1cf978c src/dev/etherdump.cc
--- a/src/dev/etherdump.cc      Mon Feb 16 17:47:39 2009 -0500
+++ b/src/dev/etherdump.cc      Tue Feb 17 19:24:46 2009 -0800
@@ -75,31 +75,18 @@
 void
 EtherDump::init()
 {
-    curtime = time(NULL);
     struct pcap_file_header hdr;
     hdr.magic = TCPDUMP_MAGIC;
     hdr.version_major = PCAP_VERSION_MAJOR;
     hdr.version_minor = PCAP_VERSION_MINOR;
 
-    hdr.thiszone = -5 * 3600;
+    hdr.thiszone = 0;
     hdr.snaplen = 1500;
     hdr.sigfigs = 0;
     hdr.linktype = DLT_EN10MB;
 
     stream->write(reinterpret_cast<char *>(&hdr), sizeof(hdr));
 
-    /*
-     * output an empty packet with the current time so that we know
-     * when the simulation began.  This allows us to correlate packets
-     * to sim_cycles.
-     */
-    pcap_pkthdr pkthdr;
-    pkthdr.seconds = curtime;
-    pkthdr.microseconds = 0;
-    pkthdr.caplen = 0;
-    pkthdr.len = 0;
-    stream->write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr));
-
     stream->flush();
 }
 
@@ -107,7 +94,7 @@
 EtherDump::dumpPacket(EthPacketPtr &packet)
 {
     pcap_pkthdr pkthdr;
-    pkthdr.seconds = curtime + (curTick / Clock::Int::s);
+    pkthdr.seconds = curTick / Clock::Int::s;
     pkthdr.microseconds = (curTick / Clock::Int::us) % ULL(1000000);
     pkthdr.caplen = std::min(packet->length, maxlen);
     pkthdr.len = packet->length;
diff -r 9fe574944f31 -r ce12f1cf978c src/dev/etherdump.hh
--- a/src/dev/etherdump.hh      Mon Feb 16 17:47:39 2009 -0500
+++ b/src/dev/etherdump.hh      Tue Feb 17 19:24:46 2009 -0800
@@ -51,8 +51,6 @@
     void dumpPacket(EthPacketPtr &packet);
     void init();
 
-    Tick curtime;
-
   public:
     typedef EtherDumpParams Params;
     EtherDump(const Params *p);
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to