1 /* 2 * Copyright (C) 2021 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 GPU_H 17 #define GPU_H 18 #include <vector> 19 #include "sp_profiler.h" 20 namespace OHOS { 21 namespace SmartPerf { 22 class GPU : public SpProfiler { 23 public: 24 std::map<std::string, std::string> ItemData() override; GetInstance()25 static GPU &GetInstance() 26 { 27 static GPU instance; 28 return instance; 29 } 30 int GetGpuFreq(); 31 float GetGpuLoad(); 32 33 private: GPU()34 GPU() {}; 35 GPU(const GPU &); 36 GPU &operator = (const GPU &); 37 38 const std::vector<std::string> gpuCurFreqPaths = { 39 "/sys/class/devfreq/fde60000.gpu/cur_freq", // rk3568 40 "/sys/class/devfreq/gpufreq/cur_freq", // wgr 41 }; 42 const std::vector<std::string> gpuCurLoadPaths = { 43 "/sys/class/devfreq/gpufreq/gpu_scene_aware/utilisation", // wgr 44 "/sys/class/devfreq/fde60000.gpu/load", // rk3568 45 }; 46 }; 47 } 48 } 49 #endif // GPU_H 50