Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
b99a55fe
Commit
b99a55fe
authored
Feb 12, 2021
by
Antoine Kaufmann
Browse files
trace: make cpplint happy
parent
414b03f4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
67 deletions
+68
-67
trace/events.h
trace/events.h
+2
-0
trace/gem5.cpp
trace/gem5.cpp
+19
-22
trace/log_parser.cpp
trace/log_parser.cpp
+4
-4
trace/nicbm.cpp
trace/nicbm.cpp
+33
-28
trace/parser.h
trace/parser.h
+3
-2
trace/process.cpp
trace/process.cpp
+4
-6
trace/process.h
trace/process.h
+1
-2
trace/sym_map.cpp
trace/sym_map.cpp
+2
-3
No files found.
trace/events.h
View file @
b99a55fe
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#pragma once
#pragma once
#include <string>
class
event
{
class
event
{
public:
public:
uint64_t
ts
;
uint64_t
ts
;
...
...
trace/gem5.cpp
View file @
b99a55fe
...
@@ -24,9 +24,9 @@
...
@@ -24,9 +24,9 @@
#include <iostream>
#include <iostream>
#include "events.h"
#include "
trace/
events.h"
#include "parser.h"
#include "
trace/
parser.h"
#include "process.h"
#include "
trace/
process.h"
namespace
bio
=
boost
::
iostreams
;
namespace
bio
=
boost
::
iostreams
;
...
@@ -48,7 +48,7 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
...
@@ -48,7 +48,7 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
return;*/
return;*/
if
(
comp_name_len
==
18
&&
!
memcmp
(
comp_name
,
"system.switch_cpus"
,
18
))
{
if
(
comp_name_len
==
18
&&
!
memcmp
(
comp_name
,
"system.switch_cpus"
,
18
))
{
//cpu_lines++;
//
cpu_lines++;
if
(
!
p
.
consume_str
(
"T0 : 0x"
))
if
(
!
p
.
consume_str
(
"T0 : 0x"
))
return
;
return
;
...
@@ -59,8 +59,9 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
...
@@ -59,8 +59,9 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
if
(
const
std
::
string
*
s
=
syms
.
lookup
(
addr
))
{
if
(
const
std
::
string
*
s
=
syms
.
lookup
(
addr
))
{
cur_event
=
new
EHostCall
(
ts
,
*
s
);
cur_event
=
new
EHostCall
(
ts
,
*
s
);
}
}
}
else
if
(
comp_name_len
==
18
&&
!
memcmp
(
comp_name
,
"system.pc.ethernet"
,
18
))
{
}
else
if
(
comp_name_len
==
18
&&
//eth_lines++;
!
memcmp
(
comp_name
,
"system.pc.ethernet"
,
18
))
{
// eth_lines++;
/*std::cout.write(msg, msg_len);
/*std::cout.write(msg, msg_len);
std::cout << std::endl;*/
std::cout << std::endl;*/
...
@@ -76,38 +77,34 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
...
@@ -76,38 +77,34 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
cur_event
=
new
EHostMsiX
(
ts
,
id
);
cur_event
=
new
EHostMsiX
(
ts
,
id
);
}
else
if
(
p
.
consume_str
(
"DMA read id "
)
&&
p
.
consume_dec
(
id
)
&&
}
else
if
(
p
.
consume_str
(
"DMA read id "
)
&&
p
.
consume_dec
(
id
)
&&
p
.
consume_str
(
" addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_str
(
" addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
))
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
))
{
{
// cosim: received DMA read id 94113551511792 addr 23697ad60
//
cosim: received DMA read id 94113551511792 addr 23697ad60
size 20
//
size 20
cur_event
=
new
EHostDmaR
(
ts
,
id
,
addr
,
size
);
cur_event
=
new
EHostDmaR
(
ts
,
id
,
addr
,
size
);
}
else
if
(
p
.
consume_str
(
"DMA write id "
)
&&
p
.
consume_dec
(
id
)
&&
}
else
if
(
p
.
consume_str
(
"DMA write id "
)
&&
p
.
consume_dec
(
id
)
&&
p
.
consume_str
(
" addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_str
(
" addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
))
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
))
{
{
// cosim: received DMA write id 94113551528032 addr 236972000
//
cosim: received DMA write id 94113551528032 addr 236972000
size 4
//
size 4
cur_event
=
new
EHostDmaW
(
ts
,
id
,
addr
,
size
);
cur_event
=
new
EHostDmaW
(
ts
,
id
,
addr
,
size
);
}
else
if
(
p
.
consume_str
(
"read completion id "
)
&&
}
else
if
(
p
.
consume_str
(
"read completion id "
)
&&
p
.
consume_dec
(
id
))
p
.
consume_dec
(
id
))
{
{
// cosim: received read completion id 94583743418112
// cosim: received read completion id 94583743418112
cur_event
=
new
EHostMmioC
(
ts
,
id
);
cur_event
=
new
EHostMmioC
(
ts
,
id
);
}
else
if
(
p
.
consume_str
(
"write completion id "
)
&&
}
else
if
(
p
.
consume_str
(
"write completion id "
)
&&
p
.
consume_dec
(
id
))
p
.
consume_dec
(
id
))
{
{
// cosim: received write completion id 94583743418736
// cosim: received write completion id 94583743418736
cur_event
=
new
EHostMmioC
(
ts
,
id
);
cur_event
=
new
EHostMmioC
(
ts
,
id
);
}
}
}
else
if
(
p
.
consume_str
(
"sending "
))
{
}
else
if
(
p
.
consume_str
(
"sending "
))
{
if
(
p
.
consume_str
(
"read addr "
)
&&
p
.
consume_hex
(
addr
)
&&
if
(
p
.
consume_str
(
"read addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
)
&&
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
)
&&
p
.
consume_str
(
" id "
)
&&
p
.
consume_dec
(
id
))
p
.
consume_str
(
" id "
)
&&
p
.
consume_dec
(
id
))
{
{
// cosim: sending read addr c012a500 size 4 id 94583743418112
// cosim: sending read addr c012a500 size 4 id 94583743418112
cur_event
=
new
EHostMmioR
(
ts
,
id
,
addr
,
size
);
cur_event
=
new
EHostMmioR
(
ts
,
id
,
addr
,
size
);
}
else
if
(
p
.
consume_str
(
"write addr "
)
&&
p
.
consume_hex
(
addr
)
&&
}
else
if
(
p
.
consume_str
(
"write addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
)
&&
p
.
consume_str
(
" size "
)
&&
p
.
consume_dec
(
size
)
&&
p
.
consume_str
(
" id "
)
&&
p
.
consume_dec
(
id
))
p
.
consume_str
(
" id "
)
&&
p
.
consume_dec
(
id
))
{
{
// cosim: sending write addr c0108000 size 4 id 94584005188256
// cosim: sending write addr c0108000 size 4 id 94584005188256
cur_event
=
new
EHostMmioW
(
ts
,
id
,
addr
,
size
);
cur_event
=
new
EHostMmioW
(
ts
,
id
,
addr
,
size
);
}
}
...
@@ -133,7 +130,7 @@ void gem5_parser::process_line(char *line, size_t line_len)
...
@@ -133,7 +130,7 @@ void gem5_parser::process_line(char *line, size_t line_len)
bool
valid
=
true
;
bool
valid
=
true
;
// eat spaces
// eat spaces
for
(;
pos
<
line_len
&&
line
[
pos
]
==
' '
;
pos
++
)
;
for
(;
pos
<
line_len
&&
line
[
pos
]
==
' '
;
pos
++
)
{}
// parse ts
// parse ts
uint64_t
ts
=
0
;
uint64_t
ts
=
0
;
...
@@ -163,7 +160,7 @@ void gem5_parser::process_line(char *line, size_t line_len)
...
@@ -163,7 +160,7 @@ void gem5_parser::process_line(char *line, size_t line_len)
comp_name_start
=
pos
;
comp_name_start
=
pos
;
for
(;
pos
<
line_len
&&
line
[
pos
]
!=
' '
&&
line
[
pos
]
!=
'\n'
;
pos
++
,
for
(;
pos
<
line_len
&&
line
[
pos
]
!=
' '
&&
line
[
pos
]
!=
'\n'
;
pos
++
,
comp_name_len
++
)
;
comp_name_len
++
)
{}
// skip space
// skip space
if
(
line
[
pos
]
!=
' '
)
{
if
(
line
[
pos
]
!=
' '
)
{
valid
=
false
;
valid
=
false
;
...
...
trace/log_parser.cpp
View file @
b99a55fe
...
@@ -27,9 +27,9 @@
...
@@ -27,9 +27,9 @@
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include "events.h"
#include "
trace/
events.h"
#include "parser.h"
#include "
trace/
parser.h"
#include "process.h"
#include "
trace/
process.h"
namespace
bio
=
boost
::
iostreams
;
namespace
bio
=
boost
::
iostreams
;
...
@@ -90,7 +90,7 @@ size_t log_parser::try_line()
...
@@ -90,7 +90,7 @@ size_t log_parser::try_line()
size_t
pos
=
buf_pos
;
size_t
pos
=
buf_pos
;
size_t
line_len
=
0
;
size_t
line_len
=
0
;
for
(;
pos
<
buf_len
&&
buf
[
pos
]
!=
'\n'
;
pos
++
,
line_len
++
)
;
for
(;
pos
<
buf_len
&&
buf
[
pos
]
!=
'\n'
;
pos
++
,
line_len
++
)
{}
if
(
pos
>=
buf_len
)
{
if
(
pos
>=
buf_len
)
{
// line is incomplete
// line is incomplete
return
0
;
return
0
;
...
...
trace/nicbm.cpp
View file @
b99a55fe
# Copyright 2021 Max Planck Institute for Software Systems, and
/*
# National University of Singapore
* Copyright 2021 Max Planck Institute for Software Systems, and
#
* National University of Singapore
# Permission is hereby granted, free of charge, to any person obtaining
*
# a copy of this software and associated documentation files (the
* Permission is hereby granted, free of charge, to any person obtaining
# "Software"), to deal in the Software without restriction, including
* a copy of this software and associated documentation files (the
# without limitation the rights to use, copy, modify, merge, publish,
* "Software"), to deal in the Software without restriction, including
# distribute, sublicense, and/or sell copies of the Software, and to
* without limitation the rights to use, copy, modify, merge, publish,
# permit persons to whom the Software is furnished to do so, subject to
* distribute, sublicense, and/or sell copies of the Software, and to
# the following conditions:
* permit persons to whom the Software is furnished to do so, subject to
#
* the following conditions:
# The above copyright notice and this permission notice shall be
*
# included in all copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be
#
* included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
*
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <iostream>
#include <iostream>
#include "events.h"
#include "
trace/
events.h"
#include "parser.h"
#include "
trace/
parser.h"
#include "process.h"
#include "
trace/
process.h"
namespace
bio
=
boost
::
iostreams
;
namespace
bio
=
boost
::
iostreams
;
...
@@ -72,8 +74,7 @@ void nicbm_parser::process_line(char *line, size_t line_len)
...
@@ -72,8 +74,7 @@ void nicbm_parser::process_line(char *line, size_t line_len)
cur_event
=
new
e_nic_dma_i
(
ts
,
id
,
addr
,
len
);
cur_event
=
new
e_nic_dma_i
(
ts
,
id
,
addr
,
len
);
}
}
}
else
if
(
p
.
consume_str
(
"completed dma read op 0x"
)
||
}
else
if
(
p
.
consume_str
(
"completed dma read op 0x"
)
||
p
.
consume_str
(
"completed dma write op 0x"
))
p
.
consume_str
(
"completed dma write op 0x"
))
{
{
if
(
p
.
consume_hex
(
id
)
&&
if
(
p
.
consume_hex
(
id
)
&&
p
.
consume_str
(
" addr "
)
&&
p
.
consume_str
(
" addr "
)
&&
p
.
consume_hex
(
addr
)
&&
p
.
consume_hex
(
addr
)
&&
...
@@ -94,8 +95,12 @@ void nicbm_parser::process_line(char *line, size_t line_len)
...
@@ -94,8 +95,12 @@ void nicbm_parser::process_line(char *line, size_t line_len)
if
(
p
.
consume_dec
(
len
))
{
if
(
p
.
consume_dec
(
len
))
{
cur_event
=
new
e_nic_rx
(
ts
,
len
);
cur_event
=
new
e_nic_rx
(
ts
,
len
);
}
}
}
/* else {
#if 1
}
#else
}
else
{
std
::
cerr
.
write
(
line
,
line_len
);
std
::
cerr
.
write
(
line
,
line_len
);
std
::
cerr
<<
std
::
endl
;
std
::
cerr
<<
std
::
endl
;
}*/
}
#endif
}
}
trace/parser.h
View file @
b99a55fe
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <cstddef>
#include <cstddef>
#include <cstring>
#include <cstring>
#include <string>
class
parser
{
class
parser
{
protected:
protected:
...
@@ -42,7 +43,7 @@ class parser {
...
@@ -42,7 +43,7 @@ class parser {
inline
size_t
trim_spaces
()
inline
size_t
trim_spaces
()
{
{
size_t
cnt
=
0
;
size_t
cnt
=
0
;
for
(;
pos
<
buf_len
&&
buf
[
pos
]
==
' '
;
pos
++
,
cnt
++
)
;
for
(;
pos
<
buf_len
&&
buf
[
pos
]
==
' '
;
pos
++
,
cnt
++
)
{}
return
cnt
;
return
cnt
;
}
}
...
@@ -109,7 +110,7 @@ class parser {
...
@@ -109,7 +110,7 @@ class parser {
inline
bool
extract_until
(
char
end_c
,
std
::
string
&
str
)
inline
bool
extract_until
(
char
end_c
,
std
::
string
&
str
)
{
{
size_t
end
=
pos
;
size_t
end
=
pos
;
for
(;
end
<
buf_len
&&
buf
[
end
]
!=
end_c
;
end
++
)
;
for
(;
end
<
buf_len
&&
buf
[
end
]
!=
end_c
;
end
++
)
{}
if
(
end
>=
buf_len
)
if
(
end
>=
buf_len
)
return
false
;
return
false
;
...
...
trace/process.cpp
View file @
b99a55fe
...
@@ -24,9 +24,9 @@
...
@@ -24,9 +24,9 @@
#include <iostream>
#include <iostream>
#include "events.h"
#include "
trace/
events.h"
#include "parser.h"
#include "
trace/
parser.h"
#include "process.h"
#include "
trace/
process.h"
struct
log_parser_cmp
{
struct
log_parser_cmp
{
bool
operator
()
(
const
log_parser
*
l
,
const
log_parser
*
r
)
const
{
bool
operator
()
(
const
log_parser
*
l
,
const
log_parser
*
r
)
const
{
...
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
...
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
std
::
set
<
log_parser
*
,
log_parser_cmp
>
active_parsers
;
std
::
set
<
log_parser
*
,
log_parser_cmp
>
active_parsers
;
for
(
auto
p
:
all_parsers
)
{
for
(
auto
p
:
all_parsers
)
{
if
(
p
->
next_event
()
&&
p
->
cur_event
)
if
(
p
->
next_event
()
&&
p
->
cur_event
)
active_parsers
.
insert
(
p
);
active_parsers
.
insert
(
p
);
}
}
...
@@ -106,7 +106,5 @@ int main(int argc, char *argv[])
...
@@ -106,7 +106,5 @@ int main(int argc, char *argv[])
if
(
p
->
next_event
()
&&
p
->
cur_event
)
if
(
p
->
next_event
()
&&
p
->
cur_event
)
active_parsers
.
insert
(
p
);
active_parsers
.
insert
(
p
);
}
}
}
}
trace/process.h
View file @
b99a55fe
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include <string>
#include <string>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include "events.h"
#include "
trace/
events.h"
class
sym_map
{
class
sym_map
{
protected:
protected:
...
@@ -103,5 +103,4 @@ class nicbm_parser : public log_parser {
...
@@ -103,5 +103,4 @@ class nicbm_parser : public log_parser {
public:
public:
virtual
~
nicbm_parser
();
virtual
~
nicbm_parser
();
};
};
trace/sym_map.cpp
View file @
b99a55fe
...
@@ -24,9 +24,8 @@
...
@@ -24,9 +24,8 @@
#include <fstream>
#include <fstream>
#include "parser.h"
#include "trace/parser.h"
#include "process.h"
#include "trace/process.h"
sym_map
::
sym_map
()
sym_map
::
sym_map
()
:
filter_en
(
false
),
insmap_en
(
false
)
:
filter_en
(
false
),
insmap_en
(
false
)
...
...
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