CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
clone_CloneProfilerBase.h
1 /*--------------------------------------------------------------------------------*
2  Copyright (C)Nintendo All rights reserved.
3 
4  These coded instructions, statements, and computer programs contain proprietary
5  information of Nintendo and/or its licensed developers and are protected by
6  national and international copyright laws. They may not be disclosed to third
7  parties or copied or duplicated in any form, in whole or in part, without the
8  prior written consent of Nintendo.
9 
10  The content herein is highly confidential and should be handled accordingly.
11  *--------------------------------------------------------------------------------*/
12 
13 
14 #pragma once
15 
16 #include <nn/pia/clone/clone_Definitions.h>
17 #include <nn/pia/pia_Macros.h>
18 
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace clone
25 {
26 class CloneProtocol;
27 
28 /*!
29  @brief PiaClone のプロファイリング管理クラスの基底クラスです。
30  */
32 {
33 public:
34  enum ProfileTargetType
35  {
36  ProfileTargetType_None = 0,
37  ProfileTargetType_CloneProtocol,
38  ProfileTargetType_Clone,
39  ProfileTargetType_CloneElement
40  };
41 
42  enum ProfileTargetDirection
43  {
44  ProfileTargetDirection_None = 0,
45  ProfileTargetDirection_Send,
46  ProfileTargetDirection_Receive
47  };
48 
49  /*!
50  @brief デバッグに有用な情報をプリントします。
51 
52  @param[in] flag トレースフラグの論理和。詳細は @ref TraceFlag 型を参照してください。
53  */
54  void Trace(uint64_t flag) const;
55 
56 
57  //! @cond PRIVATE
58 
59 public:
60  void Setup(ProfileTargetType type, ProfileTargetDirection direction);
61 
62  void Reset();
63 
64  bool IsProfileLatest() const
65  {
66  return (m_LatestBufferSize > 0);
67  }
68 
69  void ProfileByStationIndex(uint32_t dispatchCount, StationIndex stationIndex, uint32_t size, uint32_t noCompressedSize, bool isUnicast, bool isResend, bool isSystem);
70  void ProfileByStationBmp(uint32_t dispatchCount, uint32_t stationBmp, uint32_t size, uint32_t noCompressedSize, bool isUnicast, bool isResend, bool isSystem);
71 
72  bool IsNocompressedSupported() const;
73  bool IsUnicastSupported() const;
74  bool IsResendSupported() const;
75  bool IsSystemSupported() const;
76 
77  uint32_t GetLatestCount(StationIndex stationIndex, uint32_t dispatchCount) const;
78  uint32_t GetLatestSize(StationIndex stationIndex, uint32_t dispatchCount) const;
79  uint32_t GetLatestNoCompressedSize(StationIndex stationIndex, uint32_t dispatchCount) const;
80 
81  uint32_t GetLatestUnicastCount(StationIndex stationIndex, uint32_t dispatchCount) const;
82  uint32_t GetLatestUnicastSize(StationIndex stationIndex, uint32_t dispatchCount) const;
83 
84  uint32_t GetLatestResendCount(StationIndex stationIndex, uint32_t dispatchCount) const;
85  uint32_t GetLatestResendSize(StationIndex stationIndex, uint32_t dispatchCount) const;
86 
87  uint32_t GetLatestSystemCount(StationIndex stationIndex, uint32_t dispatchCount) const;
88  uint32_t GetLatestSystemSize(StationIndex stationIndex, uint32_t dispatchCount) const;
89 
90  uint32_t GetTotalCount(StationIndex stationIndex) const;
91  uint32_t GetTotalSize(StationIndex stationIndex) const;
92  uint32_t GetTotalNoCompressedSize(StationIndex stationIndex) const;
93 
94  uint32_t GetTotalUnicastCount(StationIndex stationIndex) const;
95  uint32_t GetTotalUnicastSize(StationIndex stationIndex) const;
96 
97  uint32_t GetTotalResendCount(StationIndex stationIndex) const;
98  uint32_t GetTotalResendSize(StationIndex stationIndex) const;
99 
100  uint32_t GetTotalSystemCount(StationIndex stationIndex) const;
101  uint32_t GetTotalSystemSize(StationIndex stationIndex) const;
102 
103  void Print(const CloneProtocol* pCloneProtocol) const;
104 
105 protected:
106  CloneProfilerBase(uint32_t* paDispatchCount, uint8_t* paCount, uint16_t* paSize, uint16_t* paNoCompressedSize, uint8_t* paUnicastCount, uint16_t* paUnicastSize, uint8_t* paResendCount, uint16_t* paResendSize, uint8_t* paSystemCount, uint16_t* paSystemSize, uint16_t* paTotalCount, uint32_t* paTotalSize, uint32_t* paTotalNoCompressedSize, uint16_t* paTotalUnicastCount, uint32_t* paTotalUnicastSize, uint16_t* paTotalResendCount, uint32_t* paTotalResendSize, uint16_t* paTotalSystemCount, uint32_t* paTotalSystemSize, uint32_t stationNum, uint32_t latestBufferSize);
107 
108 private:
109  uint32_t GetBufferIdx(uint32_t stationIndex, uint32_t idx) const
110  {
111  return stationIndex + idx * m_StationNum;
112  }
113 
114  void AssignBuffer(uint32_t dispatchCount);
115 
116  void AddProfileData(StationIndex stationIndex, uint32_t size, uint32_t noCompressedSize, bool isUnicast, bool isResend, bool isSystem);
117 
118  template <typename T>
119  uint32_t GetLatestData(const T* dataBuffer, StationIndex stationIndex, uint32_t dispatchCount) const;
120 
121  template <typename T>
122  uint32_t GetTotalData(const T* dataBuffer, StationIndex stationIndex) const;
123 
124 private:
125  ProfileTargetType m_ProfileTargetType;
126  ProfileTargetDirection m_ProfileTargetDirection;
127 
128  // Latest
129  uint32_t* m_paDispatchCount;
130  uint8_t* m_paCount;
131  uint16_t* m_paSize;
132  uint16_t* m_paNoCompressedSize;
133 
134  uint8_t* m_paUnicastCount; // Count 中
135  uint16_t* m_paUnicastSize; // Size 中
136 
137  uint8_t* m_paResendCount; // Count 中
138  uint16_t* m_paResendSize; // Size 中
139 
140  uint8_t* m_paSystemCount; // Count 中
141  uint16_t* m_paSystemSize; // Size 中
142 
143  // Total
144  uint16_t* m_paTotalCount;
145  uint32_t* m_paTotalSize;
146  uint32_t* m_paTotalNoCompressedSize;
147 
148  uint16_t* m_paTotalUnicastCount; // TotalCount 中
149  uint32_t* m_paTotalUnicastSize; // TotalSize 中
150 
151  uint16_t* m_paTotalResendCount; // TotalCount 中
152  uint32_t* m_paTotalResendSize; // TotalSize 中
153 
154  uint16_t* m_paTotalSystemCount; // TotalCount 中
155  uint32_t* m_paTotalSystemSize; // TotalSize 中
156 
157  //
158  uint32_t m_StationNum;
159  uint32_t m_LatestBufferSize;
160 
161  uint32_t m_CurrentIdx;
162 
163  NN_PIA_DISALLOW_COPY(CloneProfilerBase);
164  //! @endcond
165 };
166 }
167 }
168 } // end of namespace nn::pia::clone