ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 78 of file EventWriter.h.

Member Enumeration Documentation

◆ WriteFormat

enum class EventWriter::WriteFormat
strong
Enumerator
CHROME_TRACING 
SNPE_BENCHMARK 
MD_TABLE 

Definition at line 81 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 91 of file EventWriter.h.

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

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 21 of file EventWriter.cc.

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

References CHROME_TRACING, MD_TABLE, and SNPE_BENCHMARK.

◆ startToUse()

void EventWriter::startToUse ( )
inline

Call this when observer which use EventWriter starts.

Definition at line 102 of file EventWriter.h.

103 {
104 std::unique_lock<std::mutex> lock{_mutex};
105 _ref_count++;
106 }

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