diff options
author | Lloyd Sheng <i@lloydsheng.com> | 2018-06-21 11:24:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-21 11:24:14 +0800 |
commit | eb70b8984901d8113f3a29d26cc355d5b3ed46fd (patch) | |
tree | 258ea32e9e7b9a29f3c861d83bc0674fd2a21603 /platform/default | |
parent | 2886aca3e29660df24ea4a089b1a4457404cdf75 (diff) | |
download | qtlocation-mapboxgl-eb70b8984901d8113f3a29d26cc355d5b3ed46fd.tar.gz |
[core] Measuring tiles requesting/parsing time using logging (#12152)
* Tile timing
* Refactor logging code
* Keep the scope of `messageStream` constrained
* Make log message more clear
* Fix crash issue if onlineResponse.data is null
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/default_file_source.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/default/default_file_source.cpp b/platform/default/default_file_source.cpp index cb602995a4..89aabeb8d3 100644 --- a/platform/default/default_file_source.cpp +++ b/platform/default/default_file_source.cpp @@ -11,6 +11,7 @@ #include <mbgl/util/url.hpp> #include <mbgl/util/thread.hpp> #include <mbgl/util/work_request.hpp> +#include <mbgl/util/stopwatch.hpp> #include <cassert> @@ -151,8 +152,17 @@ public: // Get from the online file source if (resource.hasLoadingMethod(Resource::LoadingMethod::Network)) { + MBGL_TIMING_START(watch); tasks[req] = onlineFileSource.request(resource, [=] (Response onlineResponse) mutable { this->offlineDatabase->put(resource, onlineResponse); + if (resource.kind == Resource::Kind::Tile) { + // onlineResponse.data will be null if data not modified + MBGL_TIMING_FINISH(watch, + " Action: " << "Requesting," << + " URL: " << resource.url.c_str() << + " Size: " << (onlineResponse.data != nullptr ? onlineResponse.data->size() : 0) << "B," << + " Time") + } callback(onlineResponse); }); } |