1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 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 TRACE_MEMORY_DUMP_H 17 #define TRACE_MEMORY_DUMP_H 18 19 #include "impl_interface/trace_memory_dump_impl.h" 20 #include "memory/rs_dfx_string.h" 21 22 namespace OHOS { 23 namespace Rosen { 24 namespace Drawing { 25 class TraceMemoryDump { 26 public: 27 TraceMemoryDump(const char* categoryKey, bool itemizeType); ~TraceMemoryDump()28 ~TraceMemoryDump() {} 29 30 void DumpNumericValue(const char* dumpName, const char* valueName, const char* units, uint64_t value); 31 32 void DumpStringValue(const char* dumpName, const char* valueName, const char* value); 33 34 void LogOutput(OHOS::Rosen::DfxString& log); 35 36 void LogTotals(OHOS::Rosen::DfxString& log); 37 38 float GetGpuMemorySizeInMB() const; 39 40 float GetGLMemorySize() const; 41 42 template<typename T> GetImpl()43 T* GetImpl() const 44 { 45 return impl_->DowncastingTo<T>(); 46 } 47 private: 48 std::shared_ptr<TraceMemoryDumpImpl> impl_; 49 }; 50 } 51 } 52 } 53 #endif // TRACE_MEMORY_DUMP_H