summaryrefslogtreecommitdiff
path: root/src/dev
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2009-02-17 19:24:46 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2009-02-17 19:24:46 -0800
commit6cfff91d43885f60cbe30a7b237c69fcc85e31a2 (patch)
treede5beb122aa7a8761f458d5f51c6e977f997740c /src/dev
parent5d029ff11e88ba0ab89c88e500c5d0d2edaf744e (diff)
downloadgem5-6cfff91d43885f60cbe30a7b237c69fcc85e31a2.tar.xz
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 (limited to 'src/dev')
-rw-r--r--src/dev/etherdump.cc17
-rw-r--r--src/dev/etherdump.hh2
2 files changed, 2 insertions, 17 deletions
diff --git a/src/dev/etherdump.cc b/src/dev/etherdump.cc
index 57da8a7f0..c41ce4e1f 100644
--- a/src/dev/etherdump.cc
+++ b/src/dev/etherdump.cc
@@ -75,31 +75,18 @@ struct pcap_pkthdr {
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 @@ void
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 --git a/src/dev/etherdump.hh b/src/dev/etherdump.hh
index 733e61c97..18a5d2c44 100644
--- a/src/dev/etherdump.hh
+++ b/src/dev/etherdump.hh
@@ -51,8 +51,6 @@ class EtherDump : public SimObject
void dumpPacket(EthPacketPtr &packet);
void init();
- Tick curtime;
-
public:
typedef EtherDumpParams Params;
EtherDump(const Params *p);