clang-format many files. No functional change.

Use nodist/clang_formatter to reformat files that are now clean.
This commit is contained in:
Wilson Snyder
2020-04-13 22:52:23 -04:00
parent dc5c259069
commit 5c966ec510
91 changed files with 4413 additions and 4023 deletions
+59 -64
View File
@@ -40,31 +40,31 @@ class StatsReport {
static StatColl s_allStats; ///< All statistics
void header() {
os<<"Verilator Statistics Report\n";
os<<endl;
os << "Verilator Statistics Report\n";
os << endl;
os<<"Information:"<<endl;
os<<" "<<V3Options::version()<<endl;
os<<" Arguments: "<<v3Global.opt.allArgsString()<<endl;
os<<endl;
os << "Information:" << endl;
os << " " << V3Options::version() << endl;
os << " Arguments: " << v3Global.opt.allArgsString() << endl;
os << endl;
}
void sumit() {
// If sumit is set on a statistic, combine with others of same name
typedef std::multimap<string,V3Statistic*> ByName;
typedef std::multimap<string, V3Statistic*> ByName;
ByName byName;
// * is always first
for (StatColl::iterator it = s_allStats.begin(); it!=s_allStats.end(); ++it) {
for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) {
V3Statistic* repp = &(*it);
byName.insert(make_pair(repp->name(), repp));
}
// Process duplicates
V3Statistic* lastp = NULL;
for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) {
for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) {
V3Statistic* repp = it->second;
if (lastp && lastp->sumit() && lastp->printit()
&& lastp->name() == repp->name() && lastp->stage() == repp->stage()) {
if (lastp && lastp->sumit() && lastp->printit() && lastp->name() == repp->name()
&& lastp->stage() == repp->stage()) {
repp->combineWith(lastp);
}
lastp = repp;
@@ -74,10 +74,10 @@ class StatsReport {
void stars() {
// Find all stages
size_t maxWidth = 0;
typedef std::multimap<string,const V3Statistic*> ByName;
typedef std::multimap<string, const V3Statistic*> ByName;
ByName byName;
// * is always first
for (StatColl::iterator it = s_allStats.begin(); it!=s_allStats.end(); ++it) {
for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) {
const V3Statistic* repp = &(*it);
if (repp->stage() == "*" && repp->printit()) {
if (maxWidth < repp->name().length()) maxWidth = repp->name().length();
@@ -86,43 +86,43 @@ class StatsReport {
}
// Print organized by stage
os<<"Global Statistics:\n";
os<<endl;
for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) {
os << "Global Statistics:\n";
os << endl;
for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) {
const V3Statistic* repp = it->second;
if (repp->perf()) continue;
os<<" "<<std::left<<std::setw(maxWidth)<<repp->name();
os << " " << std::left << std::setw(maxWidth) << repp->name();
repp->dump(os);
os<<endl;
os << endl;
}
os<<endl;
os << endl;
// Print organized by stage
os<<"Performance Statistics:\n";
os<<endl;
for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) {
os << "Performance Statistics:\n";
os << endl;
for (ByName::iterator it = byName.begin(); it != byName.end(); ++it) {
const V3Statistic* repp = it->second;
if (!repp->perf()) continue;
os<<" "<<std::left<<std::setw(maxWidth)<<repp->name();
os << " " << std::left << std::setw(maxWidth) << repp->name();
repp->dump(os);
os<<endl;
os << endl;
}
os<<endl;
os << endl;
}
void stages() {
os<<"Stage Statistics:\n";
os << "Stage Statistics:\n";
// Find all stages
int stage = 0;
size_t maxWidth = 0;
typedef std::vector<string> Stages;
Stages stages;
vl_unordered_map<string,int> stageInt;
typedef std::multimap<string,const V3Statistic*> ByName;
vl_unordered_map<string, int> stageInt;
typedef std::multimap<string, const V3Statistic*> ByName;
ByName byName;
// * is always first
for (StatColl::iterator it = s_allStats.begin(); it!=s_allStats.end(); ++it) {
for (StatColl::iterator it = s_allStats.begin(); it != s_allStats.end(); ++it) {
const V3Statistic* repp = &(*it);
if (repp->stage() != "*" && repp->printit()) {
if (maxWidth < repp->name().length()) maxWidth = repp->name().length();
@@ -135,16 +135,16 @@ class StatsReport {
}
// Header
os<<" Stat "<<std::left<<std::setw(maxWidth-5-2)<<"";
os << " Stat " << std::left << std::setw(maxWidth - 5 - 2) << "";
for (Stages::const_iterator it = stages.begin(); it != stages.end(); ++it) {
os<<" "<<std::left<<std::setw(9)<<*it;
os << " " << std::left << std::setw(9) << *it;
}
os<<endl;
os<<" -------- "<<std::left<<std::setw(maxWidth-5-2)<<"";
os << endl;
os << " -------- " << std::left << std::setw(maxWidth - 5 - 2) << "";
for (Stages::const_iterator it = stages.begin(); it != stages.end(); ++it) {
os<<" "<<std::left<<std::setw(9)<<"-------";
os << " " << std::left << std::setw(9) << "-------";
}
//os<<endl;
// os<<endl;
// Print organized by stage
string lastName = "__NONE__";
@@ -157,33 +157,29 @@ class StatsReport {
{
string commaName = lastName;
string::size_type pos;
if ((pos = commaName.find(',')) != string::npos) {
commaName.erase(pos);
}
if ((pos = commaName.find(',')) != string::npos) commaName.erase(pos);
if (lastCommaName != commaName) {
lastCommaName = commaName;
os<<endl;
os << endl;
}
}
os<<endl;
os << endl;
col = 0;
os<<" "<<std::left<<std::setw(maxWidth)<<repp->name();
os << " " << std::left << std::setw(maxWidth) << repp->name();
}
while (col<stages.size() && stages.at(col) != repp->stage()) {
os<<std::setw(11)<<"";
while (col < stages.size() && stages.at(col) != repp->stage()) {
os << std::setw(11) << "";
col++;
}
repp->dump(os);
col++;
}
os<<endl;
os << endl;
}
public:
// METHODS
static void addStat(const V3Statistic& stat) {
s_allStats.push_back(stat);
}
static void addStat(const V3Statistic& stat) { s_allStats.push_back(stat); }
// CONSTRUCTORS
explicit StatsReport(std::ofstream* aofp)
@@ -196,52 +192,51 @@ public:
~StatsReport() {}
};
StatsReport::StatColl StatsReport::s_allStats;
StatsReport::StatColl StatsReport::s_allStats;
//######################################################################
// V3Statstic class
void V3Statistic::dump(std::ofstream& os) const {
if (perf()) {
os<<" "<<std::right<<std::fixed<<std::setprecision(6)<<std::setw(9)<<count();
os << " " << std::right << std::fixed << std::setprecision(6) << std::setw(9) << count();
} else {
os<<" "<<std::right<<std::fixed<<std::setprecision(0)<<std::setw(9)<<count();
os << " " << std::right << std::fixed << std::setprecision(0) << std::setw(9) << count();
}
}
//######################################################################
// Top Stats class
void V3Stats::addStat(const V3Statistic& stat) {
StatsReport::addStat(stat);
}
void V3Stats::addStat(const V3Statistic& stat) { StatsReport::addStat(stat); }
void V3Stats::statsStage(const string& name) {
static double lastWallTime = -1;
static int fileNumber = 0;
char digits[100]; sprintf(digits, "%03d", ++fileNumber);
const string digitName = string(digits)+"_"+name;
char digits[100];
sprintf(digits, "%03d", ++fileNumber);
const string digitName = string(digits) + "_" + name;
double wallTime = V3Os::timeUsecs() / 1.0e6;
if (lastWallTime<0) lastWallTime = wallTime;
if (lastWallTime < 0) lastWallTime = wallTime;
double wallTimeDelta = wallTime - lastWallTime;
lastWallTime = wallTime;
V3Stats::addStatPerf("Stage, Elapsed time (sec), "+digitName, wallTimeDelta);
V3Stats::addStatPerf("Stage, Elapsed time (sec), " + digitName, wallTimeDelta);
double memory = V3Os::memUsageBytes()/1024.0/1024.0;
V3Stats::addStatPerf("Stage, Memory (MB), "+digitName, memory);
double memory = V3Os::memUsageBytes() / 1024.0 / 1024.0;
V3Stats::addStatPerf("Stage, Memory (MB), " + digitName, memory);
}
void V3Stats::statsReport() {
UINFO(2,__FUNCTION__<<": "<<endl);
UINFO(2, __FUNCTION__ << ": " << endl);
// Open stats file
string filename = v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__stats.txt";
std::ofstream* ofp (V3File::new_ofstream(filename));
if (ofp->fail()) v3fatal("Can't write "<<filename);
string filename = v3Global.opt.makeDir() + "/" + v3Global.opt.prefix() + "__stats.txt";
std::ofstream* ofp(V3File::new_ofstream(filename));
if (ofp->fail()) v3fatal("Can't write " << filename);
StatsReport reporter (ofp);
StatsReport reporter(ofp);
// Cleanup
ofp->close();