CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
clone_CloneProfiler.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/clone/clone_CloneProfilerBase.h>
18 #include <nn/pia/pia_Assert.h>
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace clone
25 {
26 
27 
28 /*!
29  @brief PiaClone のプロファイリング管理クラスです。
30 
31  @details CloneProfiler のインスタンスを CloneProtocol, CloneBase, CloneElementBase 登録することにより、
32  それぞれのインスタンスが行った送受信をプロファイリングする機能を追加します。
33  @details 同時にプロファイリングする CloneProtocol, CloneBase, CloneElementBase の各インスタンス毎に
34  個別の CloneProfiler インスタンスを使用する必要があります。
35 
36  @tparam STATION_NUM 計測するステーション数です。通常はセッションに参加する最大ステーション数を指定する必要があります。
37  @tparam LATEST_BUFFER_SIZE 直近の LATEST_BUFFER_SIZE 回の common::Scheduler::Dispatch() の間の送受信を計測します。
38  必要のない場合は 0 を指定する必要があります。
39 
40  @see CloneProtocol::SetProfiler, CloneBase::SetProfiler, CloneElementBase::SetProfiler
41  */
42 template <uint32_t STATION_NUM, uint32_t LATEST_BUFFER_SIZE>
44 {
45 public:
46  /*!
47  @brief デフォルトコンストラクタです。
48  */
51  (LATEST_BUFFER_SIZE > 0) ? m_DispatchCountBuffer : NULL,
52  (LATEST_BUFFER_SIZE > 0) ? m_CountBuffer : NULL,
53  (LATEST_BUFFER_SIZE > 0) ? m_SizeBuffer : NULL,
54  (LATEST_BUFFER_SIZE > 0) ? m_NoCompressedSizeBuffer : NULL,
55  (LATEST_BUFFER_SIZE > 0) ? m_UnicastCountBuffer : NULL,
56  (LATEST_BUFFER_SIZE > 0) ? m_UnicastSizeBuffer : NULL,
57  (LATEST_BUFFER_SIZE > 0) ? m_ResendCountBuffer : NULL,
58  (LATEST_BUFFER_SIZE > 0) ? m_ResendSizeBuffer : NULL,
59  (LATEST_BUFFER_SIZE > 0) ? m_SystemCountBuffer : NULL,
60  (LATEST_BUFFER_SIZE > 0) ? m_SystemSizeBuffer : NULL,
61  m_TotalCountBuffer,
62  m_TotalSizeBuffer,
63  m_TotalNoCompressedSizeBuffer,
64  m_TotalUnicastCountBuffer,
65  m_TotalUnicastSizeBuffer,
66  m_TotalResendCountBuffer,
67  m_TotalResendSizeBuffer,
68  m_TotalSystemCountBuffer,
69  m_TotalSystemSizeBuffer,
70  StationNum,
71  LATEST_BUFFER_SIZE)
72  {
73  PIA_COMPILE_ASSERT(STATION_NUM > 0);
74  };
75 
76  void Print(const CloneProtocol* pCloneProtocol) const
77  {
78  CloneProfilerBase::Print(pCloneProtocol);
79  }
80 
81 private:
82  static const int StationNum = STATION_NUM < 32 ? STATION_NUM : 32;
83 
84  // Latest
85  static const int DispatchCountBufferLength = LATEST_BUFFER_SIZE;
86  static const int CountBufferLength = LATEST_BUFFER_SIZE * StationNum;
87  static const int SizeBufferLength = LATEST_BUFFER_SIZE * StationNum;
88 
89  uint32_t m_DispatchCountBuffer[DispatchCountBufferLength];
90 
91  uint8_t m_CountBuffer[CountBufferLength];
92  uint16_t m_SizeBuffer[SizeBufferLength];
93  uint16_t m_NoCompressedSizeBuffer[SizeBufferLength];
94 
95  uint8_t m_UnicastCountBuffer[CountBufferLength];
96  uint16_t m_UnicastSizeBuffer[SizeBufferLength];
97 
98  uint8_t m_ResendCountBuffer[CountBufferLength];
99  uint16_t m_ResendSizeBuffer[SizeBufferLength];
100 
101  uint8_t m_SystemCountBuffer[CountBufferLength];
102  uint16_t m_SystemSizeBuffer[SizeBufferLength];
103 
104  // Total
105  static const int TotalCountBufferLength = StationNum;
106  static const int TotalSizeBufferLength = StationNum;
107 
108  uint16_t m_TotalCountBuffer[TotalCountBufferLength];
109  uint32_t m_TotalSizeBuffer[TotalSizeBufferLength];
110  uint32_t m_TotalNoCompressedSizeBuffer[TotalSizeBufferLength];
111 
112  uint16_t m_TotalUnicastCountBuffer[TotalCountBufferLength];
113  uint32_t m_TotalUnicastSizeBuffer[TotalSizeBufferLength];
114 
115  uint16_t m_TotalResendCountBuffer[TotalCountBufferLength];
116  uint32_t m_TotalResendSizeBuffer[TotalSizeBufferLength];
117 
118  uint16_t m_TotalSystemCountBuffer[TotalCountBufferLength];
119  uint32_t m_TotalSystemSizeBuffer[TotalSizeBufferLength];
120 
121  NN_PIA_DISALLOW_COPY(CloneProfiler);
122 };
123 }
124 }
125 } // end of namespace nn::pia::clone