ArmNN
 21.02
ProfilingGuidGenerator Class Reference

#include <ProfilingGuidGenerator.hpp>

Inheritance diagram for ProfilingGuidGenerator:
IProfilingGuidGenerator

Public Member Functions

 ProfilingGuidGenerator ()
 Construct a generator with the default address space static/dynamic partitioning. More...
 
ProfilingDynamicGuid NextGuid () override
 Return the next random Guid in the sequence. More...
 
ProfilingStaticGuid GenerateStaticId (const std::string &str) override
 Create a ProfilingStaticGuid based on a hash of the string. More...
 
void Reset ()
 Reset the generator back to zero. Used mainly for test. More...
 
- Public Member Functions inherited from IProfilingGuidGenerator
virtual ~IProfilingGuidGenerator ()
 

Detailed Description

Definition at line 19 of file ProfilingGuidGenerator.hpp.

Constructor & Destructor Documentation

◆ ProfilingGuidGenerator()

Construct a generator with the default address space static/dynamic partitioning.

Definition at line 23 of file ProfilingGuidGenerator.hpp.

23 : m_Sequence(0) {}

Member Function Documentation

◆ GenerateStaticId()

ProfilingStaticGuid GenerateStaticId ( const std::string &  str)
inlineoverridevirtual

Create a ProfilingStaticGuid based on a hash of the string.

Implements IProfilingGuidGenerator.

Definition at line 40 of file ProfilingGuidGenerator.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::GetStaticId().

41  {
42  uint64_t staticHash = m_Hash(str) | MIN_STATIC_GUID;
43  return ProfilingStaticGuid(staticHash);
44  }

◆ NextGuid()

ProfilingDynamicGuid NextGuid ( )
inlineoverridevirtual

Return the next random Guid in the sequence.

Implements IProfilingGuidGenerator.

Definition at line 26 of file ProfilingGuidGenerator.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::GetNextGuid().

27  {
28  std::lock_guard<std::mutex> sequencelock(m_SequenceMutex);
29  ProfilingDynamicGuid guid(m_Sequence);
30  m_Sequence++;
31  if (m_Sequence >= MIN_STATIC_GUID)
32  {
33  // Reset the sequence to 0 when it reaches the upper bound of dynamic guid
34  m_Sequence = 0;
35  }
36  return guid;
37  }

◆ Reset()

void Reset ( )
inline

Reset the generator back to zero. Used mainly for test.

Definition at line 47 of file ProfilingGuidGenerator.hpp.

Referenced by ProfilingService::ResetGuidGenerator().

48  {
49  std::lock_guard<std::mutex> sequencelock(m_SequenceMutex);
50  m_Sequence = 0;
51  }

The documentation for this class was generated from the following file: