Skip to content

Commit 96958fc

Browse files
authored
Modify "Retune" Requests Handling (#150)
--- Signed-off-by: Kartik Nema <kartnema@qti.qualcomm.com>
1 parent d550f9c commit 96958fc

7 files changed

Lines changed: 23 additions & 24 deletions

File tree

modula/Components/Include/Logger.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ enum CommonMessageTypes {
111111
NOTIFY_RESMODE_REJECT,
112112
NOTIFY_CLASSIFIER_PROC_EVENT,
113113
NOTIFY_CLASSIFIER_PROC_IGNORE,
114+
NOTIFY_MODEL_PREDICTION,
114115
};
115116

116117
/**

modula/Components/Logger.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,14 @@ void Logger::typeLog(CommonMessageTypes type, const std::string& funcName, ...)
731731
Logger::log(LOG_DEBUG, "CONTEXTUAL_CLASSIFIER", funcName, buffer);
732732
break;
733733

734+
case CommonMessageTypes::NOTIFY_MODEL_PREDICTION:
735+
vsnprintf(buffer, sizeof(buffer),
736+
"Prediction complete. PID: %d, Comm: %s, Class: %s, "\
737+
"Probability: %.4f", args);
738+
739+
Logger::log(LOG_INFO, "CONTEXTUAL_CLASSIFIER", funcName, buffer);
740+
break;
741+
734742
default:
735743
break;
736744
}

resource-tuner/core/Include/RequestManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ class RequestManager {
126126
*/
127127
int8_t disableRequestProcessing(int64_t handle);
128128

129-
void modifyRequestDuration(int64_t handle, int64_t duration);
130-
131129
void markRequestAsComplete(int64_t handle);
132130

133131
int8_t getRequestProcessingStatus(int64_t handle);

resource-tuner/core/RequestHandler.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ static void processIncomingRequest(Request* request, int8_t isValidated=false) {
266266
request->getRequestType() == REQ_RESOURCE_RETUNING) {
267267
// Note: Client Data Manager initialisation is not necessary for Untune / Retune Requests,
268268
// since the client is expected to be allocated already (as part of the Tune Request)
269+
if(!clientDataManager->clientExists(request->getClientPID(), request->getClientTID())) {
270+
// Client does not exist, drop the request
271+
Request::cleanUpRequest(request);
272+
return;
273+
}
274+
269275
if(request->getRequestType() == REQ_RESOURCE_UNTUNING) {
270276
// Update the Processing Status for this handle to false
271277
// This handles the Edge Case where the Client sends the Untune Request immediately.
@@ -278,16 +284,6 @@ static void processIncomingRequest(Request* request, int8_t isValidated=false) {
278284
Request::cleanUpRequest(request);
279285
return;
280286
}
281-
} else {
282-
// Done for handling Edge Cases,
283-
// Refer the comment in the if-block for more explanation
284-
requestManager->modifyRequestDuration(request->getHandle(), request->getDuration());
285-
}
286-
287-
if(!clientDataManager->clientExists(request->getClientPID(), request->getClientTID())) {
288-
// Client does not exist, drop the request
289-
Request::cleanUpRequest(request);
290-
return;
291287
}
292288
}
293289

resource-tuner/core/RequestManager.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,6 @@ int8_t RequestManager::disableRequestProcessing(int64_t handle) {
224224
return true;
225225
}
226226

227-
void RequestManager::modifyRequestDuration(int64_t handle, int64_t duration) {
228-
(void)handle;
229-
(void)duration;
230-
return;
231-
}
232-
233227
int64_t RequestManager::getActiveReqeustsCount() {
234228
this->mRequestMapMutex.lock_shared();
235229
int32_t size = this->mActiveRequests.size();

resource-tuner/core/RequestQueue.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ void RequestQueue::orderedQueueConsumerHook() {
7777

7878
} else if(req->getRequestType() == REQ_RESOURCE_RETUNING) {
7979
int64_t newDuration = req->getDuration();
80-
cocoTable->updateRequest(matchingTuneReq.first, newDuration);
80+
81+
if((processingStatus & REQ_COMPLETED) == 0) {
82+
// Request not in Coco Table yet
83+
// Update the Request Duration directly.
84+
matchingTuneReq.first->setDuration(newDuration);
85+
} else {
86+
cocoTable->updateRequest(matchingTuneReq.first, newDuration);
87+
}
8188

8289
// Free Up the Retune Request
8390
Request::cleanUpRequest(req);

resource-tuner/core/ResourceHooks.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,6 @@ static void resetRunOnCoresExclusively(void* context) {
682682
}
683683
}
684684

685-
static void no_op(void* context) {
686-
(void)context;
687-
return;
688-
}
689-
690685
static void setPmQos(void* context) {
691686
if(context == nullptr) return;
692687
Resource* resource = static_cast<Resource*>(context);

0 commit comments

Comments
 (0)