Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: net/quic/quic_headers_stream.cc

Issue 1989003002: QUIC - add instrumentation to HPACK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase-update Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_headers_stream.h ('k') | net/quic/quic_headers_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_headers_stream.cc
diff --git a/net/quic/quic_headers_stream.cc b/net/quic/quic_headers_stream.cc
index 0e2da5e00115dd891147f799f936b97b6961e3ee..967c035911d6b4f1487d5d0d49f05d292f45396a 100644
--- a/net/quic/quic_headers_stream.cc
+++ b/net/quic/quic_headers_stream.cc
@@ -21,6 +21,44 @@ using std::string;
namespace net {
+namespace {
+
+class HeaderTableDebugVisitor : public HpackHeaderTable::DebugVisitorInterface {
+ public:
+ HeaderTableDebugVisitor(
+ const QuicClock* clock,
+ std::unique_ptr<QuicHeadersStream::HpackDebugVisitor> visitor)
+ : clock_(clock), headers_stream_hpack_visitor_(std::move(visitor)) {}
+
+ int64_t OnNewEntry(const HpackEntry& entry) override {
+ DVLOG(1) << entry.GetDebugString();
+ return clock_->ApproximateNow().Subtract(QuicTime::Zero()).ToMicroseconds();
+ }
+
+ void OnUseEntry(const HpackEntry& entry) override {
+ const QuicTime::Delta elapsed(
+ clock_->ApproximateNow()
+ .Subtract(QuicTime::Delta::FromMicroseconds(entry.time_added()))
+ .Subtract(QuicTime::Zero()));
+ DVLOG(1) << entry.GetDebugString() << " " << elapsed.ToMilliseconds()
+ << " ms";
+ headers_stream_hpack_visitor_->OnUseEntry(elapsed);
+ }
+
+ private:
+ const QuicClock* clock_;
+ std::unique_ptr<QuicHeadersStream::HpackDebugVisitor>
+ headers_stream_hpack_visitor_;
+
+ DISALLOW_COPY_AND_ASSIGN(HeaderTableDebugVisitor);
+};
+
+} // namespace
+
+QuicHeadersStream::HpackDebugVisitor::HpackDebugVisitor() {}
+
+QuicHeadersStream::HpackDebugVisitor::~HpackDebugVisitor() {}
+
// A SpdyFramer visitor which passed SYN_STREAM and SYN_REPLY frames to
// the QuicSpdyStream, and closes the connection if any unexpected frames
// are received.
@@ -417,4 +455,18 @@ void QuicHeadersStream::DisableHpackDynamicTable() {
spdy_framer_.UpdateHeaderEncoderTableSize(0);
}
+void QuicHeadersStream::SetHpackEncoderDebugVisitor(
+ std::unique_ptr<HpackDebugVisitor> visitor) {
+ spdy_framer_.SetEncoderHeaderTableDebugVisitor(
+ std::unique_ptr<HeaderTableDebugVisitor>(new HeaderTableDebugVisitor(
+ session()->connection()->helper()->GetClock(), std::move(visitor))));
+}
+
+void QuicHeadersStream::SetHpackDecoderDebugVisitor(
+ std::unique_ptr<HpackDebugVisitor> visitor) {
+ spdy_framer_.SetDecoderHeaderTableDebugVisitor(
+ std::unique_ptr<HeaderTableDebugVisitor>(new HeaderTableDebugVisitor(
+ session()->connection()->helper()->GetClock(), std::move(visitor))));
+}
+
} // namespace net
« no previous file with comments | « net/quic/quic_headers_stream.h ('k') | net/quic/quic_headers_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698