Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
093dcb3e
Commit
093dcb3e
authored
Oct 25, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reuse _begin_time_us and _end_time_us in server controller to indicate queue time
parent
68079fd9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
17 additions
and
15 deletions
+17
-15
controller.cpp
src/brpc/controller.cpp
+0
-1
controller.h
src/brpc/controller.h
+3
-7
baidu_rpc_protocol.cpp
src/brpc/policy/baidu_rpc_protocol.cpp
+2
-1
http_rpc_protocol.cpp
src/brpc/policy/http_rpc_protocol.cpp
+2
-1
hulu_pbrpc_protocol.cpp
src/brpc/policy/hulu_pbrpc_protocol.cpp
+2
-1
mongo_protocol.cpp
src/brpc/policy/mongo_protocol.cpp
+2
-1
nshead_protocol.cpp
src/brpc/policy/nshead_protocol.cpp
+2
-1
sofa_pbrpc_protocol.cpp
src/brpc/policy/sofa_pbrpc_protocol.cpp
+2
-1
thrift_protocol.cpp
src/brpc/policy/thrift_protocol.cpp
+2
-1
No files found.
src/brpc/controller.cpp
View file @
093dcb3e
...
...
@@ -252,7 +252,6 @@ void Controller::ResetPods() {
_request_stream
=
INVALID_STREAM_ID
;
_response_stream
=
INVALID_STREAM_ID
;
_remote_stream_settings
=
NULL
;
_received_us
=
0
;
}
Controller
::
Call
::
Call
(
Controller
::
Call
*
rhs
)
...
...
src/brpc/controller.h
View file @
093dcb3e
...
...
@@ -172,12 +172,11 @@ public:
// True if a backup request was sent during the RPC.
bool
has_backup_request
()
const
{
return
has_flag
(
FLAGS_BACKUP_REQUEST
);
}
// Get latency of the RPC call.
// This function has different meanings in client and server side.
// In client side it gets latency of the RPC call. While in server side,
// it gets queue time before server processes the RPC call.
int64_t
latency_us
()
const
{
return
_end_time_us
-
_begin_time_us
;
}
// Get processed time of the RPC call since received
int64_t
processed_us
()
const
{
return
butil
::
cpuwide_time_us
()
-
_received_us
;
}
// Response of the RPC call (passed to CallMethod)
google
::
protobuf
::
Message
*
response
()
const
{
return
_response
;
}
...
...
@@ -732,9 +731,6 @@ private:
// Thrift method name, only used when thrift protocol enabled
std
::
string
_thrift_method_name
;
// Received time of message
int64_t
_received_us
;
};
// Advises the RPC system that the caller desires that the RPC call be
...
...
src/brpc/policy/baidu_rpc_protocol.cpp
View file @
093dcb3e
...
...
@@ -351,7 +351,8 @@ void ProcessRpcRequest(InputMessageBase* msg_base) {
.
set_local_side
(
socket
->
local_side
())
.
set_auth_context
(
socket
->
auth_context
())
.
set_request_protocol
(
PROTOCOL_BAIDU_STD
)
.
set_received_us
(
msg_base
->
received_us
())
.
set_begin_time_us
(
msg
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
if
(
meta
.
has_stream_settings
())
{
...
...
src/brpc/policy/http_rpc_protocol.cpp
View file @
093dcb3e
...
...
@@ -1237,7 +1237,8 @@ void ProcessHttpRequest(InputMessageBase *msg) {
.
set_local_side
(
socket
->
local_side
())
.
set_auth_context
(
socket
->
auth_context
())
.
set_request_protocol
(
PROTOCOL_HTTP
)
.
set_received_us
(
msg
->
received_us
())
.
set_begin_time_us
(
msg
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
// Read log-id. errno may be set when input to strtoull overflows.
...
...
src/brpc/policy/hulu_pbrpc_protocol.cpp
View file @
093dcb3e
...
...
@@ -384,7 +384,8 @@ void ProcessHuluRequest(InputMessageBase* msg_base) {
.
set_local_side
(
socket
->
local_side
())
.
set_auth_context
(
socket
->
auth_context
())
.
set_request_protocol
(
PROTOCOL_HULU_PBRPC
)
.
set_received_us
(
msg
->
received_us
())
.
set_begin_time_us
(
msg
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
if
(
meta
.
has_user_data
())
{
...
...
src/brpc/policy/mongo_protocol.cpp
View file @
093dcb3e
...
...
@@ -206,7 +206,8 @@ void ProcessMongoRequest(InputMessageBase* msg_base) {
.
set_local_side
(
socket
->
local_side
())
.
set_auth_context
(
socket
->
auth_context
())
.
set_request_protocol
(
PROTOCOL_MONGO
)
.
set_received_us
(
msg_base
->
received_us
())
.
set_begin_time_us
(
msg
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
// Tag the bthread with this server's key for
...
...
src/brpc/policy/nshead_protocol.cpp
View file @
093dcb3e
...
...
@@ -262,7 +262,8 @@ void ProcessNsheadRequest(InputMessageBase* msg_base) {
.
set_remote_side
(
socket
->
remote_side
())
.
set_local_side
(
socket
->
local_side
())
.
set_request_protocol
(
PROTOCOL_NSHEAD
)
.
set_received_us
(
msg_base
->
received_us
())
.
set_begin_time_us
(
msg
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
// Tag the bthread with this server's key for thread_local_data().
...
...
src/brpc/policy/sofa_pbrpc_protocol.cpp
View file @
093dcb3e
...
...
@@ -352,7 +352,8 @@ void ProcessSofaRequest(InputMessageBase* msg_base) {
.
set_local_side
(
socket
->
local_side
())
.
set_auth_context
(
socket
->
auth_context
())
.
set_request_protocol
(
PROTOCOL_SOFA_PBRPC
)
.
set_received_us
(
msg_base
->
received_us
())
.
set_begin_time_us
(
msg
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
// Tag the bthread with this server's key for thread_local_data().
...
...
src/brpc/policy/thrift_protocol.cpp
View file @
093dcb3e
...
...
@@ -465,7 +465,8 @@ void ProcessThriftRequest(InputMessageBase* msg_base) {
.
set_remote_side
(
socket
->
remote_side
())
.
set_local_side
(
socket
->
local_side
())
.
set_request_protocol
(
PROTOCOL_THRIFT
)
.
set_received_us
(
msg_base
->
received_us
())
.
set_begin_time_us
(
msg_base
->
received_us
())
.
set_end_time_us
(
butil
::
cpuwide_time_us
())
.
move_in_server_receiving_sock
(
socket_guard
);
uint32_t
seq_id
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment