Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aion
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Philip Trettner
aion
Commits
d8364df2
Commit
d8364df2
authored
Nov 15, 2018
by
Philip Trettner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added function pretty print
parent
94ada7db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
src/aion/Tracer.output.cc
src/aion/Tracer.output.cc
+46
-1
No files found.
src/aion/Tracer.output.cc
View file @
d8364df2
...
...
@@ -18,6 +18,51 @@ void write_dir(const std::string &path)
write_summary_csv
(
path
+
"/trace.csv"
);
}
static
std
::
string
beautify_function_name
(
std
::
string
const
&
name
)
{
auto
p
=
name
.
rfind
(
')'
);
if
(
p
==
std
::
string
::
npos
)
// no (..)
{
p
=
name
.
rfind
(
' '
);
if
(
p
==
std
::
string
::
npos
)
// no space
return
name
;
return
name
.
substr
(
p
+
1
);
// "void foo" -> "foo"
}
int
i
=
p
;
int
db
=
0
;
int
da
=
0
;
int
cc
=
0
;
while
(
i
>=
0
)
{
if
(
name
[
i
]
==
')'
)
++
db
;
if
(
name
[
i
]
==
'>'
)
++
da
;
if
(
name
[
i
]
==
'<'
)
--
da
;
if
(
name
[
i
]
==
'('
)
--
db
;
if
(
name
[
i
]
==
':'
&&
da
==
0
&&
db
==
0
)
{
++
cc
;
if
(
cc
>
2
)
break
;
}
if
(
name
[
i
]
==
' '
&&
da
==
0
&&
db
==
0
)
break
;
--
i
;
}
if
(
i
<
0
)
return
name
;
return
name
.
substr
(
i
+
1
);
}
void
write_speedscope_json
(
std
::
string
const
&
filename
)
{
std
::
ofstream
out
(
filename
);
...
...
@@ -109,7 +154,7 @@ void write_speedscope_json(std::string const &filename)
if
(
i
>
0
)
out
<<
","
;
out
<<
"{"
;
out
<<
"
\"
name
\"
:
\"
"
<<
(
std
::
string
(
loc
->
name
).
empty
()
?
loc
->
function
:
loc
->
name
)
<<
"
\"
,"
;
out
<<
"
\"
name
\"
:
\"
"
<<
(
std
::
string
(
loc
->
name
).
empty
()
?
beautify_function_name
(
loc
->
function
)
:
loc
->
name
)
<<
"
\"
,"
;
out
<<
"
\"
file
\"
:
\"
"
<<
loc
->
file
<<
"
\"
,"
;
out
<<
"
\"
line
\"
:"
<<
loc
->
line
<<
""
;
out
<<
"}"
;
...
...
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