Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff778699 authored by hkuang's avatar hkuang
Browse files

transcoding: Add more information to dumpsys.

Showing all the jobs in queue.

Bug: 154733526
Test: Use snapchat to simuluate multiple transcoding jobs and dumpsys.
Change-Id: I37aa9d15fe9243598d068eb3aac7ecc2e80d6ccf
parent 48e2b36f
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -53,6 +53,38 @@ TranscodingJobScheduler::TranscodingJobScheduler(

TranscodingJobScheduler::~TranscodingJobScheduler() {}

void TranscodingJobScheduler::dumpAllJobs(int fd, const Vector<String16>& args __unused) {
    String8 result;

    const size_t SIZE = 256;
    char buffer[SIZE];
    std::scoped_lock lock{mLock};

    snprintf(buffer, SIZE, " \n\n   Total num of Jobs: %zu\n", mJobMap.size());
    result.append(buffer);

    if (mJobMap.size() > 0) {
        snprintf(buffer, SIZE, "========== Dumping all jobs =========\n");
        result.append(buffer);
    }

    for (auto uidIt = mUidSortedList.begin(); uidIt != mUidSortedList.end(); uidIt++) {
        for (auto jobIt = mJobQueues[*uidIt].begin(); jobIt != mJobQueues[*uidIt].end(); jobIt++) {
            if (mJobMap.count(*jobIt) != 0) {
                TranscodingRequestParcel& request = mJobMap[*jobIt].request;
                snprintf(buffer, SIZE, "Job: %s Client: %d\n", request.sourceFilePath.c_str(),
                         request.clientUid);

            } else {
                snprintf(buffer, SIZE, "Failed to look up Job %s  \n", jobToString(*jobIt).c_str());
            }
            result.append(buffer);
        }
    }

    write(fd, result.string(), result.size());
}

TranscodingJobScheduler::Job* TranscodingJobScheduler::getTopJob_l() {
    if (mJobMap.empty()) {
        return nullptr;
+6 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <media/TranscodingRequest.h>
#include <media/UidPolicyInterface.h>
#include <utils/String8.h>
#include <utils/Vector.h>

#include <list>
#include <map>
@@ -66,6 +67,11 @@ public:
    void onResourceAvailable() override;
    // ~ResourcePolicyCallbackInterface

    /**
     * Dump all the job information to the fd.
     */
    void dumpAllJobs(int fd, const Vector<String16>& args);

private:
    friend class MediaTranscodingService;
    friend class TranscodingJobSchedulerTest;
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ binder_status_t MediaTranscodingService::dump(int fd, const char** /*args*/, uin

    Vector<String16> args;
    mClientManager->dumpAllClients(fd, args);
    mJobScheduler->dumpAllJobs(fd, args);
    return OK;
}