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

Method requestCpuHighFreq

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

Source from the content-addressed store, hash-verified

613 }
614
615 int64_t requestCpuHighFreq(int scene, int64_t action, int level, int timeoutms, int tid, int64_t timestamp) {
616 IClientEngine *pEngine = engine();
617 if (!pEngine) {
618 return -3;
619 }
620
621 int64_t requestid = 0L;
622 if (HEADER_VERSION >= HEADER_JSON_VERSION) {//json
623 cJSON *jsonRequest;
624 jsonRequest = cJSON_CreateObject();
625 cJSON_AddNumberToObject(jsonRequest, "jsonVersion", JSON_VERSION);
626 cJSON_AddNumberToObject(jsonRequest, "funcid", FUNC_CPU_HIGH_FREQ);
627 cJSON_AddNumberToObject(jsonRequest, "status", STATUS_REQUEST);
628 cJSON_AddNumberToObject(jsonRequest, "scene", scene);
629 cJSON_AddNumberToObject(jsonRequest, "action", action);
630 cJSON_AddNumberToObject(jsonRequest, "cpulevel", level);
631 cJSON_AddNumberToObject(jsonRequest, "timeoutMs", timeoutms);
632
633 char *body = cJSON_Print(jsonRequest);
634 std::string str(body);
635 uint32_t len = str.length();
636 cJSON_Delete(jsonRequest);
637 requestid = pEngine ->sendReq(FUNC_CPU_HIGH_FREQ, (uint8_t *)body, len, tid, timestamp);
638 free(body);
639
640 } else {
641 amc::RequestCPUHighFreq request;
642 request.set_scene(scene);
643 request.set_level(level);
644 request.set_timeoutms(timeoutms);
645 request.set_action(action);
646 uint32_t len = request.ByteSize();
647 uint8_t body[len];
648 request.SerializeToArray(body, len);
649
650 requestid = pEngine->sendReq(FUNC_CPU_HIGH_FREQ, body, len, tid, timestamp);
651 }
652
653 pdbg("requestCpuHighFreq requestid:%lld, scene:%d, action:%d, level:%d, timeoutms:%d, tid:%d, timestamp:%d" ,
654 requestid, scene, TOINT(action), level, timeoutms, tid, TOINT(timestamp/1000000L));
655 return requestid;
656 }
657
658 int64_t cancelCpuHighFreq(int tid, int64_t timestamp) {
659 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