mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
LWS_WITH_STATS: dont add latency when start point not set
Also fix lws_meta child connections to also measure their own latency.
This commit is contained in:
parent
9b484ff507
commit
4efc35db58
3 changed files with 13 additions and 6 deletions
13
lib/pollfd.c
13
lib/pollfd.c
|
@ -346,6 +346,7 @@ lws_callback_on_writable(struct lws *wsi)
|
|||
struct lws *network_wsi, *wsi2;
|
||||
int already;
|
||||
#endif
|
||||
int n;
|
||||
|
||||
if (wsi->state == LWSS_SHUTDOWN)
|
||||
return 0;
|
||||
|
@ -353,9 +354,16 @@ lws_callback_on_writable(struct lws *wsi)
|
|||
if (wsi->socket_is_permanently_unusable)
|
||||
return 0;
|
||||
|
||||
if (wsi->parent_carries_io) {
|
||||
int n = lws_callback_on_writable(wsi->parent);
|
||||
pt = &wsi->context->pt[(int)wsi->tsi];
|
||||
|
||||
if (wsi->parent_carries_io) {
|
||||
#if defined(LWS_WITH_STATS)
|
||||
if (!wsi->active_writable_req_us) {
|
||||
wsi->active_writable_req_us = time_in_microseconds();
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
|
||||
}
|
||||
#endif
|
||||
n = lws_callback_on_writable(wsi->parent);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
||||
|
@ -363,7 +371,6 @@ lws_callback_on_writable(struct lws *wsi)
|
|||
return 1;
|
||||
}
|
||||
|
||||
pt = &wsi->context->pt[(int)wsi->tsi];
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB_REQ, 1);
|
||||
#if defined(LWS_WITH_STATS)
|
||||
if (!wsi->active_writable_req_us) {
|
||||
|
|
|
@ -2433,7 +2433,7 @@ try_pollout:
|
|||
if (wsi->mode == LWSCM_RAW) {
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB, 1);
|
||||
#if defined(LWS_WITH_STATS)
|
||||
{
|
||||
if (wsi->active_writable_req_us) {
|
||||
uint64_t ul = time_in_microseconds() - wsi->active_writable_req_us;
|
||||
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_MS_WRITABLE_DELAY, ul);
|
||||
|
@ -2458,7 +2458,7 @@ try_pollout:
|
|||
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB, 1);
|
||||
#if defined(LWS_WITH_STATS)
|
||||
{
|
||||
if (wsi->active_writable_req_us) {
|
||||
uint64_t ul = time_in_microseconds() - wsi->active_writable_req_us;
|
||||
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_MS_WRITABLE_DELAY, ul);
|
||||
|
|
|
@ -29,7 +29,7 @@ lws_calllback_as_writeable(struct lws *wsi)
|
|||
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB, 1);
|
||||
#if defined(LWS_WITH_STATS)
|
||||
{
|
||||
if (wsi->active_writable_req_us) {
|
||||
uint64_t ul = time_in_microseconds() - wsi->active_writable_req_us;
|
||||
|
||||
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_MS_WRITABLE_DELAY, ul);
|
||||
|
|
Loading…
Add table
Reference in a new issue