Commit b99a55fe authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

trace: make cpplint happy

parent 414b03f4
......@@ -24,6 +24,8 @@
#pragma once
#include <string>
class event {
public:
uint64_t ts;
......
......@@ -24,9 +24,9 @@
#include <iostream>
#include "events.h"
#include "parser.h"
#include "process.h"
#include "trace/events.h"
#include "trace/parser.h"
#include "trace/process.h"
namespace bio = boost::iostreams;
......@@ -48,7 +48,7 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
return;*/
if (comp_name_len == 18 && !memcmp(comp_name, "system.switch_cpus", 18)) {
//cpu_lines++;
// cpu_lines++;
if (!p.consume_str("T0 : 0x"))
return;
......@@ -59,8 +59,9 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
if (const std::string *s = syms.lookup(addr)) {
cur_event = new EHostCall(ts, *s);
}
} else if (comp_name_len == 18 && !memcmp(comp_name, "system.pc.ethernet", 18)) {
//eth_lines++;
} else if (comp_name_len == 18 &&
!memcmp(comp_name, "system.pc.ethernet", 18)) {
// eth_lines++;
/*std::cout.write(msg, msg_len);
std::cout << std::endl;*/
......@@ -76,38 +77,34 @@ void gem5_parser::process_msg(uint64_t ts, char *comp_name,
cur_event = new EHostMsiX(ts, id);
} else if (p.consume_str("DMA read id ") && p.consume_dec(id) &&
p.consume_str(" addr ") && p.consume_hex(addr) &&
p.consume_str(" size ") && p.consume_dec(size))
{
// cosim: received DMA read id 94113551511792 addr 23697ad60 size 20
p.consume_str(" size ") && p.consume_dec(size)) {
// cosim: received DMA read id 94113551511792 addr 23697ad60
// size 20
cur_event = new EHostDmaR(ts, id, addr, size);
} else if (p.consume_str("DMA write id ") && p.consume_dec(id) &&
p.consume_str(" addr ") && p.consume_hex(addr) &&
p.consume_str(" size ") && p.consume_dec(size))
{
// cosim: received DMA write id 94113551528032 addr 236972000 size 4
p.consume_str(" size ") && p.consume_dec(size)) {
// cosim: received DMA write id 94113551528032 addr 236972000
// size 4
cur_event = new EHostDmaW(ts, id, addr, size);
} else if (p.consume_str("read completion id ") &&
p.consume_dec(id))
{
p.consume_dec(id)) {
// cosim: received read completion id 94583743418112
cur_event = new EHostMmioC(ts, id);
} else if (p.consume_str("write completion id ") &&
p.consume_dec(id))
{
p.consume_dec(id)) {
// cosim: received write completion id 94583743418736
cur_event = new EHostMmioC(ts, id);
}
} else if (p.consume_str("sending ")) {
if (p.consume_str("read addr ") && p.consume_hex(addr) &&
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
cur_event = new EHostMmioR(ts, id, addr, size);
} else if (p.consume_str("write addr ") && p.consume_hex(addr) &&
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
cur_event = new EHostMmioW(ts, id, addr, size);
}
......@@ -133,7 +130,7 @@ void gem5_parser::process_line(char *line, size_t line_len)
bool valid = true;
// eat spaces
for (; pos < line_len && line[pos] == ' '; pos++);
for (; pos < line_len && line[pos] == ' '; pos++) {}
// parse ts
uint64_t ts = 0;
......@@ -163,7 +160,7 @@ void gem5_parser::process_line(char *line, size_t line_len)
comp_name_start = pos;
for (; pos < line_len && line[pos] != ' ' && line[pos] != '\n'; pos++,
comp_name_len++);
comp_name_len++) {}
// skip space
if (line[pos] != ' ') {
valid = false;
......
......@@ -27,9 +27,9 @@
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include "events.h"
#include "parser.h"
#include "process.h"
#include "trace/events.h"
#include "trace/parser.h"
#include "trace/process.h"
namespace bio = boost::iostreams;
......@@ -90,7 +90,7 @@ size_t log_parser::try_line()
size_t pos = buf_pos;
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) {
// line is incomplete
return 0;
......
# 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
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
* 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
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* 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 "events.h"
#include "parser.h"
#include "process.h"
#include "trace/events.h"
#include "trace/parser.h"
#include "trace/process.h"
namespace bio = boost::iostreams;
......@@ -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);
}
} 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) &&
p.consume_str(" addr ") &&
p.consume_hex(addr) &&
......@@ -94,8 +95,12 @@ void nicbm_parser::process_line(char *line, size_t line_len)
if (p.consume_dec(len)) {
cur_event = new e_nic_rx(ts, len);
}
}/* else {
#if 1
}
#else
} else {
std::cerr.write(line, line_len);
std::cerr << std::endl;
}*/
}
#endif
}
......@@ -26,6 +26,7 @@
#include <cstddef>
#include <cstring>
#include <string>
class parser {
protected:
......@@ -42,7 +43,7 @@ class parser {
inline size_t trim_spaces()
{
size_t cnt = 0;
for (; pos < buf_len && buf[pos] == ' '; pos++, cnt++);
for (; pos < buf_len && buf[pos] == ' '; pos++, cnt++) {}
return cnt;
}
......@@ -109,7 +110,7 @@ class parser {
inline bool extract_until(char end_c, std::string &str)
{
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)
return false;
......
......@@ -24,9 +24,9 @@
#include <iostream>
#include "events.h"
#include "parser.h"
#include "process.h"
#include "trace/events.h"
#include "trace/parser.h"
#include "trace/process.h"
struct log_parser_cmp {
bool operator() (const log_parser *l, const log_parser *r) const {
......@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
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)
active_parsers.insert(p);
}
......@@ -106,7 +106,5 @@ int main(int argc, char *argv[])
if (p->next_event() && p->cur_event)
active_parsers.insert(p);
}
}
......@@ -29,7 +29,7 @@
#include <string>
#include <boost/iostreams/filtering_streambuf.hpp>
#include "events.h"
#include "trace/events.h"
class sym_map {
protected:
......@@ -103,5 +103,4 @@ class nicbm_parser : public log_parser {
public:
virtual ~nicbm_parser();
};
......@@ -24,9 +24,8 @@
#include <fstream>
#include "parser.h"
#include "process.h"
#include "trace/parser.h"
#include "trace/process.h"
sym_map::sym_map()
: filter_en(false), insmap_en(false)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment