Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
906716e5
Unverified
Commit
906716e5
authored
Mar 04, 2020
by
Scott Cyphers
Committed by
GitHub
Mar 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move chrome trace to proper namespace (#4400)
Co-authored-by:
Scott Cyphers
<
diyessi@users.noreply.github.com
>
parent
263d5197
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
39 deletions
+36
-39
chrome_trace.cpp
src/ngraph/chrome_trace.cpp
+25
-25
chrome_trace.hpp
src/ngraph/chrome_trace.hpp
+7
-10
host_tensor.cpp
src/ngraph/runtime/host_tensor.cpp
+2
-2
int_executable.cpp
src/ngraph/runtime/interpreter/int_executable.cpp
+2
-2
No files found.
src/ngraph/chrome_trace.cpp
View file @
906716e5
...
...
@@ -33,10 +33,10 @@ static bool read_tracing_env_var()
return
is_enabled
;
}
mutex
runtime
::
event
::
Manager
::
s_file_mutex
;
bool
runtime
::
event
::
Manager
::
s_tracing_enabled
=
read_tracing_env_var
();
mutex
event
::
Manager
::
s_file_mutex
;
bool
event
::
Manager
::
s_tracing_enabled
=
read_tracing_env_var
();
runtime
::
event
::
Duration
::
Duration
(
const
string
&
name
,
const
string
&
category
,
const
string
&
args
)
event
::
Duration
::
Duration
(
const
string
&
name
,
const
string
&
category
,
const
string
&
args
)
{
if
(
Manager
::
is_tracing_enabled
())
{
...
...
@@ -48,7 +48,7 @@ runtime::event::Duration::Duration(const string& name, const string& category, c
}
}
void
runtime
::
event
::
Duration
::
stop
()
void
event
::
Duration
::
stop
()
{
if
(
Manager
::
is_tracing_enabled
())
{
...
...
@@ -56,7 +56,7 @@ void runtime::event::Duration::stop()
}
}
void
runtime
::
event
::
Duration
::
write
()
void
event
::
Duration
::
write
()
{
if
(
Manager
::
is_tracing_enabled
())
{
...
...
@@ -64,11 +64,11 @@ void runtime::event::Duration::write()
lock_guard
<
mutex
>
lock
(
Manager
::
get_mutex
());
ofstream
&
out
=
runtime
::
event
::
Manager
::
get_output_stream
();
ofstream
&
out
=
event
::
Manager
::
get_output_stream
();
string
str
;
if
(
out
.
is_open
()
==
false
)
{
runtime
::
event
::
Manager
::
open
();
event
::
Manager
::
open
();
}
else
{
...
...
@@ -88,7 +88,7 @@ void runtime::event::Duration::write()
}
}
runtime
::
event
::
Object
::
Object
(
const
string
&
name
,
const
string
&
args
)
event
::
Object
::
Object
(
const
string
&
name
,
const
string
&
args
)
:
m_name
{
name
}
,
m_id
{
static_cast
<
size_t
>
(
chrono
::
high_resolution_clock
::
now
().
time_since_epoch
().
count
())}
{
...
...
@@ -96,11 +96,11 @@ runtime::event::Object::Object(const string& name, const string& args)
{
lock_guard
<
mutex
>
lock
(
Manager
::
get_mutex
());
ofstream
&
out
=
runtime
::
event
::
Manager
::
get_output_stream
();
ofstream
&
out
=
event
::
Manager
::
get_output_stream
();
string
str
;
if
(
out
.
is_open
()
==
false
)
{
runtime
::
event
::
Manager
::
open
();
event
::
Manager
::
open
();
}
else
{
...
...
@@ -119,16 +119,16 @@ runtime::event::Object::Object(const string& name, const string& args)
}
}
void
runtime
::
event
::
Object
::
snapshot
(
const
string
&
args
)
void
event
::
Object
::
snapshot
(
const
string
&
args
)
{
if
(
Manager
::
is_tracing_enabled
())
{
lock_guard
<
mutex
>
lock
(
Manager
::
get_mutex
());
ofstream
&
out
=
runtime
::
event
::
Manager
::
get_output_stream
();
ofstream
&
out
=
event
::
Manager
::
get_output_stream
();
if
(
out
.
is_open
()
==
false
)
{
runtime
::
event
::
Manager
::
open
();
event
::
Manager
::
open
();
}
else
{
...
...
@@ -138,7 +138,7 @@ void runtime::event::Object::snapshot(const string& args)
}
}
void
runtime
::
event
::
Object
::
write_snapshot
(
ostream
&
out
,
const
string
&
args
)
void
event
::
Object
::
write_snapshot
(
ostream
&
out
,
const
string
&
args
)
{
string
str
=
R"({"name":")"
+
m_name
+
R"(","ph":"O","id":")"
+
to_string
(
m_id
)
+
R"(","ts":)"
+
to_string
(
Manager
::
get_current_microseconds
())
+
...
...
@@ -151,16 +151,16 @@ void runtime::event::Object::write_snapshot(ostream& out, const string& args)
out
<<
str
;
}
void
runtime
::
event
::
Object
::
destroy
()
void
event
::
Object
::
destroy
()
{
if
(
Manager
::
is_tracing_enabled
())
{
lock_guard
<
mutex
>
lock
(
Manager
::
get_mutex
());
ofstream
&
out
=
runtime
::
event
::
Manager
::
get_output_stream
();
ofstream
&
out
=
event
::
Manager
::
get_output_stream
();
if
(
out
.
is_open
()
==
false
)
{
runtime
::
event
::
Manager
::
open
();
event
::
Manager
::
open
();
}
else
{
...
...
@@ -173,7 +173,7 @@ void runtime::event::Object::destroy()
}
}
void
runtime
::
event
::
Manager
::
open
(
const
string
&
path
)
void
event
::
Manager
::
open
(
const
string
&
path
)
{
ofstream
&
out
=
get_output_stream
();
if
(
out
.
is_open
()
==
false
)
...
...
@@ -183,7 +183,7 @@ void runtime::event::Manager::open(const string& path)
}
}
void
runtime
::
event
::
Manager
::
close
()
void
event
::
Manager
::
close
()
{
ofstream
&
out
=
get_output_stream
();
if
(
out
.
is_open
())
...
...
@@ -193,34 +193,34 @@ void runtime::event::Manager::close()
}
}
ofstream
&
runtime
::
event
::
Manager
::
get_output_stream
()
ofstream
&
event
::
Manager
::
get_output_stream
()
{
static
ofstream
s_event_log
;
return
s_event_log
;
}
const
string
&
runtime
::
event
::
Manager
::
get_process_id
()
const
string
&
event
::
Manager
::
get_process_id
()
{
static
const
string
s_pid
=
to_string
(
getpid
());
return
s_pid
;
}
void
runtime
::
event
::
Manager
::
enable_event_tracing
()
void
event
::
Manager
::
enable_event_tracing
()
{
s_tracing_enabled
=
true
;
}
void
runtime
::
event
::
Manager
::
disable_event_tracing
()
void
event
::
Manager
::
disable_event_tracing
()
{
s_tracing_enabled
=
false
;
}
bool
runtime
::
event
::
Manager
::
is_event_tracing_enabled
()
bool
event
::
Manager
::
is_event_tracing_enabled
()
{
return
s_tracing_enabled
;
}
string
runtime
::
event
::
Manager
::
get_thread_id
()
string
event
::
Manager
::
get_thread_id
()
{
thread
::
id
tid
=
this_thread
::
get_id
();
static
map
<
thread
::
id
,
string
>
tid_map
;
...
...
src/ngraph/chrome_trace.hpp
View file @
906716e5
...
...
@@ -33,14 +33,11 @@
namespace
ngraph
{
namespace
runtime
namespace
event
{
namespace
event
{
class
Duration
;
class
Object
;
class
Manager
;
}
class
Duration
;
class
Object
;
class
Manager
;
}
}
...
...
@@ -75,7 +72,7 @@ namespace ngraph
// More information about this is at:
// http://dev.chromium.org/developers/how-tos/trace-event-profiling-tool
class
ngraph
::
runtime
::
event
::
Manager
class
ngraph
::
event
::
Manager
{
friend
class
Duration
;
friend
class
Object
;
...
...
@@ -102,7 +99,7 @@ private:
static
bool
s_tracing_enabled
;
};
class
ngraph
::
runtime
::
event
::
Duration
class
ngraph
::
event
::
Duration
{
public
:
explicit
Duration
(
const
std
::
string
&
name
,
...
...
@@ -130,7 +127,7 @@ private:
std
::
string
m_args
;
};
class
ngraph
::
runtime
::
event
::
Object
class
ngraph
::
event
::
Object
{
public
:
Object
(
const
std
::
string
&
name
,
const
std
::
string
&
args
);
...
...
src/ngraph/runtime/host_tensor.cpp
View file @
906716e5
...
...
@@ -97,7 +97,7 @@ const char* runtime::HostTensor::get_data_ptr() const
void
runtime
::
HostTensor
::
write
(
const
void
*
source
,
size_t
n
)
{
runtime
::
event
::
Duration
d1
(
"write"
,
"HostTensor"
);
event
::
Duration
d1
(
"write"
,
"HostTensor"
);
if
(
n
!=
m_buffer_size
)
{
...
...
@@ -109,7 +109,7 @@ void runtime::HostTensor::write(const void* source, size_t n)
void
runtime
::
HostTensor
::
read
(
void
*
target
,
size_t
n
)
const
{
runtime
::
event
::
Duration
d1
(
"read"
,
"HostTensor"
);
event
::
Duration
d1
(
"read"
,
"HostTensor"
);
if
(
n
!=
m_buffer_size
)
{
throw
out_of_range
(
"partial tensor read access not supported"
);
...
...
src/ngraph/runtime/interpreter/int_executable.cpp
View file @
906716e5
...
...
@@ -101,7 +101,7 @@ runtime::interpreter::INTExecutable::INTExecutable(const std::string& model_stri
bool
runtime
::
interpreter
::
INTExecutable
::
call
(
const
vector
<
shared_ptr
<
runtime
::
Tensor
>>&
outputs
,
const
vector
<
shared_ptr
<
runtime
::
Tensor
>>&
inputs
)
{
runtime
::
event
::
Duration
d1
(
"call"
,
"Interpreter"
);
event
::
Duration
d1
(
"call"
,
"Interpreter"
);
// convert inputs to HostTensor
vector
<
shared_ptr
<
HostTensor
>>
func_inputs
;
...
...
@@ -150,7 +150,7 @@ bool runtime::interpreter::INTExecutable::call(const vector<shared_ptr<runtime::
// for each ordered op in the graph
for
(
auto
op
:
m_nodes
)
{
runtime
::
event
::
Duration
d2
(
op
->
description
(),
"Interpreter"
);
event
::
Duration
d2
(
op
->
description
(),
"Interpreter"
);
if
(
op
->
is_parameter
())
{
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment