Pricing
PerfDog-Client Performance Test Tool
Help Documents menu

PerfDog-Client Performance Test Tool

Updated on: 2021-09-18 14:10

Instructions for Use of PerfDogService

Token application: contact sales.
Download the installation package: https://perfdog.qq.com/sdk

I. Overview

Based on the PerfDog service component, users can develop their own PerfDog performance tools or automated services. This document mainly describes the interface provided by PerfDogService, and provides a runnable DEMO for students having such demands to get started quickly.

II. Quick guide

Decompress the PerfDogService installation package locally
PerfDogService.exe: generally speaking, Service startup files are not started manually, but automatically started by automated scripts.
perfdog.proto: Definition files of grpc interface and protobuf struct
demo/python: Demo of python 3, dependent libraries grpcio and protobuf
demo/java: Java demo, dependent libraries grpc-netty-shaded, grpc-protobuf and grpc-stub

Run demo quickly (take demo/python as an example)

  1. Install the Python3 environment
  2. Install the dependent libraries grpcio and protobuf. pip is recommended.
  3. Open the demo/Python directory
  4. Open the demo.py file in the directory, and change input parameters
  5. Open the command window and run the demo.py file
  6. Demo runs successfully. Check the output

III. Overall architecture

Product components

Overall framework

IV. Workflow

PerfDogService supports simultaneous testing of multiple devices. The workflow is shown in the figure below. Please refer to Demo for specific operation

V. Method list

loginWithToken
Purposes
User login interface
Definition
rpc loginWithToken (Token) returns (UserInfo) {}
Parameters
Token: Login token
Return value
UserInfo: Login user’s account information
Note
If a token is required, you need to apply for a token on the official website
startDeviceMonitor
Purposes
Start the device listener, and use this interface to receive the connection and disconnection events between the mobile device and the PC
Definition
rpc startDeviceMonitor (Empty) returns (stream DeviceEvent) {}
Parameters
Empty: gprc placeholder parameter, no practical meaning
Return value
stream DeviceEvent: Device connection and disconnection event stream. The thread can be started independently to obtain the corresponding event from the return value
Pre-dependence
User already logged in
initDevice
Purposes
Initialize the device
Definition
rpc initDevice (Device) returns (Empty) {}
Parameters
Device: Used to identify the device, and can be obtained from DeviceEvent.
Return value
Empty: grpc return value placeholder, no practical meaning
Pre-dependence
User already logged in
getDeviceInfo
Purposes
Get the device information
Definition
rpc getDeviceInfo (Device) returns (DeviceInfo) {}
Parameters
Device: Used to identify the device
Return value
DeviceInfo: Basic information of device
Pre-dependence
User already logged in
Device already initialized
getDeviceStatus
Purposes
Get the device status
Definition
rpc getDeviceStatus (Device) returns (DeviceStatus) {}
Parameters
Device: device identification struct
Return value
DeviceStatus: Device status information
Pre-dependence
User already logged in
getAppList
Purposes
Get the device APP list
Definition
rpc getAppList (Device) returns (AppList) {}
Parameters
Device: device identification struct
Return value
AppList: List of APPs installed on the device
Pre-dependence
User already logged in
Device already initialized
enablePerfDataType
Purposes
Enable test data indexes
Definition
rpc enablePerfDataType(EnablePerfDataTypeReq) returns (Empty) {}
Parameters
EnablePerfDataTypeReq: For the type to be opened, refer to the PerfDataTypem enumeration type declaration in the pb definition file
Return value
Empty: grpc parameter placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
disablePerfDataType
Purposes
Disable test data indexes
Definition
rpc disablePerfDataType (DisablePerfDataTypeReq) returns (Empty) {}
Parameters
DisablePerfDataTypeReq: Data types to be closed
Return value
Empty: grpc parameter placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
getPerfDataType
Purposes
Gets a list of data types already opened
Definition
rpc getPerfDataType (Device) returns (PerfDataTypeRet) {}
Parameters
Device: device identification struct
Return value
PerfDataTypeRet: Open the list of data types. See the attached protocol file
Pre-dependence
User already logged in
Device already initialized
getAvailableDataType
Purposes
Get the test data index type supported by the device
Definition
rpc getAvailableDataType (Device) returns (PerfDataTypeRet) {}
Parameters
Device: device identification struct
Return value
PerfDataTypeRet: You can open a list of data types
Pre-dependence
User already logged in
Device already initialized
setScreenShotInterval
Purposes
Set the screen capturing interval
Definition
rpc setScreenShotInterval (ScreenShotInterval) returns (Empty) {}
Parameters
ScreenShotInterval: Set the screen capturing interval in the device test, in seconds
Return value
Empty: grpc parameter placeholder
Pre-dependence
User already logged in
startTestApp
Purposes
Start the App test
Definition
rpc startTestApp(StartTestAppReq) returns (StartTestRet) {}
Parameters
StartTestAppReq: Fill in the information about the test App to be configured
Return value
StartTestRet: grpc return value placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
Note
Data types enabled by Android by default are FPS, CPUUSAGE, MEMORY, CPU_TEMPERATURE, NETWORK_USAGE, FRAME_TIME and BATTERY (wifi mode);
Data types enabled by IOS by default by default are FPS and CPU USAGE, FPS, CPU_USAGE, MEMORY, IOS_GPU_USAGE, NETWORK_USAGE, CTX_SWITCH, FRAME_TIME (USB mode) and BATTERY (WiFi mode);
If you need to open or close other data types, use the enablePerfDataType and disablePerfDataType interfaces.
startTestSysProcess
Purposes
Start the system process test
Definition
rpc startTestSysProcess (StartTestSysProcessReq) returns (StartTestRet) {}
Parameters
StartTestSysProcessReq: Set the device and the system process to be tested
Return value
StartTestRet: grpc return value placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
Note
The rules for data types are the same as those for startTestApp
openPerfDataStream
Purposes
Open the real-time test index stream, to obtain the real-time test index data
Definition
rpc openPerfDataStream (OpenPerfDataStreamReq) returns (stream PerfData) {}
Parameters
OpenPerfDataStreamReq: If you need to specify a device, you will get the test index data stream of the specified device
Return value
stream PerfData: Streaming return performance data
Pre-dependence
User already logged in
Device already initialized
The device test has started
stopTest
Purposes
End the test
Definition
rpc stopTest (StopTestReq) returns (Empty) {}
Parameters
StopTestReq: You need to specify the device to be stopped. perfdog supports simultaneous testing of multiple devices
Return value
Empty: grpc return value placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
The device test has started
setLabel
Purposes
The label is added during the test. The start time of the label is the current time. All belong to the scope of the newly added label description until there is a next label.

