ONE - On-device Neural Engine
Loading...
Searching...
No Matches
EventWriter Class Reference

#include <EventWriter.h>

Public Types

enum class  WriteFormat { CHROME_TRACING , SNPE_BENCHMARK , MD_TABLE }
 

Public Member Functions

void startToUse ()
 Call this when observer which use EventWriter starts.
 
void readyToFlush (std::unique_ptr< EventRecorder > &&recorder)
 Call this when observer which use EventWriter finishes. After multiple observers calls this method, the reference count will eventually be 0. Then, EventWriter will write profiling result file.
 

Static Public Member Functions

static EventWriterget (const std::string &workspace_dir)
 Retuens a singleton object.
 

Detailed Description

Definition at line 80 of file EventWriter.h.

Member Enumeration Documentation

◆ WriteFormat

enum class EventWriter::WriteFormat
strong
Enumerator
CHROME_TRACING 
SNPE_BENCHMARK 
MD_TABLE 

Definition at line 83 of file EventWriter.h.

Member Function Documentation

◆ get()

static EventWriter * EventWriter::get ( const std::string &  workspace_dir)
inlinestatic

Retuens a singleton object.

Definition at line 93 of file EventWriter.h.

94 {
95 std::unique_lock<std::mutex> lock{_mutex};
96
97 static EventWriter singleton(workspace_dir);
98 return &singleton;
99 }

Referenced by onert::exec::TracingObserver::~TracingObserver().

◆ readyToFlush()

void EventWriter::readyToFlush ( std::unique_ptr< EventRecorder > &&  recorder)

Call this when observer which use EventWriter finishes. After multiple observers calls this method, the reference count will eventually be 0. Then, EventWriter will write profiling result file.

Definition at line 24 of file EventWriter.cc.

25{
26 {
27 std::unique_lock<std::mutex> lock{_mutex};
28
29 _recorders.emplace_back(std::move(recorder));
30
31 if (--_ref_count > 0)
32 return;
33 }
34 // The caller of this method is the last instance that uses EventWriter.
35 // Let's write log files.
36
37 // Note. According to an internal issue, let snpe json as just file name not '.snpe.json'
41}

References CHROME_TRACING, MD_TABLE, and SNPE_BENCHMARK.

◆ startToUse()

void EventWriter::startToUse ( )
inline

Call this when observer which use EventWriter starts.

Definition at line 104 of file EventWriter.h.

105 {
106 std::unique_lock<std::mutex> lock{_mutex};
107 _ref_count++;
108 }

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