| 855 | } |
| 856 | |
| 857 | int64_t requestHighIOFreq(int scene, int64_t action, int level, int timeoutms, int tid, int64_t timestamp) { |
| 858 | IClientEngine *pEngine = engine(); |
| 859 | if (!pEngine) { |
| 860 | return -3; |
| 861 | } |
| 862 | int64_t requestid = 0L; |
| 863 | if (HEADER_VERSION >= HEADER_JSON_VERSION) {//json |
| 864 | cJSON *jsonRequest; |
| 865 | jsonRequest = cJSON_CreateObject(); |
| 866 | cJSON_AddNumberToObject(jsonRequest, "jsonVersion", JSON_VERSION); |
| 867 | cJSON_AddNumberToObject(jsonRequest, "funcid", FUNC_HIGH_IO_FREQ); |
| 868 | cJSON_AddNumberToObject(jsonRequest, "status", STATUS_REQUEST); |
| 869 | cJSON_AddNumberToObject(jsonRequest, "scene", scene); |
| 870 | cJSON_AddNumberToObject(jsonRequest, "action", action); |
| 871 | cJSON_AddNumberToObject(jsonRequest, "iolevel", level); |
| 872 | cJSON_AddNumberToObject(jsonRequest, "timeoutMs", timeoutms); |
| 873 | |
| 874 | |
| 875 | char *body = cJSON_Print(jsonRequest); |
| 876 | std::string str(body); |
| 877 | uint32_t len = str.length(); |
| 878 | cJSON_Delete(jsonRequest); |
| 879 | requestid = pEngine ->sendReq(FUNC_HIGH_IO_FREQ, (uint8_t *)body, len, tid, timestamp); |
| 880 | free(body); |
| 881 | |
| 882 | } else { |
| 883 | amc::RequestHighIOFreq request; |
| 884 | request.set_scene(scene); |
| 885 | request.set_level(level); |
| 886 | request.set_timeoutms(timeoutms); |
| 887 | request.set_action(action); |
| 888 | uint32_t len = request.ByteSize(); |
| 889 | uint8_t body[len]; |
| 890 | request.SerializeToArray(body, len); |
| 891 | |
| 892 | requestid = pEngine->sendReq(FUNC_HIGH_IO_FREQ, body, len, tid, timestamp); |
| 893 | } |
| 894 | pdbg("requestCpuCoreForThread requestid:%lld, scene:%d, action:%d, level:%d, timeoutms:%d", requestid, scene, TOINT(action), level, timeoutms); |
| 895 | return requestid; |
| 896 | |
| 897 | } |
| 898 | |
| 899 | int64_t cancelHighIOFreq(int tid, uint64_t timestamp) { |
| 900 | IClientEngine *pEngine = engine(); |
nothing calls this directly
no test coverage detected