Definition
rpc setLabel (SetLabelReq) returns (Empty) {}
Parameters
SetLabelReq: The device information and the label name should be filled in
Return value
Empty: grpc return value placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
The device test has started
updateLabel
Purposes
Change the name of label
Definition
rpc updateLabel (UpdateLabelReq) returns (Empty) {}
Parameters
UpdateLabelReq: To update the label request, you need to fill in the device information, the start time of label (representative tag) and the information of new labels
Return value
Empty: grpc parameter placeholder, no practical meaning
Pre-dependence
User already logged in
Device already initialized
The device test has started
addNote
Purposes
Add annotation
Definition
rpc addNote (AddNoteReq) returns (Empty) {}
Parameters
AddNoteReq: To add an annotation request, you need to fill in the device information, the time point of annotation and the annotation contents
Return value
Empty: grpc parameter placeholder, no practical meaning
Pre-dependence
User already logged in
removeNote
Purposes
Delete annotation
Definition
rpc removeNote (RemoveNoteReq) returns (Empty) {}
Parameters
RemoveNoteReq: To delete an annotation request, you need to fill in the device information and the annotation time and position
Return value
Empty: grpc parameter placeholder
Pre-dependence
User already logged in
setGlobalDataUploadServer
Purposes
Set the third-party data upload service. When upload is selected for saved data, if the third-party data service is set, the data will not be uploaded to the official cloud service, but uploaded to the data service set here.
Definition
rpc setGlobalDataUploadServer (SetDataUploadServerReq) returns (SetDataUploadServerRsp) {}
Parameters
SetDataUploadServerReq: Set the third-party data service request. You need to set the url address of upload service and the upload format required. The formats json and pb are supported
Return value
SetDataUploadServerRsp: grpc return value placeholder, no practical meaning
Pre-dependence
User already logged in
saveData
Purposes
Save test data
Definition
rpc saveData (SaveDataReq) returns (SaveDataRsp) {}
Parameters
SaveDataReq: To make a request to save test data, you need to fill in the device information, start time and end time of data, whether to upload to the data service (official cloud storage or third-party data service), whether to save to the file, and the saving path and format when save to the file is selected
Return value
SaveDataRsp: Saving file results, including upload results and export-to-file results
Pre-dependence
User already logged in
getDeviceCacheData
Purposes
Get the cache data of the device. Data return in streams
Definition
rpc getDeviceCacheData (GetDeviceCacheDataReq) returns(stream CachePerfData) {}
Parameters
GetDeviceCacheDataReq: To make a data pulling request, you need to fill in the device information field
Return value
stream CachePerfData: For streaming return of cache performance data, see the structure definition of CachePerfData
Pre-dependence
User already logged in
Note
It is applicable to where the device is disconnected during the test, and also to data pulling by piece during or after the test. Cached performance data will be emptied at the beginning of a new test
getDeviceCacheDataPacked
Purposes
Get the cache data of the device. Index data will be packaged and returned
Definition
rpc getDeviceCacheDataPacked (GetDeviceCacheDataPackedReq) returns (stream CachePerfDataPacked) {}
Parameters
GetDeviceCacheDataPackedReq: To make a cache data pulling request, you need to provide the device information and the return data format. The return formats json and pb are supported
Return value
stream CachePerfDataPacked: Test data cached by the device are returned in streams. There are 2 + n returns. Test index data are returned in the first time, test application icons are returned in the second time, and screenshots (if any) generated during the test are returned in subsequent n times.
Pre-dependence
User already logged in
Note
It is applicable to where the device is disconnected during the test, and also to pulling of packaged data during or after the test. Cached performance data will be emptied at the beginning of a new test
getAppRunningProcess
Purposes
Get the list of running processes of APP on the device
Definition
rpc getAppRunningProcess (GetAppRunningProcessReq) returns (GetAppRunningProcessRet) {}
Parameters
GetAppRunningProcessReq: To make a process list pulling request, you need to fill in the device information and the app information
Return value
GetAppRunningProcessRet: Process list
Pre-dependence
User already logged in
Device already initialized
getAppWindowMap
Purposes
Get the Activity and SurfaceView corresponding to each process of APP on the device, which is only applicable to Android devices
Definition
rpc getAppWindowsMap (GetAppWindowsMapReq) returns (GetAppWindowsMapRet) {}
Parameters
GetAppWindowMapReq: To obtain the Activity and SurfaceView requests corresponding to the app process, you need to fill in the device information and the app information
Return value
GetAppRunningProcessRet: The returned data can be understood as a map, the key value is pid, and the value value is the list of Activity and SurfaceView involved in the pid
Pre-dependence
User already logged in
Device already initialized
getRunningSysProcess
Purposes
Get the process list of the device system
Definition
rpc getRunningSysProcess (Device) returns (GetRunningSysProcessRet) {}
Parameters
Device: Device that needs to get the system process list
Return value
GetRunningSysProcessRet:
Pre-dependence
User already logged in
Device already initialized
updateAppInfo
Purposes
Refresh the app information
Definition
rpc updateAppInfo (UpdateAppInfoReq) returns (UpdateAppInfoRet) {}
Parameters
UpdateAppInfoReq: To update an App request, you need to fill in the device information and the app information
Return value
UpdateAppInfoRet: Return the latest app information
Pre-dependence
User already logged in
Device already initialized
Note
Generally used to update the app information before the start of testing to prevent the app from being unloaded or upgraded before the start of testing
createTask
Purposes
Create tasks to categorize and upload test data.
Definition
rpc createTask (CreateTaskReq) returns (CreateTaskRsp) {}
Parameters
CreateTaskReq: To create a Task request, you need to give Task a name which should not exceed 50 characters
Return value
CreateTaskRsp: Return to the newly created task Id
Pre-dependence
User already logged in
archiveCaseToTask
Purposes
Archive the case uploaded to the official cloud storage to task
Definition
rpc archiveCaseToTask (ArchiveCaseToTaskReq) returns (ArchiveCaseToTaskRsp) {}
Parameters
ArchiveCaseToTaskReq: To make an archiving request, you need to fill in task Id and Case ID
Return value
ArchiveCaseToTaskRsp: Return value placeholder, no practical meaning
Pre-dependence
User already logged in
shareCase
Purposes
Share the case data uploaded to the official cloud storage
Definition
rpc shareCase (ShareCaseReq) returns (ShareCaseRsp) {}
Parameters
ShareCaseReq: Shared case id and valid sharing time (in minutes, 0 represents the sharing will never expire)
Return value
ShareCaseRsp: View case link and password after returning the shared
Pre-dependence
User already logged in
killServer
Purposes
Stop PerfDogService
Definition
rpc killServer (Empty) returns (Empty) {}
Parameters
Empty: grpc parameter placeholder, no practical meaning
Return value
Empty: grpc return value placeholder, no practical meaning