| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include <SkString.h> |
| 20 |
#include <SkTraceMemoryDump.h> |
| 21 |
|
| 22 |
#include <string> |
| 23 |
#include <unordered_map> |
| 24 |
#include <utility> |
| 25 |
|
| 26 |
namespace android { |
| 27 |
namespace uirenderer { |
| 28 |
namespace skiapipeline { |
| 29 |
|
| 30 |
class ATraceMemoryDump : public SkTraceMemoryDump { |
| 31 |
public: |
| 32 |
ATraceMemoryDump(); |
| 33 |
~ATraceMemoryDump() override {} |
| 34 |
|
| 35 |
void dumpNumericValue(const char* dumpName, const char* valueName, const char* units, |
| 36 |
uint64_t value) override; |
| 37 |
|
| 38 |
void dumpStringValue(const char* dumpName, const char* valueName, const char* value) override; |
| 39 |
|
| 40 |
LevelOfDetail getRequestedDetails() const override { |
| 41 |
return SkTraceMemoryDump::kLight_LevelOfDetail; |
| 42 |
} |
| 43 |
|
| 44 |
bool shouldDumpWrappedObjects() const override { return false; } |
| 45 |
|
| 46 |
void setMemoryBacking(const char* dumpName, const char* backingType, |
| 47 |
const char* backingObjectId) override; |
| 48 |
|
| 49 |
void setDiscardableMemoryBacking(const char*, const SkDiscardableMemory&) override {} |
| 50 |
|
| 51 |
void startFrame(); |
| 52 |
|
| 53 |
void logTraces(); |
| 54 |
|
| 55 |
private: |
| 56 |
std::string mLastDumpName; |
| 57 |
|
| 58 |
uint64_t mLastDumpValue; |
| 59 |
|
| 60 |
uint64_t mLastPurgeableDumpValue; |
| 61 |
|
| 62 |
std::string mCategory; |
| 63 |
|
| 64 |
struct TraceValue { |
| 65 |
uint64_t memory; |
| 66 |
uint64_t purgeableMemory; |
| 67 |
}; |
| 68 |
|
| 69 |
|
| 70 |
std::unordered_map<std::string, TraceValue> mCurrentValues; |
| 71 |
|
| 72 |
void recordAndResetCountersIfNeeded(const char* dumpName); |
| 73 |
|
| 74 |
void resetCurrentCounter(const char* dumpName); |
| 75 |
}; |
| 76 |
|
| 77 |
} |
| 78 |
} |
| 79 |
} |