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