Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

How to profile APL document download and render performance? #68

Closed
7 tasks
yuan0258 opened this issue Dec 21, 2020 · 3 comments
Closed
7 tasks

How to profile APL document download and render performance? #68

yuan0258 opened this issue Dec 21, 2020 · 3 comments

Comments

@yuan0258
Copy link

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

Base on issue #62
Sure, the best way to profile the rendering time is by profiling the time between TemplateRuntime::handleRenderPlayerInfoDirective and GUIClient::executeHandleRenderComplete. Alternatively, you can use MetricsRecorder.

Please open the ticket if you have any further questions. Thanks!

Originally posted by @VaruPan in #62 (comment)

We want to know about how to profile several things
1.How to profile APL document download time from user say uttrance?
2.Browser rendering performance
3.How to use MetricsRecorder to record it?

What is the expected behavior?

Browser rending UI fast as soon as possible

What behavior are you observing?

Browser rending UI to slow in first time.

APL document for browser rendering time too long
Log:https://github.com/alexa/alexa-smart-screen-sdk/files/5663979/sssdk240_playmusic_after.zip

Does the render time is about 17.728s on RPi4.
It doesn't make sense why it take too long time
2020-12-09 05:45:10.511 [ c] 5 TemplateRuntime:handleRenderPlayerInfoDirective
2020-12-09 05:45:28.239 [ 2] 3 GUILogBridge:GUILog:component=WSClient:message sent, type: renderComplete

Provide the steps to reproduce the issue, if applicable:

Run smart screen sdk v2.4 on RPi4.
Say ‘Alexa, play music’. Play music the first time.
Say ‘Alexa, stop’.
Wait 5 minutes.
Say ‘Alexa, play music’. Play music the second time.
Record the time interval between audio and playcard.

Tell us about your environment:

What version of the AVS Device SDK are you using?

AVS Device SDK: <1.21.0>
APL core library: <1.4.1>
Alexa smart screen SDK: <2.4.0>

Tell us what hardware you're using:

  • Desktop / Laptop
  • [*] Raspberry Pi
  • Other - tell us more:

Tell us about your OS (Type & version):

  • Linux
  • MacOS
  • [*] Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:

Have you tried the same use case with AVS Device SDK SampleApp?

  • The issue is not applicable to the AVS Device SDK SampleApp.
  • [*] The issue is not reproducible on the AVS Device SDK SampleApp.
@yuan0258
Copy link
Author

yuan0258 commented Jan 5, 2021

Could we measure from Thinking to TemplateRuntime:handleRenderPlayerInfoDirective about 1.38s for APL download time ?
2020-12-09 05:45:09.131 [ 17] 5 TemplateRuntime:onDialogUXStateChanged:state=THINKING
2020-12-09 05:45:10.511 [ c] 5 TemplateRuntime:handleRenderPlayerInfoDirective
2020-12-09 05:45:28.239 [ 2] 3 GUILogBridge:GUILog:component=WSClient:message sent, type: renderComplete

@powj
Copy link
Contributor

powj commented Jan 14, 2021

Hi @yuan0258 ,
It is possible to enable metrics for tracking APL performance within the Smart Screen SDK, however by default this functionality is not enabled. If you are primarily interested in APL metrics then it should be possible to add this by making a few small modifications (note that this metrics sink is provided as a sample for testing purposes only):

  1. Rebuild and reinstall the AVS Device SDK with the -DMETRICS=ON flag
  2. Modify the Smart Screen SDK code to use the Sample metrics sink
    Add the following includes to SmartScreenClient.cpp
#include <Metrics/MetricRecorder.h>
#include <Metrics/SampleMetricSink.h>

Replace the null metrics recorder found at https://github.com/alexa/alexa-smart-screen-sdk/blob/master/modules/Alexa/ApplicationUtilities/SmartScreenClient/src/SmartScreenClient.cpp#L478 with the Sample implementation

    std::string metricsFilePath{"/tmp/metrics.dmp"};
    std::unique_ptr<alexaClientSDK::metrics::implementations::SampleMetricSink> fileSink{
        new alexaClientSDK::metrics::implementations::SampleMetricSink(metricsFilePath)};
    auto metricRecorder = alexaClientSDK::metrics::implementations::MetricRecorder::createMetricRecorderInterface(std::move(fileSink));
  1. Rebuild the Smart Screen SDK adding the metrics and APL metrics flags -DMETRICS=ON -DUSE_APL_TELEMETRY=ON
  2. When running the SampleApp, metrics can be found in the path provided above i.e. /tmp/metrics.dmp

@VaruPan
Copy link
Contributor

VaruPan commented Jan 21, 2021

Closing the ticket due to inactivity, please feel free to open the ticket again. Once again, thanks a lot for contributing to Alexa Smart Screen SDK!

@VaruPan VaruPan closed this as completed Jan 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants