1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023. 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 #ifndef PARSESLIDEFPSTRACE_H 16 #define PARSESLIDEFPSTRACE_H 17 #include <iostream> 18 #include <fstream> 19 #include <string> 20 #include <vector> 21 22 namespace OHOS { 23 namespace SmartPerf { 24 class ParseSlideFpsTrace { 25 public: 26 double ParseSlideFpsTraceNoh(std::string file); 27 double CalculateTime(); 28 void GetLastCompleteLine(); 29 std::string GetLineTime(std::string lineStr) const; 30 std::string CutString(std::string lineStr, std::string start, std::string end, size_t offset) const; 31 private: 32 std::ifstream infile; 33 std::string responseLine = ""; 34 std::string newCompleteLine = ""; 35 std::string lastCompleteLine = ""; 36 std::string completeLine = ""; 37 bool needUpdateResponseLine = false; 38 int frameNum = 0; 39 int frameNow = 0; 40 int count = 0; 41 int four = 4; 42 bool updateCount = false; 43 double frameRate = 0; 44 }; 45 } 46 } 47 #endif // SMARTPERF_COMMAND_H