Test commit. Removes some spaces. No functionality changed.
Summary: Test commit. Removes some spaces. No functionality changed. Reviewers: llvm-commits Differential Revision: http://reviews.llvm.org/D20972 llvm-svn: 271711
This commit is contained in:
parent
d45a277fea
commit
8c9ad10a7f
|
@ -79,7 +79,7 @@ static TimerGroup *getDefaultTimerGroup() {
|
||||||
TimerGroup *tmp = DefaultTimerGroup;
|
TimerGroup *tmp = DefaultTimerGroup;
|
||||||
sys::MemoryFence();
|
sys::MemoryFence();
|
||||||
if (tmp) return tmp;
|
if (tmp) return tmp;
|
||||||
|
|
||||||
sys::SmartScopedLock<true> Lock(*TimerLock);
|
sys::SmartScopedLock<true> Lock(*TimerLock);
|
||||||
tmp = DefaultTimerGroup;
|
tmp = DefaultTimerGroup;
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
|
@ -120,7 +120,7 @@ static inline size_t getMemUsage() {
|
||||||
TimeRecord TimeRecord::getCurrentTime(bool Start) {
|
TimeRecord TimeRecord::getCurrentTime(bool Start) {
|
||||||
TimeRecord Result;
|
TimeRecord Result;
|
||||||
sys::TimeValue now(0,0), user(0,0), sys(0,0);
|
sys::TimeValue now(0,0), user(0,0), sys(0,0);
|
||||||
|
|
||||||
if (Start) {
|
if (Start) {
|
||||||
Result.MemUsed = getMemUsage();
|
Result.MemUsed = getMemUsage();
|
||||||
sys::Process::GetTimeUsage(now, user, sys);
|
sys::Process::GetTimeUsage(now, user, sys);
|
||||||
|
@ -168,9 +168,9 @@ void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
|
||||||
if (Total.getProcessTime())
|
if (Total.getProcessTime())
|
||||||
printVal(getProcessTime(), Total.getProcessTime(), OS);
|
printVal(getProcessTime(), Total.getProcessTime(), OS);
|
||||||
printVal(getWallTime(), Total.getWallTime(), OS);
|
printVal(getWallTime(), Total.getWallTime(), OS);
|
||||||
|
|
||||||
OS << " ";
|
OS << " ";
|
||||||
|
|
||||||
if (Total.getMemUsed())
|
if (Total.getMemUsed())
|
||||||
OS << format("%9" PRId64 " ", (int64_t)getMemUsed());
|
OS << format("%9" PRId64 " ", (int64_t)getMemUsed());
|
||||||
}
|
}
|
||||||
|
@ -192,15 +192,15 @@ public:
|
||||||
I = Map.begin(), E = Map.end(); I != E; ++I)
|
I = Map.begin(), E = Map.end(); I != E; ++I)
|
||||||
delete I->second.first;
|
delete I->second.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer &get(StringRef Name, StringRef GroupName) {
|
Timer &get(StringRef Name, StringRef GroupName) {
|
||||||
sys::SmartScopedLock<true> L(*TimerLock);
|
sys::SmartScopedLock<true> L(*TimerLock);
|
||||||
|
|
||||||
std::pair<TimerGroup*, Name2TimerMap> &GroupEntry = Map[GroupName];
|
std::pair<TimerGroup*, Name2TimerMap> &GroupEntry = Map[GroupName];
|
||||||
|
|
||||||
if (!GroupEntry.first)
|
if (!GroupEntry.first)
|
||||||
GroupEntry.first = new TimerGroup(GroupName);
|
GroupEntry.first = new TimerGroup(GroupName);
|
||||||
|
|
||||||
Timer &T = GroupEntry.second[Name];
|
Timer &T = GroupEntry.second[Name];
|
||||||
if (!T.isInitialized())
|
if (!T.isInitialized())
|
||||||
T.init(Name, *GroupEntry.first);
|
T.init(Name, *GroupEntry.first);
|
||||||
|
@ -215,7 +215,7 @@ static ManagedStatic<Name2PairMap> NamedGroupedTimers;
|
||||||
|
|
||||||
static Timer &getNamedRegionTimer(StringRef Name) {
|
static Timer &getNamedRegionTimer(StringRef Name) {
|
||||||
sys::SmartScopedLock<true> L(*TimerLock);
|
sys::SmartScopedLock<true> L(*TimerLock);
|
||||||
|
|
||||||
Timer &T = (*NamedTimers)[Name];
|
Timer &T = (*NamedTimers)[Name];
|
||||||
if (!T.isInitialized())
|
if (!T.isInitialized())
|
||||||
T.init(Name);
|
T.init(Name);
|
||||||
|
@ -240,7 +240,7 @@ static TimerGroup *TimerGroupList = nullptr;
|
||||||
|
|
||||||
TimerGroup::TimerGroup(StringRef name)
|
TimerGroup::TimerGroup(StringRef name)
|
||||||
: Name(name.begin(), name.end()), FirstTimer(nullptr) {
|
: Name(name.begin(), name.end()), FirstTimer(nullptr) {
|
||||||
|
|
||||||
// Add the group to TimerGroupList.
|
// Add the group to TimerGroupList.
|
||||||
sys::SmartScopedLock<true> L(*TimerLock);
|
sys::SmartScopedLock<true> L(*TimerLock);
|
||||||
if (TimerGroupList)
|
if (TimerGroupList)
|
||||||
|
@ -255,7 +255,7 @@ TimerGroup::~TimerGroup() {
|
||||||
// print the timing data.
|
// print the timing data.
|
||||||
while (FirstTimer)
|
while (FirstTimer)
|
||||||
removeTimer(*FirstTimer);
|
removeTimer(*FirstTimer);
|
||||||
|
|
||||||
// Remove the group from the TimerGroupList.
|
// Remove the group from the TimerGroupList.
|
||||||
sys::SmartScopedLock<true> L(*TimerLock);
|
sys::SmartScopedLock<true> L(*TimerLock);
|
||||||
*Prev = Next;
|
*Prev = Next;
|
||||||
|
@ -266,18 +266,18 @@ TimerGroup::~TimerGroup() {
|
||||||
|
|
||||||
void TimerGroup::removeTimer(Timer &T) {
|
void TimerGroup::removeTimer(Timer &T) {
|
||||||
sys::SmartScopedLock<true> L(*TimerLock);
|
sys::SmartScopedLock<true> L(*TimerLock);
|
||||||
|
|
||||||
// If the timer was started, move its data to TimersToPrint.
|
// If the timer was started, move its data to TimersToPrint.
|
||||||
if (T.hasTriggered())
|
if (T.hasTriggered())
|
||||||
TimersToPrint.emplace_back(T.Time, T.Name);
|
TimersToPrint.emplace_back(T.Time, T.Name);
|
||||||
|
|
||||||
T.TG = nullptr;
|
T.TG = nullptr;
|
||||||
|
|
||||||
// Unlink the timer from our list.
|
// Unlink the timer from our list.
|
||||||
*T.Prev = T.Next;
|
*T.Prev = T.Next;
|
||||||
if (T.Next)
|
if (T.Next)
|
||||||
T.Next->Prev = T.Prev;
|
T.Next->Prev = T.Prev;
|
||||||
|
|
||||||
// Print the report when all timers in this group are destroyed if some of
|
// Print the report when all timers in this group are destroyed if some of
|
||||||
// them were started.
|
// them were started.
|
||||||
if (FirstTimer || TimersToPrint.empty())
|
if (FirstTimer || TimersToPrint.empty())
|
||||||
|
@ -289,7 +289,7 @@ void TimerGroup::removeTimer(Timer &T) {
|
||||||
|
|
||||||
void TimerGroup::addTimer(Timer &T) {
|
void TimerGroup::addTimer(Timer &T) {
|
||||||
sys::SmartScopedLock<true> L(*TimerLock);
|
sys::SmartScopedLock<true> L(*TimerLock);
|
||||||
|
|
||||||
// Add the timer to our list.
|
// Add the timer to our list.
|
||||||
if (FirstTimer)
|
if (FirstTimer)
|
||||||
FirstTimer->Prev = &T.Next;
|
FirstTimer->Prev = &T.Next;
|
||||||
|
@ -301,11 +301,11 @@ void TimerGroup::addTimer(Timer &T) {
|
||||||
void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
|
void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
|
||||||
// Sort the timers in descending order by amount of time taken.
|
// Sort the timers in descending order by amount of time taken.
|
||||||
std::sort(TimersToPrint.begin(), TimersToPrint.end());
|
std::sort(TimersToPrint.begin(), TimersToPrint.end());
|
||||||
|
|
||||||
TimeRecord Total;
|
TimeRecord Total;
|
||||||
for (auto &RecordNamePair : TimersToPrint)
|
for (auto &RecordNamePair : TimersToPrint)
|
||||||
Total += RecordNamePair.first;
|
Total += RecordNamePair.first;
|
||||||
|
|
||||||
// Print out timing header.
|
// Print out timing header.
|
||||||
OS << "===" << std::string(73, '-') << "===\n";
|
OS << "===" << std::string(73, '-') << "===\n";
|
||||||
// Figure out how many spaces to indent TimerGroup name.
|
// Figure out how many spaces to indent TimerGroup name.
|
||||||
|
@ -313,7 +313,7 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
|
||||||
if (Padding > 80) Padding = 0; // Don't allow "negative" numbers
|
if (Padding > 80) Padding = 0; // Don't allow "negative" numbers
|
||||||
OS.indent(Padding) << Name << '\n';
|
OS.indent(Padding) << Name << '\n';
|
||||||
OS << "===" << std::string(73, '-') << "===\n";
|
OS << "===" << std::string(73, '-') << "===\n";
|
||||||
|
|
||||||
// If this is not an collection of ungrouped times, print the total time.
|
// If this is not an collection of ungrouped times, print the total time.
|
||||||
// Ungrouped timers don't really make sense to add up. We still print the
|
// Ungrouped timers don't really make sense to add up. We still print the
|
||||||
// TOTAL line to make the percentages make sense.
|
// TOTAL line to make the percentages make sense.
|
||||||
|
@ -321,7 +321,7 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
|
||||||
OS << format(" Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
|
OS << format(" Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
|
||||||
Total.getProcessTime(), Total.getWallTime());
|
Total.getProcessTime(), Total.getWallTime());
|
||||||
OS << '\n';
|
OS << '\n';
|
||||||
|
|
||||||
if (Total.getUserTime())
|
if (Total.getUserTime())
|
||||||
OS << " ---User Time---";
|
OS << " ---User Time---";
|
||||||
if (Total.getSystemTime())
|
if (Total.getSystemTime())
|
||||||
|
@ -332,18 +332,18 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
|
||||||
if (Total.getMemUsed())
|
if (Total.getMemUsed())
|
||||||
OS << " ---Mem---";
|
OS << " ---Mem---";
|
||||||
OS << " --- Name ---\n";
|
OS << " --- Name ---\n";
|
||||||
|
|
||||||
// Loop through all of the timing data, printing it out.
|
// Loop through all of the timing data, printing it out.
|
||||||
for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i) {
|
for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i) {
|
||||||
const std::pair<TimeRecord, std::string> &Entry = TimersToPrint[e-i-1];
|
const std::pair<TimeRecord, std::string> &Entry = TimersToPrint[e-i-1];
|
||||||
Entry.first.print(Total, OS);
|
Entry.first.print(Total, OS);
|
||||||
OS << Entry.second << '\n';
|
OS << Entry.second << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
Total.print(Total, OS);
|
Total.print(Total, OS);
|
||||||
OS << "Total\n\n";
|
OS << "Total\n\n";
|
||||||
OS.flush();
|
OS.flush();
|
||||||
|
|
||||||
TimersToPrint.clear();
|
TimersToPrint.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue