public class HardCoderJNI
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static interface |
HardCoderJNI.AnrCallback |
static interface |
HardCoderJNI.HCPerfManagerThread
app can distribute a thread to run HCPerfManager or just use default thread like
initHardCoder(String, int, String, HCPerfManagerThread, HardCoderCallback.ConnectStatusCallback) } |
限定符和类型 | 方法和说明 |
---|---|
static long |
cancelCpuCoreForThread(int[] bindtids,
int tid,
long timestamp) |
static long |
cancelCpuHighFreq(int tid,
long timestamp) |
static long |
cancelGpuHighFreq(int tid,
long timestamp) |
static long |
cancelHighIOFreq(int tid,
long timestamp) |
static long |
cancelUnifyCpuIOThreadCoreGpu(boolean cancelcpu,
boolean cancelgpu,
boolean cancelio,
boolean cancelthread,
int[] bindtids,
int tid,
long timestamp) |
static long |
checkPermission(java.lang.String[] manufactures,
java.lang.String[] certs,
HardCoderCallback.FuncRetCallback callback)
check whether this app can use hardcoder in this phone.
|
static long |
checkPermission(java.lang.String[] manufactures,
java.lang.String[] certs,
int pid,
int uid,
int tid,
long timestamp) |
static long |
configure(byte[] data,
int tid,
long timestamp) |
static long |
getParameters(byte[] data,
int tid,
long timestamp) |
static int |
initHardCoder(java.lang.String remote,
int port,
java.lang.String local,
HardCoderJNI.HCPerfManagerThread hcPerfManagerThread,
HardCoderCallback.ConnectStatusCallback callback)
init Hardcoder, call after set hcEnable/hcDebug values
setHcEnable(boolean) setHcDebug(boolean) }
must call before startPerformance(int, int, int, int, int[], int, int, long, int, String) |
static boolean |
isCheckEnv() |
boolean |
isConnect() |
static boolean |
isHcDebug() |
static boolean |
isHcEnable() |
static int |
isRunning() |
static void |
onData(int callbackType,
long requestId,
long timestamp,
int retCode,
int funcId,
int dataType,
byte[] buffer)
system callback C2JAVA
|
static void |
onRequestCallback(int callbackType,
long requestId,
int retCode,
int funcId,
int dataType,
byte[] buffer) |
static void |
putFuncRetHashMap(long requestId,
HardCoderCallback.FuncRetCallback callback) |
static void |
putRequestStatusHashMap(long requestId,
HardCoderCallback.RequestStatus requestStatus) |
static java.lang.String |
readServerAddr()
Default implementation to read server socket name
|
static long |
registerANRCallback(HardCoderJNI.AnrCallback callback) |
static long |
registerANRCallback(int tid,
long timestamp) |
static long |
registerBootPreloadResource(java.lang.String[] files,
int tid,
long timestamp) |
static long |
registerSystemEventCallback(int tid,
long timestamp) |
static long |
requestCpuCoreForThread(int scene,
long action,
int[] bindtids,
int timeoutms,
int tid,
long timestamp) |
static long |
requestCpuHighFreq(int scene,
long action,
int level,
int timeoutms,
int tid,
long timestamp) |
static long |
requestGpuHighFreq(int scene,
long action,
int level,
int timeoutms,
int tid,
long timestamp) |
static long |
requestHighIOFreq(int scene,
long action,
int level,
int timeoutms,
int tid,
long timestamp) |
static long |
requestScreenResolution(int level,
java.lang.String uiName,
int tid,
long timestamp) |
static long |
requestUnifyCpuIOThreadCoreGpu(int scene,
long action,
int cpulevel,
int gpulevel,
int iolevel,
int[] bindtids,
int timeoutms,
int tid,
long timestamp) |
static long |
resetScreenResolution(int tid,
long timestamp) |
static void |
setCheckEnv(boolean env) |
static void |
setHcDebug(boolean debug) |
static void |
setHcEnable(boolean enable) |
static void |
setRetryConnectInterval(int interval) |
static void |
setSceneReportCallback(HardCoderCallback.SceneReportCallback callback) |
static int |
startPerformance(int delay,
int cpuLevel,
int ioLevel,
int gpuLevel,
int[] tids,
int timeout,
int scene,
long action,
int callerTid,
java.lang.String tag)
request cpu/io/bind tids/gpu
call after
initHardCoder(String, int, String, HCPerfManagerThread, HardCoderCallback.ConnectStatusCallback) |
static int |
startPerformance(int delay,
int cpuLevel,
int ioLevel,
int tid,
int timeout,
int scene,
long action,
int callerTid,
java.lang.String tag)
if the request doesn't need to bind tids, use this function
other params the same as
startPerformance(int, int, int, int, int[], int, int, long, int, String) |
static int |
startTraceCpuLoad(int linuxTid,
int sampleRate) |
static int |
stopPerformance(int hashCode)
call when the scene end
|
static int |
stopTraceCpuLoad(int id) |
static long |
terminateApp(int tid,
long timestamp) |
public static final int CPU_LEVEL_0
public static final int CPU_LEVEL_1
public static final int CPU_LEVEL_2
public static final int CPU_LEVEL_3
public static final int IO_LEVEL_0
public static final int IO_LEVEL_1
public static final int IO_LEVEL_2
public static final int IO_LEVEL_3
public static final int GPU_LEVEL_0
public static final int GPU_LEVEL_1
public static final int FUNC_LOCAL
public static final int FUNC_BASE
public static final int FUNC_CHECK_PERMISSION
public static final int FUNC_CPU_HIGH_FREQ
public static final int FUNC_CANCEL_CPU_HIGH_FREQ
public static final int FUNC_CPU_CORE_FOR_THREAD
public static final int FUNC_CANCEL_CPU_CORE_FOR_THREAD
public static final int FUNC_HIGH_IO_FREQ
public static final int FUNC_CANCEL_HIGH_IO_FREQ
public static final int FUNC_SET_SCREEN_RESOLUTION
public static final int FUNC_RESET_SCREEN_RESOLUTION
public static final int FUNC_REG_ANR_CALLBACK
public static final int FUNC_REG_PRELOAD_BOOT_RESOURCE
public static final int FUNC_TERMINATE_APP
public static final int FUNC_UNIFY_CPU_IO_THREAD_CORE
public static final int FUNC_CANCEL_UNIFY_CPU_IO_THREAD_CORE
public static final int FUNC_REG_SYSTEM_EVENT_CALLBACK
public static final int FUNC_GPU_HIGH_FREQ
public static final int FUNC_CANCEL_GPU_HIGH_FREQ
public static final int FUNC_CONFIGURE
public static final int RET_OK
public static final int RET_LEVEL_1
public static final int RET_LEVEL_2
public static final int RET_LEVEL_3
public static final int RET_CPU_HIGH_FREQ
public static final int RET_HIGH_IO_FREQ
public static final int RET_GPU_HIGH_FREQ
public static final int RET_CPU_HIGH_FREQ_LEVEL_1
public static final int RET_CPU_HIGH_FREQ_LEVEL_2
public static final int RET_CPU_HIGH_FREQ_LEVEL_3
public static final int RET_HIGH_IO_FREQ_LEVEL_1
public static final int RET_HIGH_IO_FREQ_LEVEL_2
public static final int RET_HIGH_IO_FREQ_LEVEL_3
public static final int ERROR_CODE_SUCCESS
public static final int ERROR_CODE_FAILED
public static final int ERROR_CODE_CHECKENV_FAIL
public static final int ERROR_CODE_NOT_ENABLE
public static final int ERROR_CODE_NOT_FOREGROUND
public static final int ERROR_CODE_HCPERFMANAGER_NULL
public static final int ERROR_CODE_DISCONNECT
public static final int CLIENT_CONNECT
public static final int CLIENT_DISCONNECT
public static final int ERR_CLIENT_ALREADY_INIT
public static final int APP_SCENE_UNDEFINE
public static final int APP_SCENE_STARTUP
public static final int APP_SCENE_WINDOW_SWITCH
public static final int APP_SCENE_WINDOW_SCROLL
public static final int APP_SCENE_DATA_LOADING_AND_PROCESS
public static final int APP_SCENE_MULTI_MEDIA_PROCESS
public static final int APP_SCENE_COMMUNICATE
public static final int APP_SCENE_SYSTEM_DEVICE
public static final int CALLBACK_TYPE_BASE
onData(int, long, long, int, int, int, byte[])
public static final int CALLBACK_TYPE_STATUS
public static final int CALLBACK_TYPE_DATA
public static int tickRate
public static final java.lang.String SERVER_PROP_KEY
public static final java.lang.String CLIENT_SOCK
public static HardCoderCallback.SceneReportCallback sceneReportCallback
public boolean isConnect()
public static void setCheckEnv(boolean env)
public static boolean isCheckEnv()
public static boolean isHcDebug()
public static void setHcDebug(boolean debug)
public static boolean isHcEnable()
public static void setHcEnable(boolean enable)
public static int initHardCoder(java.lang.String remote, int port, java.lang.String local, HardCoderJNI.HCPerfManagerThread hcPerfManagerThread, HardCoderCallback.ConnectStatusCallback callback)
setHcEnable(boolean)
setHcDebug(boolean)
}
must call before startPerformance(int, int, int, int, int[], int, int, long, int, String)
remote
- server socket name, default readServerAddr()
port
- server portlocal
- local socket name, default CLIENT_SOCK
hcPerfManagerThread
- the thread to run HcPerfManager, could be nullcallback
- callback the connect resultpublic static long checkPermission(java.lang.String[] manufactures, java.lang.String[] certs, HardCoderCallback.FuncRetCallback callback)
initHardCoder(String, int, String, HCPerfManagerThread, HardCoderCallback.ConnectStatusCallback)
after initHardCoder callback, to sure that socket is connected connect
manufactures
- manufacture name listcerts
- certification string list that you get from the corresponding manufacturecallback
- callback when server return yes/nopublic static int startPerformance(int delay, int cpuLevel, int ioLevel, int tid, int timeout, int scene, long action, int callerTid, java.lang.String tag)
startPerformance(int, int, int, int, int[], int, int, long, int, String)
stopPerformance(int)
public static int startPerformance(int delay, int cpuLevel, int ioLevel, int gpuLevel, int[] tids, int timeout, int scene, long action, int callerTid, java.lang.String tag)
initHardCoder(String, int, String, HCPerfManagerThread, HardCoderCallback.ConnectStatusCallback)
delay
- ms, how long will the task delay to excutecpuLevel
- request CPU level, CPU_LEVEL_0
ioLevel
- request IO level, IO_LEVEL_0
gpuLevel
- request GPU level, GPU_LEVEL_0
tids
- the threads need to bind coretimeout
- ms, how long will the task expirescene
- app scene, like APP_SCENE_STARTUP
action
- app action, retain value, useless nowcallerTid
- the thread call this tasktag
- tagstopPerformance(int)
public static int stopPerformance(int hashCode)
hashCode
- the return value for startPerformance(int, int, int, int, int[], int, int, long, int, String)
ERROR_CODE_SUCCESS
, and fail ERROR_CODE_FAILED
public static void onData(int callbackType, long requestId, long timestamp, int retCode, int funcId, int dataType, byte[] buffer)
callbackType
- callbackType, CALLBACK_TYPE_BASE
requestId
- request idtimestamp
- timestampretCode
- ret, whether success or failfuncId
- function id, FUNC_BASE
dataType
- callback buffer typebuffer
- return paramspublic static long checkPermission(java.lang.String[] manufactures, java.lang.String[] certs, int pid, int uid, int tid, long timestamp)
public static long requestCpuHighFreq(int scene, long action, int level, int timeoutms, int tid, long timestamp)
public static long cancelCpuHighFreq(int tid, long timestamp)
public static long requestGpuHighFreq(int scene, long action, int level, int timeoutms, int tid, long timestamp)
public static long cancelGpuHighFreq(int tid, long timestamp)
public static long configure(byte[] data, int tid, long timestamp)
public static long requestCpuCoreForThread(int scene, long action, int[] bindtids, int timeoutms, int tid, long timestamp)
public static long cancelCpuCoreForThread(int[] bindtids, int tid, long timestamp)
public static long requestHighIOFreq(int scene, long action, int level, int timeoutms, int tid, long timestamp)
public static long cancelHighIOFreq(int tid, long timestamp)
public static long requestScreenResolution(int level, java.lang.String uiName, int tid, long timestamp)
public static long resetScreenResolution(int tid, long timestamp)
public static long registerANRCallback(int tid, long timestamp)
public static long registerSystemEventCallback(int tid, long timestamp)
public static long registerBootPreloadResource(java.lang.String[] files, int tid, long timestamp)
public static long terminateApp(int tid, long timestamp)
public static long requestUnifyCpuIOThreadCoreGpu(int scene, long action, int cpulevel, int gpulevel, int iolevel, int[] bindtids, int timeoutms, int tid, long timestamp)
public static long cancelUnifyCpuIOThreadCoreGpu(boolean cancelcpu, boolean cancelgpu, boolean cancelio, boolean cancelthread, int[] bindtids, int tid, long timestamp)
public static void setRetryConnectInterval(int interval)
public static int startTraceCpuLoad(int linuxTid, int sampleRate)
public static int stopTraceCpuLoad(int id)
public static int isRunning()
public static long getParameters(byte[] data, int tid, long timestamp)
public static java.lang.String readServerAddr()
public static void putRequestStatusHashMap(long requestId, HardCoderCallback.RequestStatus requestStatus)
public static void putFuncRetHashMap(long requestId, HardCoderCallback.FuncRetCallback callback)
public static void onRequestCallback(int callbackType, long requestId, int retCode, int funcId, int dataType, byte[] buffer)
public static long registerANRCallback(HardCoderJNI.AnrCallback callback)
public static void setSceneReportCallback(HardCoderCallback.SceneReportCallback callback)