Is there any programmatic way to get Roku memory info?
I was trying to use ECP command, but there I am not getting.
I am using ECP command to check memory info as below.
https://developer.roku.com/en-gb/docs/developer-program/debugging/external-control-api.md
http://192.168.170.10:8060/query/chanperf
As per documentation i should get total memory info, as below.
<chanperf>
<channelId>dev</channelId>
<cpuPercent>
<sys>4</sys>
<user>22</user>
</cpuPercent>
<durationSeconds>1</durationSeconds>
<mem>
<anon>31698944</anon>
<file>25255936</file>
<shared>303104</shared>
<swap>0</swap>
<total>57257984</total>
</mem>
</chanperf>
But i am getting response like this:
<chanperf>
<timestamp>1672829874661</timestamp>
<plugin>
<cpu-percent>
<duration-seconds>1.000000</duration-seconds>
<user>0.0</user>
<sys>0.0</sys>
</cpu-percent>
<memory>
<used>35504128</used>
<res>35504128</res>
<anon>14180352</anon>
<swap>0</swap>
<file>21082112</file>
<shared>241664</shared>
</memory>
<id>dev</id>
</plugin>
<status>OK</status>
</chanperf>
Is there any way to get memory info through programtically?
I had tried to use ECP command.
You're on the right track. To get memory info you can use the
chanperfECP command, and you can do so programmatically from within your app, you just have to make a request.Here's an implementation of it. Call this function from the main thread or a task thread:
Keep in mind that if you call it from the main thread it'll lock the thread. You can use
asyncGetToString()instead to prevent that. Also, the use of ECP commands is not allowed on production apps so I'd recommend using this code during the development process only. And don't forget to add therun_as_process=1attribute to your manifest.Usage:
Output: