-
-
Notifications
You must be signed in to change notification settings - Fork 764
add apis to read the performance data #562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
500717b
add apis to read the performance data
heeseon 26d7c1d
fix the requirements for pullrequest
heeseon d5fcf64
fix the ci error
heeseon c0f3f62
fix the ci error
heeseon dd7885f
fix the ci error
heeseon be76b26
define interface to read performance data
heeseon e0ab11f
delete the duplicated code
heeseon 669f0a8
delete the unused import
heeseon fb890a9
delete the private comment
heeseon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/io/appium/java_client/android/HasSupportedPerformanceDataType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package io.appium.java_client.android; | ||
|
||
import static io.appium.java_client.android.AndroidMobileCommandHelper.getPerformanceDataCommand; | ||
import static io.appium.java_client.android.AndroidMobileCommandHelper.getSupportedPerformanceDataTypesCommand; | ||
|
||
import io.appium.java_client.CommandExecutionHelper; | ||
import io.appium.java_client.ExecutesMethod; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* | ||
*/ | ||
public interface HasSupportedPerformanceDataType extends ExecutesMethod { | ||
|
||
/** | ||
* returns the information type of the system state which is supported to read | ||
* as like cpu, memory, network traffic, and battery. | ||
* @return output - array like below | ||
* [cpuinfo, batteryinfo, networkinfo, memoryinfo] | ||
* | ||
*/ | ||
default List<String> getSupportedPerformanceDataTypes() { | ||
return CommandExecutionHelper.execute(this, getSupportedPerformanceDataTypesCommand()); | ||
} | ||
|
||
/** | ||
* returns the resource usage information of the application. the resource is one of the system state | ||
* which means cpu, memory, network traffic, and battery. | ||
* | ||
* @param packageName the package name of the application | ||
* @param dataType the type of system state which wants to read. | ||
* It should be one of the supported performance data types, | ||
* the return value of the function "getSupportedPerformanceDataTypes" | ||
* @param dataReadTimeout the number of attempts to read | ||
* @return table of the performance data, The first line of the table represents the type of data. | ||
* The remaining lines represent the values of the data. | ||
* in case of battery info : [[power], [23]] | ||
* in case of memory info : | ||
* [[totalPrivateDirty, nativePrivateDirty, dalvikPrivateDirty, eglPrivateDirty, glPrivateDirty, | ||
* totalPss, nativePss, dalvikPss, eglPss, glPss, nativeHeapAllocatedSize, nativeHeapSize], | ||
* [18360, 8296, 6132, null, null, 42588, 8406, 7024, null, null, 26519, 10344]] | ||
* in case of network info : | ||
* [[bucketStart, activeTime, rxBytes, rxPackets, txBytes, txPackets, operations, bucketDuration,], | ||
* [1478091600000, null, 1099075, 610947, 928, 114362, 769, 0, 3600000], | ||
* [1478095200000, null, 1306300, 405997, 509, 46359, 370, 0, 3600000]] | ||
* in case of network info : | ||
* [[st, activeTime, rb, rp, tb, tp, op, bucketDuration], | ||
* [1478088000, null, null, 32115296, 34291, 2956805, 25705, 0, 3600], | ||
* [1478091600, null, null, 2714683, 11821, 1420564, 12650, 0, 3600], | ||
* [1478095200, null, null, 10079213, 19962, 2487705, 20015, 0, 3600], | ||
* [1478098800, null, null, 4444433, 10227, 1430356, 10493, 0, 3600]] | ||
* in case of cpu info : [[user, kernel], [0.9, 1.3]] | ||
* @throws Exception if the performance data type is not supported, thows Error | ||
*/ | ||
default List<List<Object>> getPerformanceData(String packageName, String dataType, int dataReadTimeout) | ||
throws Exception { | ||
return CommandExecutionHelper.execute(this, | ||
getPerformanceDataCommand(packageName, dataType, dataReadTimeout)); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I used assertEquals