MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / requestHighIOFreq

Method requestHighIOFreq

libapp2sys/src/main/cpp/protocol.h:857–897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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();

Callers

nothing calls this directly

Calls 6

cJSON_CreateObjectFunction · 0.85
cJSON_AddNumberToObjectFunction · 0.85
cJSON_PrintFunction · 0.85
cJSON_DeleteFunction · 0.85
ByteSizeMethod · 0.80
sendReqMethod · 0.45

Tested by

no test coverage detected