Commit fbfd9a49 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[2785] Modified logic in StatsMgr::ExchangeStats to calculate

packet sent and received times as time elapsed since perfdhcp
start up time (StatsMgr::boot_time_).
parent 459cdc4a
...@@ -262,7 +262,8 @@ public: ...@@ -262,7 +262,8 @@ public:
/// In this mode all packets are stored throughout the test execution. /// In this mode all packets are stored throughout the test execution.
ExchangeStats(const ExchangeType xchg_type, ExchangeStats(const ExchangeType xchg_type,
const double drop_time, const double drop_time,
const bool archive_enabled) const bool archive_enabled,
const boost::posix_time::ptime boot_time)
: xchg_type_(xchg_type), : xchg_type_(xchg_type),
sent_packets_(), sent_packets_(),
rcvd_packets_(), rcvd_packets_(),
...@@ -279,7 +280,8 @@ public: ...@@ -279,7 +280,8 @@ public:
unordered_lookups_(0), unordered_lookups_(0),
ordered_lookups_(0), ordered_lookups_(0),
sent_packets_num_(0), sent_packets_num_(0),
rcvd_packets_num_(0) rcvd_packets_num_(0),
boot_time_(boot_time)
{ {
next_sent_ = sent_packets_.begin(); next_sent_ = sent_packets_.begin();
} }
...@@ -699,9 +701,8 @@ public: ...@@ -699,9 +701,8 @@ public:
"packet time is not set"); "packet time is not set");
} }
// Calculate durations of packets from beginning of epoch. // Calculate durations of packets from beginning of epoch.
ptime epoch_time(min_date_time); time_period sent_period(boot_time_, sent_time);
time_period sent_period(epoch_time, sent_time); time_period rcvd_period(boot_time_, rcvd_time);
time_period rcvd_period(epoch_time, rcvd_time);
// Print timestamps for sent and received packet. // Print timestamps for sent and received packet.
std::cout << "sent / received: " std::cout << "sent / received: "
<< to_iso_string(sent_period.length()) << to_iso_string(sent_period.length())
...@@ -803,6 +804,7 @@ public: ...@@ -803,6 +804,7 @@ public:
uint64_t sent_packets_num_; ///< Total number of sent packets. uint64_t sent_packets_num_; ///< Total number of sent packets.
uint64_t rcvd_packets_num_; ///< Total number of received packets. uint64_t rcvd_packets_num_; ///< Total number of received packets.
boost::posix_time::ptime boot_time_; ///< Time when test is started.
}; };
/// Pointer to ExchangeStats. /// Pointer to ExchangeStats.
...@@ -853,7 +855,8 @@ public: ...@@ -853,7 +855,8 @@ public:
exchanges_[xchg_type] = exchanges_[xchg_type] =
ExchangeStatsPtr(new ExchangeStats(xchg_type, ExchangeStatsPtr(new ExchangeStats(xchg_type,
drop_time, drop_time,
archive_enabled_)); archive_enabled_,
boot_time_));
} }
/// \brief Add named custom uint64 counter. /// \brief Add named custom uint64 counter.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment