diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-08-13 18:24:53 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-08-14 00:31:37 -0400 |
commit | ad8dc13150b640ae9613e1edd8cc8c2c72b1e6b2 (patch) | |
tree | 67a63cbd6bf24b7f1105ba9d2eb6cf4f88846763 | |
parent | 31774e82c4c9ba2c1243fbc417174e966314dfca (diff) |
Reduce thread contention on HTTPStats singleton access via simpleton.
The main thread and http thread had significant contention in asset-fetch heavy scenarios that could result in main thread and http thread stalls when the http thread was accessing the HTTPStats singleton and the master singleton dependency list had to be queried.
The HTTP thread is the primary user of HTTPStats with the main thread only calling into it during shut down to query the stats for the session.
-rw-r--r-- | indra/llcorehttp/httprequest.cpp | 2 | ||||
-rw-r--r-- | indra/llcorehttp/httpstats.h | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 216d407deb..2aaf71f8a4 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService() HttpRequestQueue::init(); HttpRequestQueue * rq = HttpRequestQueue::instanceOf(); HttpService::init(rq); + HTTPStats::createInstance(); has_inited = true; } @@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService() if (has_inited) { + HTTPStats::deleteSingleton(); HttpService::term(); HttpRequestQueue::term(); has_inited = false; diff --git a/indra/llcorehttp/httpstats.h b/indra/llcorehttp/httpstats.h index f12e59da0c..5c0f26d34e 100644 --- a/indra/llcorehttp/httpstats.h +++ b/indra/llcorehttp/httpstats.h @@ -35,12 +35,12 @@ namespace LLCore { - class HTTPStats : public LLSingleton<HTTPStats> + class HTTPStats final : public LLSimpleton<HTTPStats> { - LLSINGLETON(HTTPStats); - virtual ~HTTPStats(); - public: + HTTPStats(); + ~HTTPStats(); + void resetStats(); typedef LLStatsAccumulator StatsAccumulator; |