CTR Pia  4.11.3
Game Communication Engine
clone_CloneProfilerBase.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: clone_CloneProfilerBase.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/clone/clone_definitions.h>
18 
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace clone
25 {
26 
27 
28 /*!
29 @brief This base class manages <tt>PiaClone</tt> profiling.
30 
31 @date 2013-11-25 Initial version.
32 */
34 {
35 public:
36 /*!
37 @brief Prints information that is useful for debugging.
38 
39 @param[in] flag Specifies the bitwise OR of trace flags. For more information, see the <tt>@ref TraceFlag</tt> type.
40 */
41  void Trace(u64 flag) const;
42 
43 
44  //! @cond PRIVATE
45 
46 public:
47  void Reset();
48 
49  bool IsProfileLatest() const
50  {
51  return (m_BufferSize > 0);
52  }
53 
54  void ProfileByStationIndex(u32 dispatchCount, StationIndex stationId, u32 size);
55  void ProfileByStationBmp(u32 dispatchCount, u32 stationBmp, u32 size);
56 
57  u32 GetTotalCount(StationIndex stationId) const;
58  u32 GetTotalSize(StationIndex stationId) const;
59  u32 GetLatestCount(StationIndex stationId, u32 dispatchCount) const;
60  u32 GetLatestSize(StationIndex stationId, u32 dispatchCount) const;
61 
62 protected:
63  CloneProfilerBase(u32* paDispatchCount, u8* paCount, u16* paSize, u16* paTotalCount, u32* paTotalSize, u32 stationNum, u32 bufferSize);
64 
65 private:
66  u32 GetBufferIdx(u32 stationId, u32 idx) const
67  {
68  return stationId + idx * m_StationNum;
69  }
70 
71  void AssignBuffer(u32 dispatchCount);
72 
73 private:
74  u32* m_paDispatchCount;
75  u8* m_paCount;
76  u16* m_paSize;
77  u16* m_paTotalCount;
78  u32* m_paTotalSize;
79 
80  u32 m_StationNum;
81  u32 m_BufferSize;
82 
83  u32 m_CurrentIdx;
84 
85 
86  //! @endcond
87 };
88 }
89 }
90 } // end of namespace nn::pia::clone
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
Definition: assert.h:115
This base class manages PiaClone profiling.
Definition: clone_CloneProfilerBase.h:33
void Trace(u64 flag) const
Prints information that is useful for debugging.