• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef ANIMATION_STDTYPE_H
17 #define ANIMATION_STDTYPE_H
18 #include <regex>
19 #include "base_stdtype.h"
20 #include "string_to_numerical.h"
21 
22 namespace SysTuning {
23 namespace TraceStdtype {
24 constexpr uint8_t DEVICEINFO_MATCH_LAST = 2;
25 class Animation {
26 public:
27     TableRowId AppendAnimation(InternalTime inputTime, InternalTime startPoint, DataIndex nameIndex);
28     void UpdateStartPoint(TableRowId index, InternalTime startPoint);
29     void UpdateEndPoint(TableRowId index, InternalTime endPoint);
30     void UpdateFrameInfo(TableRowId index, InternalTime frameInfo);
31     size_t Size() const;
32     const std::deque<InternalTime> &InputTimes() const;
33     const std::deque<InternalTime> &StartPoints() const;
34     const std::deque<InternalTime> &EndPoints() const;
35     const std::deque<DataIndex> &FrameInfos() const;
36     const std::deque<DataIndex> &Names() const;
37     const std::deque<uint64_t> &IdsData() const;
38     void Clear();
39 
40 private:
41     std::deque<InternalTime> inputTimes_ = {};
42     std::deque<InternalTime> startPoints_ = {};
43     std::deque<InternalTime> endPoins_ = {};
44     std::deque<DataIndex> frameInfos_ = {};
45     std::deque<DataIndex> names_ = {};
46     std::deque<uint64_t> ids_ = {};
47 };
48 
49 class DeviceInfo {
50 public:
51     uint32_t PhysicalWidth() const;
52     uint32_t PhysicalHeight() const;
53     uint32_t PhysicalFrameRate() const;
54     void UpdateWidthAndHeight(const std::smatch &matcheLine);
55     void UpdateFrameRate(uint32_t frameRate);
56     void Clear();
57 
58 private:
59     uint32_t physicalWidth_ = INVALID_UINT32;
60     uint32_t physicalHeight_ = INVALID_UINT32;
61     uint32_t physicalFrameRate_ = INVALID_UINT32;
62 };
63 
64 class DynamicFrame {
65 public:
66     TableRowId AppendDynamicFrame(DataIndex nameId, const std::smatch &matcheLine, DataIndex alpha);
67     void UpdateNameIndex(TableRowId index, DataIndex nameId);
68     void UpdateEndTime(TableRowId index, InternalTime endTime);
69 
70     size_t Size() const;
71     const std::deque<uint64_t> &IdsData() const;
72     const std::deque<uint32_t> &Xs() const;
73     const std::deque<uint32_t> &Ys() const;
74     const std::deque<uint32_t> &Widths() const;
75     const std::deque<uint32_t> &Heights() const;
76     const std::deque<DataIndex> &Alphas() const;
77     const std::deque<DataIndex> &Names() const;
78     const std::deque<InternalTime> &EndTimes() const;
79     void Clear();
80 
81 private:
82     std::deque<uint32_t> xs_ = {};
83     std::deque<uint32_t> ys_ = {};
84     std::deque<uint32_t> widths_ = {};
85     std::deque<uint32_t> heights_ = {};
86     std::deque<DataIndex> alphas_ = {};
87     std::deque<DataIndex> names_ = {};
88     std::deque<InternalTime> endTimes_ = {};
89     std::deque<uint64_t> ids_ = {};
90 };
91 } // namespace TraceStdtype
92 } // namespace SysTuning
93 #endif // ANIMATION_STDTYPE_H
94