1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd.. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SKIA_TRACE_MEMORY_DUMP_H 17 #define SKIA_TRACE_MEMORY_DUMP_H 18 19 #include "impl_interface/trace_memory_dump_impl.h" 20 #include "image/trace_memory_dump.h" 21 #include "include/core/SkTraceMemoryDump.h" 22 #include "rs_skia_memory_tracer.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 namespace Drawing { 27 class SkiaTraceMemoryDump : public TraceMemoryDumpImpl { 28 public: 29 static inline constexpr AdapterType TYPE = AdapterType::SKIA_ADAPTER; 30 31 SkiaTraceMemoryDump(const char* categoryKey, bool itemizeType); 32 virtual ~SkiaTraceMemoryDump() = default; 33 GetType()34 AdapterType GetType() const override 35 { 36 return AdapterType::SKIA_ADAPTER; 37 } 38 39 void DumpNumericValue(const char* dumpName, const char* valueName, const char* units, uint64_t value) override; 40 41 void DumpStringValue(const char* dumpName, const char* valueName, const char* value) override; 42 43 void LogOutput(OHOS::Rosen::DfxString& log) override; 44 45 void LogTotals(OHOS::Rosen::DfxString& log) override; 46 47 float GetGpuMemorySizeInMB() const override; 48 49 float GetGLMemorySize() const override; 50 51 std::shared_ptr<SkiaMemoryTracer> GetTraceMemoryDump() const; 52 53 protected: 54 std::shared_ptr<SkiaMemoryTracer> skiaMemoryTrace_; 55 }; 56 } 57 } 58 } 59 60 #endif // SKIA_TRACE_MEMORY_DUMP_H 61