CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
transport_PacketAnalysisData.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/transport/transport_Definitions.h>
17 
18 #include <nn/pia/transport/transport_ProtocolId.h>
19 
20 #include <nn/pia/common/common_Time.h>
21 
22 
23 namespace nn
24 {
25 namespace pia
26 {
27 namespace transport
28 {
29 
30 
31 /*!
32  @brief PacketAnalysisData は、送受信されるパケットの内部データを解析した結果を集計するために用意された構造体です。
33 
34  */
36 {
37  static const int32_t MaxEntries = 32; //!< 最大エントリ数です。
38  static const int32_t MaxNameLen = 32; //!< 本オブジェクトに付けられる名前の最大長です。
39 
40 
41  /*!
42  @brief 解析結果を ProtocolId ごとに集計するためのエントリ構造体です。
43  */
44  struct Entry
45  {
46  ProtocolId protocolId; //!< ProtocolId
47  uint32_t totalNum; //!< ProtocolId に対応するプロトコルメッセージの個数
48  uint32_t totalDataSize; //!< ProtocolId に対応するデータ量の総和(単位はバイト)
49  uint32_t sumTotalNum; //!< ProtocolId に対応するプロトコルメッセージの個数。ClearCounters() ではクリアされません。
50  uint64_t sumTotalDataSize; //!< ProtocolId に対応するデータ量の総和(単位はバイト)。ClearCounters() ではクリアされません。
51  };
52 
53  struct Entry entry[MaxEntries]; //!< エントリ配列。
54  int32_t nowEntryNum; //!< 現時点でのエントリ数。
55  int32_t passedMilliSec; //!< PiaTransport のスタートアップ処理実行時点からの経過時間(単位はミリ秒)
56  char name[MaxNameLen]; //!< インスタンスに付ける名前です。'\0' 終端されている必要があります。
57  uint32_t totalPacketNum; //!< 解析したパケットの個数。
58  uint32_t totalPacketSize; //!< 解析したパケットのサイズの総和。
59 
60  uint32_t sumTotalPacketNum; //!< 解析が開始されてからカウントしたパケットの個数。ClearCounters() ではクリアされません。
61  uint64_t sumTotalPacketSize; //!< 解析が開始されてからカウントしたパケットのサイズの総和。ClearCounters() ではクリアされません。
62 
63  /*!
64  @brief name メンバ以外の内容を全てクリアします。
65  */
66  void ClearExceptName();
67 
68 
69  /*!
70  @brief エントリの totalNum、totalDataSize と、passedMilliSec、totalPacketNum、totalPacketSize をクリアします。
71  */
72  void ClearCounters();
73 
74 
75  /*!
76  @brief データの内容をプリントします。
77 
78  @param[in] bDetail 詳細な出力を得る場合は true を指定します。
79  */
80  void Print(bool bDetail) const;
81 
82 
83  /*!
84  @brief デバッグに有用な情報をプリントします。
85 
86  @param[in] flag トレースフラグの論理和。詳細は @ref TraceFlag 型を参照してください。
87  */
88  void Trace(uint64_t flag) const;
89 
90 
91  static const int32_t InvalidIdx = -1; // 無効な添え字を表す。
92  int32_t GetIndex(ProtocolId id) const; // id に対応するエントリが存在していればその添え字を、存在しなければ InvalidIdx を返す。
93  int32_t CreateIndex(ProtocolId id); // エントリが満杯で、新たな添え字を割り振ることができなければ、InvalidIdx を返す。
94 };
95 }
96 }
97 } // end of namespace nn::pia::transport