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(const std::string& file); 27 double CalculateTime(); 28 std::string GetLineTime(const std::string& lineStr) const; 29 std::string CutString(const std::string& lineStr, const std::string &start, 30 const std::string &end, size_t offset) const; 31 void AppSwiperScroll(const std::string& line); 32 private: 33 std::ifstream infile; 34 bool needTime = false; 35 int frameNum = 0; 36 int frameNow = 0; 37 int count = 0; 38 int four = 4; 39 double touchTime = 0; 40 double responseTime = 0; 41 double doCompositionTime = 0; 42 double completionTime = 0.035; 43 double completeTime = 0; 44 int swiperScrollFlag = 0; 45 int swiperFlingFlag = 0; 46 int listFlag = 0; 47 }; 48 } 49 } 50 #endif // SMARTPERF_COMMAND_H