Unverified Commit 189ea690 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #529 from zyearn/h2unsent_throughput

add H2UnsentReq profiler
parents 50958b80 5947fed8
......@@ -276,6 +276,14 @@ output/bin:protoc-gen-mcpack
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%http2_rpc_protocol.dbg.o:%http2_rpc_protocol.cpp
@echo "Compiling $@ with O2"
@$(CXX) -c $(HDRPATHS) -O2 $(DEBUG_CXXFLAGS) $< -o $@
%hpack.dbg.o:%hpack.cpp
@echo "Compiling $@ with O2"
@$(CXX) -c $(HDRPATHS) -O2 $(DEBUG_CXXFLAGS) $< -o $@
%.dbg.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(DEBUG_CXXFLAGS) $< -o $@
......
......@@ -9,6 +9,7 @@
#include "butil/atomicops.h"
#include "brpc/policy/http_rpc_protocol.h"
#include "brpc/policy/http2_rpc_protocol.h"
#include "butil/gperftools_profiler.h"
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
......@@ -44,11 +45,13 @@ TEST(H2UnsentMessage, request_throughput) {
req_msgs[i] = brpc::policy::H2UnsentRequest::New(&cntl);
}
butil::IOBuf dummy_buf;
ProfilerStart("h2_unsent_req.prof");
int64_t start_us = butil::gettimeofday_us();
for (int i = 0; i < ntotal; ++i) {
req_msgs[i]->AppendAndDestroySelf(&dummy_buf, h2_client_sock.get());
}
int64_t end_us = butil::gettimeofday_us();
ProfilerStop();
int64_t elapsed = end_us - start_us;
LOG(INFO) << "H2UnsentRequest average qps="
<< (ntotal * 1000000L) / elapsed << "/s, data throughput="
......
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