Loading opengl/libs/EGL/BlobCache.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ */ //#define LOG_NDEBUG 0 //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include "BlobCache.h" #include "BlobCache.h" Loading @@ -22,6 +23,7 @@ #include <errno.h> #include <errno.h> #include <inttypes.h> #include <inttypes.h> #include <log/log.h> #include <log/log.h> #include <utils/Trace.h> #include <chrono> #include <chrono> Loading Loading @@ -230,6 +232,8 @@ int BlobCache::flatten(void* buffer, size_t size) const { } } int BlobCache::unflatten(void const* buffer, size_t size) { 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. // All errors should result in the BlobCache being in an empty state. clear(); clear(); Loading Loading @@ -293,6 +297,8 @@ long int BlobCache::blob_random() { } } void BlobCache::clean() { void BlobCache::clean() { ATRACE_NAME("BlobCache::clean"); // Remove a random cache entry until the total cache size gets below half // Remove a random cache entry until the total cache size gets below half // the maximum total cache size. // the maximum total cache size. while (mTotalSize > mMaxTotalSize / 2) { while (mTotalSize > mMaxTotalSize / 2) { Loading opengl/libs/EGL/FileBlobCache.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,8 @@ ** limitations under the License. ** limitations under the License. */ */ #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include "FileBlobCache.h" #include "FileBlobCache.h" #include <errno.h> #include <errno.h> Loading @@ -24,6 +26,7 @@ #include <unistd.h> #include <unistd.h> #include <log/log.h> #include <log/log.h> #include <utils/Trace.h> // Cache file header // Cache file header static const char* cacheFileMagic = "EGL$"; static const char* cacheFileMagic = "EGL$"; Loading Loading @@ -51,6 +54,8 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT const std::string& filename) const std::string& filename) : BlobCache(maxKeySize, maxValueSize, maxTotalSize) : BlobCache(maxKeySize, maxValueSize, maxTotalSize) , mFilename(filename) { , mFilename(filename) { ATRACE_CALL(); if (mFilename.length() > 0) { if (mFilename.length() > 0) { size_t headerSize = cacheFileHeaderSize; size_t headerSize = cacheFileHeaderSize; Loading Loading @@ -117,6 +122,8 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT } } void FileBlobCache::writeToFile() { void FileBlobCache::writeToFile() { ATRACE_CALL(); if (mFilename.length() > 0) { if (mFilename.length() > 0) { size_t cacheSize = getFlattenedSize(); size_t cacheSize = getFlattenedSize(); size_t headerSize = cacheFileHeaderSize; size_t headerSize = cacheFileHeaderSize; Loading Loading
opengl/libs/EGL/BlobCache.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ */ //#define LOG_NDEBUG 0 //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include "BlobCache.h" #include "BlobCache.h" Loading @@ -22,6 +23,7 @@ #include <errno.h> #include <errno.h> #include <inttypes.h> #include <inttypes.h> #include <log/log.h> #include <log/log.h> #include <utils/Trace.h> #include <chrono> #include <chrono> Loading Loading @@ -230,6 +232,8 @@ int BlobCache::flatten(void* buffer, size_t size) const { } } int BlobCache::unflatten(void const* buffer, size_t size) { 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. // All errors should result in the BlobCache being in an empty state. clear(); clear(); Loading Loading @@ -293,6 +297,8 @@ long int BlobCache::blob_random() { } } void BlobCache::clean() { void BlobCache::clean() { ATRACE_NAME("BlobCache::clean"); // Remove a random cache entry until the total cache size gets below half // Remove a random cache entry until the total cache size gets below half // the maximum total cache size. // the maximum total cache size. while (mTotalSize > mMaxTotalSize / 2) { while (mTotalSize > mMaxTotalSize / 2) { Loading
opengl/libs/EGL/FileBlobCache.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,8 @@ ** limitations under the License. ** limitations under the License. */ */ #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include "FileBlobCache.h" #include "FileBlobCache.h" #include <errno.h> #include <errno.h> Loading @@ -24,6 +26,7 @@ #include <unistd.h> #include <unistd.h> #include <log/log.h> #include <log/log.h> #include <utils/Trace.h> // Cache file header // Cache file header static const char* cacheFileMagic = "EGL$"; static const char* cacheFileMagic = "EGL$"; Loading Loading @@ -51,6 +54,8 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT const std::string& filename) const std::string& filename) : BlobCache(maxKeySize, maxValueSize, maxTotalSize) : BlobCache(maxKeySize, maxValueSize, maxTotalSize) , mFilename(filename) { , mFilename(filename) { ATRACE_CALL(); if (mFilename.length() > 0) { if (mFilename.length() > 0) { size_t headerSize = cacheFileHeaderSize; size_t headerSize = cacheFileHeaderSize; Loading Loading @@ -117,6 +122,8 @@ FileBlobCache::FileBlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxT } } void FileBlobCache::writeToFile() { void FileBlobCache::writeToFile() { ATRACE_CALL(); if (mFilename.length() > 0) { if (mFilename.length() > 0) { size_t cacheSize = getFlattenedSize(); size_t cacheSize = getFlattenedSize(); size_t headerSize = cacheFileHeaderSize; size_t headerSize = cacheFileHeaderSize; Loading