[STATS] Remove trailing whitespace in stats source files

llvm-svn: 265437
This commit is contained in:
Jonathan Peyton 2016-04-05 18:48:48 +00:00
parent 19dafbd211
commit 072772bf05
4 changed files with 40 additions and 40 deletions

View File

@ -48,7 +48,7 @@ const kmp_stats_output_module::rgb_color kmp_stats_output_module::globalColorArr
{1.0, 0.0, 0.0}, // red {1.0, 0.0, 0.0}, // red
{1.0, 0.6, 0.0}, // orange {1.0, 0.6, 0.0}, // orange
{1.0, 1.0, 0.0}, // yellow {1.0, 1.0, 0.0}, // yellow
{0.0, 1.0, 0.0}, // green {0.0, 1.0, 0.0}, // green
{0.0, 0.0, 1.0}, // blue {0.0, 0.0, 1.0}, // blue
{0.6, 0.2, 0.8}, // purple {0.6, 0.2, 0.8}, // purple
{1.0, 0.0, 1.0}, // magenta {1.0, 0.0, 1.0}, // magenta
@ -130,7 +130,7 @@ void statistic::scale(double factor)
std::string statistic::format(char unit, bool total) const std::string statistic::format(char unit, bool total) const
{ {
std::string result = formatSI(sampleCount,9,' '); std::string result = formatSI(sampleCount,9,' ');
if (sampleCount == 0) if (sampleCount == 0)
{ {
result = result + std::string(", ") + formatSI(0.0, 9, unit); result = result + std::string(", ") + formatSI(0.0, 9, unit);
@ -155,8 +155,8 @@ std::string statistic::format(char unit, bool total) const
/* ********************************************************** */ /* ********************************************************** */
/* ************* explicitTimer member functions ************* */ /* ************* explicitTimer member functions ************* */
void explicitTimer::start(timer_e timerEnumValue) { void explicitTimer::start(timer_e timerEnumValue) {
startTime = tsc_tick_count::now(); startTime = tsc_tick_count::now();
if(timeStat::logEvent(timerEnumValue)) { if(timeStat::logEvent(timerEnumValue)) {
__kmp_stats_thread_ptr->incrementNestValue(); __kmp_stats_thread_ptr->incrementNestValue();
} }
@ -173,12 +173,12 @@ void explicitTimer::stop(timer_e timerEnumValue) {
stat->addSample ((finishTime - startTime).ticks()); stat->addSample ((finishTime - startTime).ticks());
if(timeStat::logEvent(timerEnumValue)) { if(timeStat::logEvent(timerEnumValue)) {
__kmp_stats_thread_ptr->push_event(startTime.getValue() - __kmp_stats_start_time.getValue(), finishTime.getValue() - __kmp_stats_start_time.getValue(), __kmp_stats_thread_ptr->getNestValue(), timerEnumValue); __kmp_stats_thread_ptr->push_event(startTime.getValue() - __kmp_stats_start_time.getValue(), finishTime.getValue() - __kmp_stats_start_time.getValue(), __kmp_stats_thread_ptr->getNestValue(), timerEnumValue);
__kmp_stats_thread_ptr->decrementNestValue(); __kmp_stats_thread_ptr->decrementNestValue();
} }
/* We accept the risk that we drop a sample because it really did start at t==0. */ /* We accept the risk that we drop a sample because it really did start at t==0. */
startTime = 0; startTime = 0;
return; return;
} }
@ -194,7 +194,7 @@ void kmp_stats_event_vector::deallocate() {
// This function is for qsort() which requires the compare function to return // This function is for qsort() which requires the compare function to return
// either a negative number if event1 < event2, a positive number if event1 > event2 // either a negative number if event1 < event2, a positive number if event1 > event2
// or zero if event1 == event2. // or zero if event1 == event2.
// This sorts by start time (lowest to highest). // This sorts by start time (lowest to highest).
int compare_two_events(const void* event1, const void* event2) { int compare_two_events(const void* event1, const void* event2) {
kmp_stats_event* ev1 = (kmp_stats_event*)event1; kmp_stats_event* ev1 = (kmp_stats_event*)event1;
@ -213,7 +213,7 @@ void kmp_stats_event_vector::sort() {
/* ************* kmp_stats_list member functions ************* */ /* ************* kmp_stats_list member functions ************* */
// returns a pointer to newly created stats node // returns a pointer to newly created stats node
kmp_stats_list* kmp_stats_list::push_back(int gtid) { kmp_stats_list* kmp_stats_list::push_back(int gtid) {
kmp_stats_list* newnode = (kmp_stats_list*)__kmp_allocate(sizeof(kmp_stats_list)); kmp_stats_list* newnode = (kmp_stats_list*)__kmp_allocate(sizeof(kmp_stats_list));
// placement new, only requires space and pointer and initializes (so __kmp_allocate instead of C++ new[] is used) // placement new, only requires space and pointer and initializes (so __kmp_allocate instead of C++ new[] is used)
new (newnode) kmp_stats_list(); new (newnode) kmp_stats_list();
@ -256,7 +256,7 @@ int kmp_stats_list::size() {
/* ********************************************************************* */ /* ********************************************************************* */
/* ************* kmp_stats_list::iterator member functions ************* */ /* ************* kmp_stats_list::iterator member functions ************* */
kmp_stats_list::iterator::iterator() : ptr(NULL) {} kmp_stats_list::iterator::iterator() : ptr(NULL) {}
kmp_stats_list::iterator::~iterator() {} kmp_stats_list::iterator::~iterator() {}
kmp_stats_list::iterator kmp_stats_list::iterator::operator++() { kmp_stats_list::iterator kmp_stats_list::iterator::operator++() {
this->ptr = this->ptr->next; this->ptr = this->ptr->next;
@ -275,10 +275,10 @@ kmp_stats_list::iterator kmp_stats_list::iterator::operator--(int dummy) {
return *this; return *this;
} }
bool kmp_stats_list::iterator::operator!=(const kmp_stats_list::iterator & rhs) { bool kmp_stats_list::iterator::operator!=(const kmp_stats_list::iterator & rhs) {
return this->ptr!=rhs.ptr; return this->ptr!=rhs.ptr;
} }
bool kmp_stats_list::iterator::operator==(const kmp_stats_list::iterator & rhs) { bool kmp_stats_list::iterator::operator==(const kmp_stats_list::iterator & rhs) {
return this->ptr==rhs.ptr; return this->ptr==rhs.ptr;
} }
kmp_stats_list* kmp_stats_list::iterator::operator*() const { kmp_stats_list* kmp_stats_list::iterator::operator*() const {
return this->ptr; return this->ptr;
@ -294,7 +294,7 @@ int kmp_stats_output_module::printPerThreadFlag = 0;
int kmp_stats_output_module::printPerThreadEventsFlag = 0; int kmp_stats_output_module::printPerThreadEventsFlag = 0;
// init() is called very near the beginning of execution time in the constructor of __kmp_stats_global_output // init() is called very near the beginning of execution time in the constructor of __kmp_stats_global_output
void kmp_stats_output_module::init() void kmp_stats_output_module::init()
{ {
char * statsFileName = getenv("KMP_STATS_FILE"); char * statsFileName = getenv("KMP_STATS_FILE");
eventsFileName = getenv("KMP_STATS_EVENTS_FILE"); eventsFileName = getenv("KMP_STATS_EVENTS_FILE");
@ -375,10 +375,10 @@ void kmp_stats_output_module::printEvents(FILE* eventsOut, kmp_stats_event_vecto
for (int i = 0; i < theEvents->size(); i++) { for (int i = 0; i < theEvents->size(); i++) {
kmp_stats_event ev = theEvents->at(i); kmp_stats_event ev = theEvents->at(i);
rgb_color color = getEventColor(ev.getTimerName()); rgb_color color = getEventColor(ev.getTimerName());
fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n", fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n",
gtid, gtid,
ev.getStart(), ev.getStart(),
ev.getStop(), ev.getStop(),
1.2 - (ev.getNestLevel() * 0.2), 1.2 - (ev.getNestLevel() * 0.2),
color.r, color.g, color.b, color.r, color.g, color.b,
timeStat::name(ev.getTimerName()) timeStat::name(ev.getTimerName())
@ -389,7 +389,7 @@ void kmp_stats_output_module::printEvents(FILE* eventsOut, kmp_stats_event_vecto
void kmp_stats_output_module::windupExplicitTimers() void kmp_stats_output_module::windupExplicitTimers()
{ {
// Wind up any explicit timers. We assume that it's fair at this point to just walk all the explcit timers in all threads // Wind up any explicit timers. We assume that it's fair at this point to just walk all the explcit timers in all threads
// and say "it's over". // and say "it's over".
// If the timer wasn't running, this won't record anything anyway. // If the timer wasn't running, this won't record anything anyway.
kmp_stats_list::iterator it; kmp_stats_list::iterator it;
@ -410,7 +410,7 @@ void kmp_stats_output_module::printPloticusFile() {
" scale: 1.0\n\n"); " scale: 1.0\n\n");
fprintf(plotOut, "#proc getdata\n" fprintf(plotOut, "#proc getdata\n"
" file: %s\n\n", " file: %s\n\n",
eventsFileName); eventsFileName);
fprintf(plotOut, "#proc areadef\n" fprintf(plotOut, "#proc areadef\n"
@ -418,7 +418,7 @@ void kmp_stats_output_module::printPloticusFile() {
" titledetails: align=center size=16\n" " titledetails: align=center size=16\n"
" rectangle: 1 1 13 9\n" " rectangle: 1 1 13 9\n"
" xautorange: datafield=2,3\n" " xautorange: datafield=2,3\n"
" yautorange: -1 %d\n\n", " yautorange: -1 %d\n\n",
size); size);
fprintf(plotOut, "#proc xaxis\n" fprintf(plotOut, "#proc xaxis\n"
@ -432,7 +432,7 @@ void kmp_stats_output_module::printPloticusFile() {
" stubrange: 0 %d\n" " stubrange: 0 %d\n"
" stubdetails: size=12\n" " stubdetails: size=12\n"
" label: Thread #\n" " label: Thread #\n"
" labeldetails: size=14\n\n", " labeldetails: size=14\n\n",
size-1); size-1);
fprintf(plotOut, "#proc bars\n" fprintf(plotOut, "#proc bars\n"
@ -489,7 +489,7 @@ void kmp_stats_output_module::printHeaderInfo(FILE * statsOut)
#endif #endif
} }
void kmp_stats_output_module::outputStats(const char* heading) void kmp_stats_output_module::outputStats(const char* heading)
{ {
// Stop all the explicit timers in all threads // Stop all the explicit timers in all threads
// Do this before declaring the local statistics because thay have constructors so will take time to create. // Do this before declaring the local statistics because thay have constructors so will take time to create.
@ -532,7 +532,7 @@ void kmp_stats_output_module::outputStats(const char* heading)
// See if we should ignore this timer when aggregating // See if we should ignore this timer when aggregating
if ((timeStat::masterOnly(s) && (t != 0)) || // Timer is only valid on the master and this thread is a worker if ((timeStat::masterOnly(s) && (t != 0)) || // Timer is only valid on the master and this thread is a worker
(timeStat::workerOnly(s) && (t == 0)) // Timer is only valid on a worker and this thread is the master (timeStat::workerOnly(s) && (t == 0)) // Timer is only valid on a worker and this thread is the master
) )
{ {
continue; continue;
} }
@ -615,9 +615,9 @@ void __kmp_accumulate_stats_at_exit(void)
__kmp_output_stats("Statistics on exit"); __kmp_output_stats("Statistics on exit");
} }
void __kmp_stats_init(void) void __kmp_stats_init(void)
{ {
} }
} // extern "C" } // extern "C"

View File

@ -176,7 +176,7 @@ enum stats_flags_e {
macro (USER_launch_thread_loop, stats_flags_e::logEvent, arg) \ macro (USER_launch_thread_loop, stats_flags_e::logEvent, arg) \
macro (KMP_allocate_team, 0, arg) \ macro (KMP_allocate_team, 0, arg) \
macro (KMP_setup_icv_copy, 0, arg) \ macro (KMP_setup_icv_copy, 0, arg) \
macro (USER_icv_copy, 0, arg) macro (USER_icv_copy, 0, arg)
#else #else
# define KMP_FOREACH_DEVELOPER_TIMER(macro, arg) # define KMP_FOREACH_DEVELOPER_TIMER(macro, arg)
#endif #endif
@ -210,7 +210,7 @@ enum stats_flags_e {
# define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) \ # define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) \
macro(USER_launch_thread_loop, stats_flags_e::logEvent, arg) macro(USER_launch_thread_loop, stats_flags_e::logEvent, arg)
#else #else
# define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) # define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg)
#endif #endif
#define ENUMERATE(name,ignore,prefix) prefix##name, #define ENUMERATE(name,ignore,prefix) prefix##name,

View File

@ -54,14 +54,14 @@ double tsc_tick_count::tick_time()
char * start = &brand[0]; char * start = &brand[0];
for (;*start == ' '; start++) for (;*start == ' '; start++)
; ;
char * end = brand + KMP_STRLEN(brand) - 3; char * end = brand + KMP_STRLEN(brand) - 3;
uint64_t multiplier; uint64_t multiplier;
if (*end == 'M') multiplier = 1000LL*1000LL; if (*end == 'M') multiplier = 1000LL*1000LL;
else if (*end == 'G') multiplier = 1000LL*1000LL*1000LL; else if (*end == 'G') multiplier = 1000LL*1000LL*1000LL;
else if (*end == 'T') multiplier = 1000LL*1000LL*1000LL*1000LL; else if (*end == 'T') multiplier = 1000LL*1000LL*1000LL*1000LL;
else else
{ {
cout << "Error determining multiplier '" << *end << "'\n"; cout << "Error determining multiplier '" << *end << "'\n";
exit (-1); exit (-1);
@ -69,9 +69,9 @@ double tsc_tick_count::tick_time()
*end = 0; *end = 0;
while (*end != ' ') end--; while (*end != ' ') end--;
end++; end++;
double freq = strtod(end, &start); double freq = strtod(end, &start);
if (freq == 0.0) if (freq == 0.0)
{ {
cout << "Error calculating frequency " << end << "\n"; cout << "Error calculating frequency " << end << "\n";
exit (-1); exit (-1);
@ -95,7 +95,7 @@ std::string formatSI(double interval, int width, char unit)
if (useSI) if (useSI)
{ {
// Preserve accuracy for small numbers, since we only multiply and the positive powers // Preserve accuracy for small numbers, since we only multiply and the positive powers
// of ten are precisely representable. // of ten are precisely representable.
static struct { double scale; char prefix; } ranges[] = { static struct { double scale; char prefix; } ranges[] = {
{1.e12,'f'}, {1.e12,'f'},
{1.e9, 'p'}, {1.e9, 'p'},
@ -112,7 +112,7 @@ std::string formatSI(double interval, int width, char unit)
{1.e-24,'Z'}, {1.e-24,'Z'},
{1.e-27,'Y'} {1.e-27,'Y'}
}; };
if (interval == 0.0) if (interval == 0.0)
{ {
os << std::setw(width-3) << std::right << "0.00" << std::setw(3) << unit; os << std::setw(width-3) << std::right << "0.00" << std::setw(3) << unit;
@ -125,13 +125,13 @@ std::string formatSI(double interval, int width, char unit)
negative = true; negative = true;
interval = -interval; interval = -interval;
} }
for (int i=0; i<(int)(sizeof(ranges)/sizeof(ranges[0])); i++) for (int i=0; i<(int)(sizeof(ranges)/sizeof(ranges[0])); i++)
{ {
if (interval*ranges[i].scale < 1.e0) if (interval*ranges[i].scale < 1.e0)
{ {
interval = interval * 1000.e0 * ranges[i].scale; interval = interval * 1000.e0 * ranges[i].scale;
os << std::fixed << std::setprecision(2) << std::setw(width-3) << std::right << os << std::fixed << std::setprecision(2) << std::setw(width-3) << std::right <<
(negative ? -interval : interval) << std::setw(2) << ranges[i].prefix << std::setw(1) << unit; (negative ? -interval : interval) << std::setw(2) << ranges[i].prefix << std::setw(1) << unit;
return os.str(); return os.str();

View File

@ -56,11 +56,11 @@ class tsc_tick_count {
#endif #endif
tsc_tick_count(int64_t value) : my_count(value) {}; tsc_tick_count(int64_t value) : my_count(value) {};
int64_t getValue() const { return my_count; } int64_t getValue() const { return my_count; }
tsc_tick_count later (tsc_tick_count const other) const { tsc_tick_count later (tsc_tick_count const other) const {
return my_count > other.my_count ? (*this) : other; return my_count > other.my_count ? (*this) : other;
} }
tsc_tick_count earlier(tsc_tick_count const other) const { tsc_tick_count earlier(tsc_tick_count const other) const {
return my_count < other.my_count ? (*this) : other; return my_count < other.my_count ? (*this) : other;
} }
#if KMP_HAVE_TICK_TIME #if KMP_HAVE_TICK_TIME
static double tick_time(); // returns seconds per cycle (period) of clock static double tick_time(); // returns seconds per cycle (period) of clock
@ -69,13 +69,13 @@ class tsc_tick_count {
friend tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count t1, const tsc_tick_count t0); friend tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count t1, const tsc_tick_count t0);
}; };
inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count t1, const tsc_tick_count t0) inline tsc_tick_count::tsc_interval_t operator-(const tsc_tick_count t1, const tsc_tick_count t0)
{ {
return tsc_tick_count::tsc_interval_t( t1.my_count-t0.my_count ); return tsc_tick_count::tsc_interval_t( t1.my_count-t0.my_count );
} }
#if KMP_HAVE_TICK_TIME #if KMP_HAVE_TICK_TIME
inline double tsc_tick_count::tsc_interval_t::seconds() const inline double tsc_tick_count::tsc_interval_t::seconds() const
{ {
return value*tick_time(); return value*tick_time();
} }