1 /* 2 * Copyright (c) 2024 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 RS_PROFILER_TELEMETRY_H 17 #define RS_PROFILER_TELEMETRY_H 18 19 #include <string> 20 21 namespace OHOS::Rosen { 22 23 struct FrequencyLoadInfo final { 24 float current = 0.0f; 25 float min = 0.0f; 26 float max = 0.0f; 27 float load = 0.0f; 28 }; 29 30 struct GPUInfo final { 31 FrequencyLoadInfo frequencyLoad; 32 }; 33 34 struct CPUInfo final { 35 static constexpr uint32_t MAX_CORES = 16u; 36 FrequencyLoadInfo coreFrequencyLoad[MAX_CORES]; 37 uint32_t cores = 0u; 38 float temperature = 0.0f; 39 float current = 0.0f; 40 float voltage = 0.0f; 41 uint64_t ramTotal = 0u; 42 uint64_t ramFree = 0u; 43 }; 44 45 struct DeviceInfo final { 46 CPUInfo cpu; 47 GPUInfo gpu; 48 }; 49 50 class RSTelemetry final { 51 public: 52 static const DeviceInfo& GetDeviceInfo(); 53 static std::string GetDeviceInfoString(); 54 static std::string GetDeviceFrequencyString(); 55 static std::string GetCpuAffinityString(); 56 }; 57 58 } // namespace OHOS::Rosen 59 60 #endif // RS_PROFILER_TELEMETRY_H