ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::util::TracingCtx Class Reference

Class to maintain information about profiling per session. More...

#include <TracingCtx.h>

Public Member Functions

 TracingCtx (void)
 Create and store unique session id managed by this class.
 
uint32_t getSessionId () const
 
bool hasMultipleSessions () const
 Return true if more than 1 session exist.
 
void setSubgraphIndex (const ir::Graph *g, std::pair< ir::ModelIndex, ir::SubgraphIndex > index)
 Set subgraph index of a graph.
 
std::pair< ir::ModelIndex, ir::SubgraphIndexgetSubgraphIndex (const ir::Graph *g) const
 Get subgraph index of a graph.
 

Detailed Description

Class to maintain information about profiling per session.

Definition at line 33 of file TracingCtx.h.

Constructor & Destructor Documentation

◆ TracingCtx()

onert::util::TracingCtx::TracingCtx ( void  )
inline

Create and store unique session id managed by this class.

Note
This constructor can be called by multiple session running in parallely.

Definition at line 40 of file TracingCtx.h.

40{ decideSessionID(); }

Member Function Documentation

◆ getSessionId()

uint32_t onert::util::TracingCtx::getSessionId ( ) const
inline

Definition at line 42 of file TracingCtx.h.

42{ return _session_id; }

◆ getSubgraphIndex()

std::pair< ir::ModelIndex, ir::SubgraphIndex > onert::util::TracingCtx::getSubgraphIndex ( const ir::Graph g) const
inline

Get subgraph index of a graph.

Definition at line 62 of file TracingCtx.h.

63 {
64 return _subgraph_indices.at(g);
65 }

Referenced by onert::exec::DataflowExecutor::executeImpl(), onert::exec::LinearExecutor::executeImpl(), and onert::exec::ParallelExecutor::executeImpl().

◆ hasMultipleSessions()

bool onert::util::TracingCtx::hasMultipleSessions ( ) const
inline

Return true if more than 1 session exist.

Note
This method is NOT thread-safe. Call this in thread-safe situation.

Definition at line 49 of file TracingCtx.h.

49{ return _next_session_id > 1; }

◆ setSubgraphIndex()

void onert::util::TracingCtx::setSubgraphIndex ( const ir::Graph g,
std::pair< ir::ModelIndex, ir::SubgraphIndex index 
)
inline

Set subgraph index of a graph.

Definition at line 54 of file TracingCtx.h.

55 {
56 _subgraph_indices.emplace(g, index);
57 }

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