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

Commit 80bb88e5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add blob cache related tracepoints" into udc-dev am: 16f61146

parents f8975574 16f61146
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include "BlobCache.h"

@@ -22,6 +23,7 @@
#include <errno.h>
#include <inttypes.h>
#include <log/log.h>
#include <utils/Trace.h>

#include <chrono>

@@ -230,6 +232,8 @@ int BlobCache::flatten(void* buffer, size_t size) const {
}

int BlobCache::unflatten(void const* buffer, size_t size) {
    ATRACE_NAME("BlobCache::unflatten");

    // All errors should result in the BlobCache being in an empty state.
    clear();

@@ -293,6 +297,8 @@ long int BlobCache::blob_random() {
}

void BlobCache::clean() {
    ATRACE_NAME("BlobCache::clean");

    // Remove a random cache entry until the total cache size gets below half
    // the maximum total cache size.
    while (mTotalSize > mMaxTotalSize / 2) {
+7 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
 ** limitations under the License.
 */

#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include "FileBlobCache.h"

#include <errno.h>
@@ -24,6 +26,7 @@
#include <unistd.h>

#include <log/log.h>
#include <utils/Trace.h>

// Cache file header
static const char* cacheFileMagic = "EGL$";
@@ -51,6 +54,8 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT
        const std::string& filename)
        : BlobCache(maxKeySize, maxValueSize, maxTotalSize)
        , mFilename(filename) {
    ATRACE_CALL();

    if (mFilename.length() > 0) {
        size_t headerSize = cacheFileHeaderSize;

@@ -117,6 +122,8 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT
}

void FileBlobCache::writeToFile() {
    ATRACE_CALL();

    if (mFilename.length() > 0) {
        size_t cacheSize = getFlattenedSize();
        size_t headerSize = cacheFileHeaderSize;