diff -r 5eeb3f6704eb -r 3171372e8b5e src/cpu/testers/traffic_gen/generators.hh --- a/src/cpu/testers/traffic_gen/generators.hh Thu Jul 18 13:43:44 2013 +0100 +++ b/src/cpu/testers/traffic_gen/generators.hh Thu Jul 18 13:44:52 2013 +0100 @@ -380,6 +380,12 @@ void reset(); /** + * Check the trace header to make sure that it is of the right + * format. + */ + void init(); + + /** * Attempt to read a trace element from the stream, * and also notify the caller if the end of the file * was reached. diff -r 5eeb3f6704eb -r 3171372e8b5e src/cpu/testers/traffic_gen/generators.cc --- a/src/cpu/testers/traffic_gen/generators.cc Thu Jul 18 13:43:44 2013 +0100 +++ b/src/cpu/testers/traffic_gen/generators.cc Thu Jul 18 13:44:52 2013 +0100 @@ -205,13 +205,19 @@ TraceGen::InputStream::InputStream(const std::string& filename) : trace(filename) { + init(); +} + +void +TraceGen::InputStream::init() +{ // Create a protobuf message for the header and read it from the stream Message::PacketHeader header_msg; if (!trace.read(header_msg)) { - panic("Failed to read packet header from %s\n", filename); + panic("Failed to read packet header from trace\n"); if (header_msg.tick_freq() != SimClock::Frequency) { - panic("Trace %s was recorded with a different tick frequency %d\n", + panic("Trace was recorded with a different tick frequency %d\n", header_msg.tick_freq()); } } @@ -221,6 +227,7 @@ TraceGen::InputStream::reset() { trace.reset(); + init(); } bool