diff options
author | Ron Dreslinski <rdreslin@umich.edu> | 2005-02-17 12:14:04 -0500 |
---|---|---|
committer | Ron Dreslinski <rdreslin@umich.edu> | 2005-02-17 12:14:04 -0500 |
commit | 45ef238e3f54bd7e2b602def187085bd0b99aab5 (patch) | |
tree | ea4057df1dac0768ebf36201468af632cdefedf1 /dev/etherdump.cc | |
parent | b8d65408c810ba490243fc32c7d5e6817c32c70b (diff) | |
parent | cfe6ed7c484b62d07bae23c528f0e2e568cf0d65 (diff) | |
download | gem5-45ef238e3f54bd7e2b602def187085bd0b99aab5.tar.xz |
Merge zizzer:/z/m5/Bitkeeper/m5
into zizzer.eecs.umich.edu:/.automount/zazzer/z/rdreslin/m5bk/timing_L1
--HG--
extra : convert_revision : 88afcacc41f5b0fae0ed1ac1821b7ca88c407e85
Diffstat (limited to 'dev/etherdump.cc')
-rw-r--r-- | dev/etherdump.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/dev/etherdump.cc b/dev/etherdump.cc index 485d5599c..3de417bdc 100644 --- a/dev/etherdump.cc +++ b/dev/etherdump.cc @@ -36,14 +36,15 @@ #include <string> #include "base/misc.hh" +#include "base/output.hh" #include "dev/etherdump.hh" #include "sim/builder.hh" #include "sim/universe.hh" using std::string; -EtherDump::EtherDump(const string &name, std::ostream *_stream, int max) - : SimObject(name), stream(_stream), maxlen(max) +EtherDump::EtherDump(const string &name, const string &file, int max) + : SimObject(name), stream(file.c_str()), maxlen(max) { } @@ -86,7 +87,7 @@ EtherDump::init() hdr.sigfigs = 0; hdr.linktype = DLT_EN10MB; - stream->write(reinterpret_cast<char *>(&hdr), sizeof(hdr)); + stream.write(reinterpret_cast<char *>(&hdr), sizeof(hdr)); /* * output an empty packet with the current time so that we know @@ -98,9 +99,9 @@ EtherDump::init() pkthdr.microseconds = 0; pkthdr.caplen = 0; pkthdr.len = 0; - stream->write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr)); + stream.write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr)); - stream->flush(); + stream.flush(); } void @@ -111,9 +112,9 @@ EtherDump::dumpPacket(PacketPtr &packet) pkthdr.microseconds = (curTick / us_freq) % ULL(1000000); pkthdr.caplen = std::min(packet->length, maxlen); pkthdr.len = packet->length; - stream->write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr)); - stream->write(reinterpret_cast<char *>(packet->data), pkthdr.caplen); - stream->flush(); + stream.write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr)); + stream.write(reinterpret_cast<char *>(packet->data), pkthdr.caplen); + stream.flush(); } BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherDump) @@ -132,7 +133,7 @@ END_INIT_SIM_OBJECT_PARAMS(EtherDump) CREATE_SIM_OBJECT(EtherDump) { - return new EtherDump(getInstanceName(), makeOutputStream(file), maxlen); + return new EtherDump(getInstanceName(), simout.resolve(file), maxlen); } REGISTER_SIM_OBJECT("EtherDump", EtherDump) |