You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create the SystemCpuUtilTask module and implement the functionality to retrieve CPU utilization.
Review the README
Please see README.md for further information on, and use of, this content.
License for embedded documentation and source codes: PIOT-DOC-LIC
Estimated effort may vary greatly
The estimated level of effort for this exercise shown in the 'Estimate' section below is a very rough approximation. The actual level of effort may vary greatly depending on your development and test environment, experience with the requisite technologies, and many other factors.
Actions
NOTE: The implementation examples depicted here are only one way to implement the requirements listed. Your own implementation may vary of course.
Within the programmingtheiot.gda.system package, create a new Java class named SystemCpuUtilTask. This should be derived from BaseSystemUtilTask.
Import statements should include the following (you may choose to include the Logger for debugging):
Add in an override for the inherited template method getTelemetryValue(). It will retrieve CPU utilization (averaged across any / all cores) and return the value as a float. Use the @Override annotation and be sure to remove the abstract keyword if you're copying / pasting from the base class. Use the following code for the value:
Unit tests (in ./src/test/java/programmingtheiot/part01/unit)
Run ./system/SystemCpuUtilTaskTest. If your Operating System supports retrieval of CPU load, the testGetTelemetryValue() unit test should pass while displaying values greater than 0.0% and (likely) less than 100.0%. If your Operating System doesn't support this, each test will return a negative value, as follows:
Test 1: CPU Util not supported on this OS: -1.0
Test 2: CPU Util not supported on this OS: -1.0
Test 3: CPU Util not supported on this OS: -1.0
Test 4: CPU Util not supported on this OS: -1.0
Test 5: CPU Util not supported on this OS: -1.0
The text was updated successfully, but these errors were encountered:
labbenchstudios
changed the title
PIOT-GDA-02-003
PIOT-GDA-02-003: Create module - SystemCpuUtilTask
Jul 15, 2020
Description
Review the README
Estimated effort may vary greatly
Actions
NOTE: The implementation examples depicted here are only one way to implement the requirements listed. Your own implementation may vary of course.
programmingtheiot.gda.system
package, create a new Java class namedSystemCpuUtilTask
. This should be derived from BaseSystemUtilTask.Logger
for debugging):getTelemetryValue()
. It will retrieve CPU utilization (averaged across any / all cores) and return the value as a float. Use the@Override
annotation and be sure to remove the abstract keyword if you're copying / pasting from the base class. Use the following code for the value:Estimate
Tests
./system/SystemCpuUtilTaskTest
. If your Operating System supports retrieval of CPU load, thetestGetTelemetryValue()
unit test should pass while displaying values greater than 0.0% and (likely) less than 100.0%. If your Operating System doesn't support this, each test will return a negative value, as follows:The text was updated successfully, but these errors were encountered: