Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
0d8c8ca0
Commit
0d8c8ca0
authored
Sep 12, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h2load: Record TTFB on first byte of response body, rather than first socket read
parent
5ea90ba6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
13 deletions
+18
-13
src/h2load.cc
src/h2load.cc
+7
-12
src/h2load.h
src/h2load.h
+1
-1
src/h2load_http2_session.cc
src/h2load_http2_session.cc
+4
-0
src/h2load_spdy_session.cc
src/h2load_spdy_session.cc
+6
-0
No files found.
src/h2load.cc
View file @
0d8c8ca0
...
@@ -659,11 +659,6 @@ int Client::read_clear() {
...
@@ -659,11 +659,6 @@ int Client::read_clear() {
if
(
on_read
(
buf
,
nread
)
!=
0
)
{
if
(
on_read
(
buf
,
nread
)
!=
0
)
{
return
-
1
;
return
-
1
;
}
}
if
(
!
first_byte_received
)
{
first_byte_received
=
true
;
record_ttfb
(
&
worker
->
stats
);
}
}
}
return
0
;
return
0
;
...
@@ -786,11 +781,6 @@ int Client::read_tls() {
...
@@ -786,11 +781,6 @@ int Client::read_tls() {
if
(
on_read
(
buf
,
rv
)
!=
0
)
{
if
(
on_read
(
buf
,
rv
)
!=
0
)
{
return
-
1
;
return
-
1
;
}
}
if
(
!
first_byte_received
)
{
first_byte_received
=
true
;
record_ttfb
(
&
worker
->
stats
);
}
}
}
}
}
...
@@ -849,8 +839,13 @@ void Client::record_connect_time(Stats *stat) {
...
@@ -849,8 +839,13 @@ void Client::record_connect_time(Stats *stat) {
stat
->
connect_times
.
push_back
(
std
::
chrono
::
steady_clock
::
now
());
stat
->
connect_times
.
push_back
(
std
::
chrono
::
steady_clock
::
now
());
}
}
void
Client
::
record_ttfb
(
Stats
*
stat
)
{
void
Client
::
record_ttfb
()
{
stat
->
ttfbs
.
push_back
(
std
::
chrono
::
steady_clock
::
now
());
if
(
first_byte_received
)
{
return
;
}
first_byte_received
=
true
;
worker
->
stats
.
ttfbs
.
push_back
(
std
::
chrono
::
steady_clock
::
now
());
}
}
void
Client
::
signal_write
()
{
ev_io_start
(
worker
->
loop
,
&
wev
);
}
void
Client
::
signal_write
()
{
ev_io_start
(
worker
->
loop
,
&
wev
);
}
...
...
src/h2load.h
View file @
0d8c8ca0
...
@@ -268,7 +268,7 @@ struct Client {
...
@@ -268,7 +268,7 @@ struct Client {
void
record_request_time
(
RequestStat
*
req_stat
);
void
record_request_time
(
RequestStat
*
req_stat
);
void
record_start_time
(
Stats
*
stat
);
void
record_start_time
(
Stats
*
stat
);
void
record_connect_time
(
Stats
*
stat
);
void
record_connect_time
(
Stats
*
stat
);
void
record_ttfb
(
Stats
*
stat
);
void
record_ttfb
();
void
signal_write
();
void
signal_write
();
};
};
...
...
src/h2load_http2_session.cc
View file @
0d8c8ca0
...
@@ -64,6 +64,9 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
...
@@ -64,6 +64,9 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
return
0
;
return
0
;
}
}
client
->
worker
->
stats
.
bytes_head
+=
frame
->
hd
.
length
;
client
->
worker
->
stats
.
bytes_head
+=
frame
->
hd
.
length
;
if
(
frame
->
hd
.
flags
&
NGHTTP2_FLAG_END_STREAM
)
{
client
->
record_ttfb
();
}
return
0
;
return
0
;
}
}
}
// namespace
}
// namespace
...
@@ -73,6 +76,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
...
@@ -73,6 +76,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
int32_t
stream_id
,
const
uint8_t
*
data
,
int32_t
stream_id
,
const
uint8_t
*
data
,
size_t
len
,
void
*
user_data
)
{
size_t
len
,
void
*
user_data
)
{
auto
client
=
static_cast
<
Client
*>
(
user_data
);
auto
client
=
static_cast
<
Client
*>
(
user_data
);
client
->
record_ttfb
();
client
->
worker
->
stats
.
bytes_body
+=
len
;
client
->
worker
->
stats
.
bytes_body
+=
len
;
return
0
;
return
0
;
}
}
...
...
src/h2load_spdy_session.cc
View file @
0d8c8ca0
...
@@ -70,6 +70,10 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
...
@@ -70,6 +70,10 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
reinterpret_cast
<
const
uint8_t
*>
(
value
),
strlen
(
value
));
reinterpret_cast
<
const
uint8_t
*>
(
value
),
strlen
(
value
));
}
}
client
->
worker
->
stats
.
bytes_head
+=
frame
->
syn_reply
.
hd
.
length
;
client
->
worker
->
stats
.
bytes_head
+=
frame
->
syn_reply
.
hd
.
length
;
if
(
frame
->
syn_stream
.
hd
.
flags
&
SPDYLAY_CTRL_FLAG_FIN
)
{
client
->
record_ttfb
();
}
}
}
}
// namespace
}
// namespace
...
@@ -78,6 +82,8 @@ void on_data_chunk_recv_callback(spdylay_session *session, uint8_t flags,
...
@@ -78,6 +82,8 @@ void on_data_chunk_recv_callback(spdylay_session *session, uint8_t flags,
int32_t
stream_id
,
const
uint8_t
*
data
,
int32_t
stream_id
,
const
uint8_t
*
data
,
size_t
len
,
void
*
user_data
)
{
size_t
len
,
void
*
user_data
)
{
auto
client
=
static_cast
<
Client
*>
(
user_data
);
auto
client
=
static_cast
<
Client
*>
(
user_data
);
client
->
record_ttfb
();
client
->
worker
->
stats
.
bytes_body
+=
len
;
client
->
worker
->
stats
.
bytes_body
+=
len
;
auto
spdy_session
=
static_cast
<
SpdySession
*>
(
client
->
session
.
get
());
auto
spdy_session
=
static_cast
<
SpdySession
*>
(
client
->
session
.
get
());
...
...
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