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 ANIMATION_FILTER_H 17 #define ANIMATION_FILTER_H 18 19 #include <unordered_map> 20 #include "common_types.h" 21 #include "filter_base.h" 22 #include "trace_streamer_filters.h" 23 24 namespace SysTuning { 25 namespace TraceStreamer { 26 class AnimationFilter : private FilterBase { 27 public: 28 AnimationFilter(TraceDataCache* dataCache, const TraceStreamerFilters* filter); 29 ~AnimationFilter() override; 30 bool UpdateDeviceInfoEvent(const TracePoint& point, const BytraceLine& line); 31 bool BeginDynamicFrameEvent(const TracePoint& point, size_t callStackRow); 32 void StartAnimationEvent(const BytraceLine& line, size_t callStackRow); 33 bool FinishAnimationEvent(const BytraceLine& line, size_t callStackRow); 34 void UpdateDynamicFrameInfo(); 35 void Clear(); 36 37 private: 38 bool UpdateDeviceFps(const BytraceLine& line); 39 bool UpdateDeviceScreenSize(const TracePoint& point); 40 bool UpdateDynamicEndTime(const uint64_t curFrameRow, uint64_t curStackRow); 41 const std::string generateVsyncCmd_ = "H:GenerateVsyncCount"; 42 const std::string leashWindowCmd_ = "H:RSUniRender::Process:[leashWindow"; 43 const std::string rsUniProcessCmd_ = "H:RSUniRender::Process:["; 44 const DataIndex rsDoCompCmd_ = traceDataCache_->GetDataIndex("H:RSMainThread::DoComposition"); 45 const DataIndex entryViewCmd_ = traceDataCache_->GetDataIndex("H:RSUniRender::Process:[EntryView]"); 46 // for update dynamicFrameInfo at the end, first is callStackRow, second is dynamicFramRow 47 std::map<uint64_t, uint64_t> callStackRowMap_ = {}; 48 // for update animationInfo, first is callStackRow, second is animationRow 49 std::unordered_map<uint64_t, uint64_t> animationCallIds_ = {}; 50 uint64_t generateFirstTime_ = INVALID_UINT64; 51 uint8_t generateVsyncCnt_ = 0; 52 DynamicFrame* dynamicFrame_ = nullptr; 53 CallStack* callStackSlice_ = nullptr; 54 }; 55 } // namespace TraceStreamer 56 } // namespace SysTuning 57 #endif // ANIMATION_FILTER_H 58