Commit 1c425f14 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 2244846a
...@@ -672,42 +672,42 @@ int program::max_ins_length() const ...@@ -672,42 +672,42 @@ int program::max_ins_length() const
static auto& get_titles() static auto& get_titles()
{ {
static std::vector<std::string> titles = static std::vector<std::string> titles = {"Instructions",
{ "Time(ms) \t",
"Instructions", "Percentage \t",
"Time(ms) \t", "(b, m, n, k) \t",
"Percentage \t", "Flops(TFlops/s) \t",
"(b, m, n, k) \t", "Throughput(GB/s)"};
"Flops(TFlops/s) \t",
"Throughput(GB/s)"
};
return titles; return titles;
} }
static void print_title(std::ostream& os, std::size_t max_ins_len) static void print_title(std::ostream& os, std::size_t max_ins_len)
{ {
auto titles = get_titles(); auto titles = get_titles();
std::string& str = titles.front(); std::string& str = titles.front();
str.append(max_ins_len + 1 - str.length(), ' '); str.append(max_ins_len + 1 - str.length(), ' ');
str.append(1, '\t'); str.append(1, '\t');
for (auto& s : titles) for(auto& s : titles)
{ {
os << s; os << s;
} }
os << std::endl; os << std::endl;
} }
static void print_ins_perf(std::ostream& os, const std::vector<std::string>& titles, static void print_ins_perf(std::ostream& os,
instruction_ref ins, double t, double total_t) const std::vector<std::string>& titles,
instruction_ref ins,
double t,
double total_t)
{ {
auto& time_str = titles.at(1); auto& time_str = titles.at(1);
auto& time_per = titles.at(2); auto& time_per = titles.at(2);
auto& size_str = titles.at(3); auto& size_str = titles.at(3);
auto& flops_str = titles.at(4); auto& flops_str = titles.at(4);
auto& flops_funcs = get_flops_funcs(); auto& flops_funcs = get_flops_funcs();
std::string tms = std::to_string(t); std::string tms = std::to_string(t);
tms.append(time_str.length() - tms.length(), ' '); tms.append(time_str.length() - tms.length(), ' ');
tms.append(1, '\t'); tms.append(1, '\t');
double percent = 100.0 * t / total_t; double percent = 100.0 * t / total_t;
...@@ -732,8 +732,8 @@ static void print_ins_perf(std::ostream& os, const std::vector<std::string>& tit ...@@ -732,8 +732,8 @@ static void print_ins_perf(std::ostream& os, const std::vector<std::string>& tit
auto inss = to_shapes(ins->inputs()); auto inss = to_shapes(ins->inputs());
auto alens = inss.front().lens(); auto alens = inss.front().lens();
auto blens = inss.at(1).lens(); auto blens = inss.at(1).lens();
auto mb = std::accumulate( auto mb =
alens.rbegin() + 2, alens.rend(), 1, std::multiplies<std::size_t>{}); std::accumulate(alens.rbegin() + 2, alens.rend(), 1, std::multiplies<std::size_t>{});
int mm = alens[alens.size() - 2]; int mm = alens[alens.size() - 2];
int mk = alens.back(); int mk = alens.back();
int mn = blens.back(); int mn = blens.back();
...@@ -833,7 +833,7 @@ void program::perf_report(std::ostream& os, ...@@ -833,7 +833,7 @@ void program::perf_report(std::ostream& os,
std::unordered_map<instruction_ref, std::string> names; std::unordered_map<instruction_ref, std::string> names;
// count max instruction length // count max instruction length
auto titles = get_titles(); auto titles = get_titles();
const int max_ins_len = max_ins_length(); const int max_ins_len = max_ins_length();
print_title(os, max_ins_len); print_title(os, max_ins_len);
...@@ -849,7 +849,7 @@ void program::perf_report(std::ostream& os, ...@@ -849,7 +849,7 @@ void program::perf_report(std::ostream& os,
// insert space to align // insert space to align
print_space(os, max_ins_len - ss.str().length()); print_space(os, max_ins_len - ss.str().length());
os << "\t"; os << "\t";
double avg = common_average(ins_vec[ins]); double avg = common_average(ins_vec[ins]);
print_ins_perf(os, titles, ins, avg, total_instruction_time); print_ins_perf(os, titles, ins, avg, total_instruction_time);
}); });
......
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