Skip to content

Commit

Permalink
Timing from scene load to complete view
Browse files Browse the repository at this point in the history
  • Loading branch information
hjanetzek committed Dec 6, 2018
1 parent f1abc75 commit e3bda9c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions core/src/data/networkDataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ bool NetworkDataSource::loadTileData(std::shared_ptr<TileTask> task, TileTaskCb
m_urlSubdomainIndex = (m_urlSubdomainIndex + 1) % m_urlSubdomains.size();
}

UrlCallback onRequestFinish = [callback, task, url](UrlResponse&& response) {

LOGTInit(">>> %s", task->tileId().toString().c_str());
UrlCallback onRequestFinish = [=](UrlResponse&& response) mutable {
auto source = task->source();
if (!source) {
LOGW("URL Callback for deleted TileSource '%s'", url.string().c_str());
return;
}
LOGT("<<< %s -- canceled:%d", task->tileId().toString().c_str(), task->isCanceled());

if (task->isCanceled()) {
return;
}
Expand Down
8 changes: 8 additions & 0 deletions core/src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ void Map::Impl::setScene(std::shared_ptr<Scene>& _scene) {
SceneID Map::loadScene(std::shared_ptr<Scene> scene,
const std::vector<SceneUpdate>& _sceneUpdates) {

LOGTOInit();
{
std::unique_lock<std::mutex> lock(impl->sceneMutex);

Expand Down Expand Up @@ -250,6 +251,7 @@ SceneID Map::loadSceneYamlAsync(const std::string& _yaml, const std::string& _re
SceneID Map::loadSceneAsync(std::shared_ptr<Scene> nextScene,
const std::vector<SceneUpdate>& _sceneUpdates) {

LOGTOInit();
impl->sceneLoadBegin();

runAsyncTask([nextScene, _sceneUpdates, this](){
Expand Down Expand Up @@ -388,6 +390,8 @@ bool Map::update(float _dt) {
// Wait until font and texture resources are fully loaded
if (impl->scene->pendingFonts > 0 || impl->scene->pendingTextures > 0) {
platform->requestRender();
LOGTO("Waiting for Scene fonts:%d textures:%d",
impl->scene->pendingFonts.load(), impl->scene->pendingTextures.load());
return false;
}

Expand Down Expand Up @@ -463,6 +467,10 @@ bool Map::update(float _dt) {
platform->requestRender();
}

LOGTO("View complete:%d vc:%d tl:%d tc:%d easing:%d label:%d maker:%d ",
viewComplete, viewChanged, tilesLoading, tilesChanged,
impl->isCameraEasing, labelsNeedUpdate, markersNeedUpdate);

return viewComplete;
}

Expand Down
5 changes: 3 additions & 2 deletions core/src/tile/tileWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void TileWorker::run(Worker* instance) {

if (instance->tileBuilder) {
builder = std::move(instance->tileBuilder);
LOG("Passed new TileBuilder to TileWorker");
LOGTO("Passed new TileBuilder to TileWorker");
}

// Check if thread should stop
Expand Down Expand Up @@ -90,8 +90,9 @@ void TileWorker::run(Worker* instance) {
if (task->isCanceled()) {
continue;
}

LOGTInit(">>> %s", task->tileId().toString().c_str());
task->process(*builder);
LOGT("<<< %s", task->tileId().toString().c_str());

m_platform->requestRender();
}
Expand Down
5 changes: 3 additions & 2 deletions platforms/common/urlClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void UrlClient::curlLoop(uint32_t index) {
// Configure the easy handle.
const char* url = task.request.url.data();
curl_easy_setopt(handle, CURLOPT_URL, url);
LOGD("curlLoop %u starting request for url: %s", index, url);
LOGTInit("[%u] Starting request: %s", index, url);
// Perform the request.
auto result = curl_easy_perform(handle);
// Handle success or error.
Expand All @@ -184,9 +184,10 @@ void UrlClient::curlLoop(uint32_t index) {
}
// If a callback is given, always run it regardless of request result.
if (task.request.callback) {
LOGD("curlLoop %u performing request callback", index);
LOGT("[%u] Finished request", index);
response.content = task.content;
task.request.callback(std::move(response));
LOGT("[%u] Ran callback", index);
}
}
// Reset the task.
Expand Down

0 comments on commit e3bda9c

Please sign in to comment.