diff options
-rw-r--r-- | openmp/runtime/src/kmp_stats.cpp | 48 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_stats.h | 4 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_stats_timing.cpp | 16 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_stats_timing.h | 12 |
4 files changed, 40 insertions, 40 deletions
diff --git a/openmp/runtime/src/kmp_stats.cpp b/openmp/runtime/src/kmp_stats.cpp index 0fa7a96d2e4..ffb9b90adf9 100644 --- a/openmp/runtime/src/kmp_stats.cpp +++ b/openmp/runtime/src/kmp_stats.cpp @@ -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.6, 0.0}, // orange {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.6, 0.2, 0.8}, // purple {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 result = formatSI(sampleCount,9,' '); - + if (sampleCount == 0) { 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 ************* */ -void explicitTimer::start(timer_e timerEnumValue) { - startTime = tsc_tick_count::now(); +void explicitTimer::start(timer_e timerEnumValue) { + startTime = tsc_tick_count::now(); if(timeStat::logEvent(timerEnumValue)) { __kmp_stats_thread_ptr->incrementNestValue(); } @@ -173,12 +173,12 @@ void explicitTimer::stop(timer_e timerEnumValue) { stat->addSample ((finishTime - startTime).ticks()); 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(); } /* We accept the risk that we drop a sample because it really did start at t==0. */ - startTime = 0; + startTime = 0; return; } @@ -194,7 +194,7 @@ void kmp_stats_event_vector::deallocate() { // 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 -// or zero if event1 == event2. +// or zero if event1 == event2. // This sorts by start time (lowest to highest). int compare_two_events(const void* event1, const void* event2) { kmp_stats_event* ev1 = (kmp_stats_event*)event1; @@ -213,7 +213,7 @@ void kmp_stats_event_vector::sort() { /* ************* kmp_stats_list member functions ************* */ // 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)); // placement new, only requires space and pointer and initializes (so __kmp_allocate instead of C++ new[] is used) new (newnode) kmp_stats_list(); @@ -256,7 +256,7 @@ int kmp_stats_list::size() { /* ********************************************************************* */ /* ************* 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 kmp_stats_list::iterator::operator++() { this->ptr = this->ptr->next; @@ -275,10 +275,10 @@ kmp_stats_list::iterator kmp_stats_list::iterator::operator--(int dummy) { return *this; } 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) { - return this->ptr==rhs.ptr; + return this->ptr==rhs.ptr; } kmp_stats_list* kmp_stats_list::iterator::operator*() const { return this->ptr; @@ -294,7 +294,7 @@ int kmp_stats_output_module::printPerThreadFlag = 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 -void kmp_stats_output_module::init() +void kmp_stats_output_module::init() { char * statsFileName = getenv("KMP_STATS_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++) { kmp_stats_event ev = theEvents->at(i); rgb_color color = getEventColor(ev.getTimerName()); - fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n", - gtid, - ev.getStart(), - ev.getStop(), + fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n", + gtid, + ev.getStart(), + ev.getStop(), 1.2 - (ev.getNestLevel() * 0.2), color.r, color.g, color.b, 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() { - // 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". // If the timer wasn't running, this won't record anything anyway. kmp_stats_list::iterator it; @@ -410,7 +410,7 @@ void kmp_stats_output_module::printPloticusFile() { " scale: 1.0\n\n"); fprintf(plotOut, "#proc getdata\n" - " file: %s\n\n", + " file: %s\n\n", eventsFileName); fprintf(plotOut, "#proc areadef\n" @@ -418,7 +418,7 @@ void kmp_stats_output_module::printPloticusFile() { " titledetails: align=center size=16\n" " rectangle: 1 1 13 9\n" " xautorange: datafield=2,3\n" - " yautorange: -1 %d\n\n", + " yautorange: -1 %d\n\n", size); fprintf(plotOut, "#proc xaxis\n" @@ -432,7 +432,7 @@ void kmp_stats_output_module::printPloticusFile() { " stubrange: 0 %d\n" " stubdetails: size=12\n" " label: Thread #\n" - " labeldetails: size=14\n\n", + " labeldetails: size=14\n\n", size-1); fprintf(plotOut, "#proc bars\n" @@ -489,7 +489,7 @@ void kmp_stats_output_module::printHeaderInfo(FILE * statsOut) #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 // 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 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 - ) + ) { continue; } @@ -615,9 +615,9 @@ void __kmp_accumulate_stats_at_exit(void) __kmp_output_stats("Statistics on exit"); } -void __kmp_stats_init(void) +void __kmp_stats_init(void) { } -} // extern "C" +} // extern "C" diff --git a/openmp/runtime/src/kmp_stats.h b/openmp/runtime/src/kmp_stats.h index 32841ab9d56..0377fcf9ed9 100644 --- a/openmp/runtime/src/kmp_stats.h +++ b/openmp/runtime/src/kmp_stats.h @@ -176,7 +176,7 @@ enum stats_flags_e { macro (USER_launch_thread_loop, stats_flags_e::logEvent, arg) \ macro (KMP_allocate_team, 0, arg) \ macro (KMP_setup_icv_copy, 0, arg) \ - macro (USER_icv_copy, 0, arg) + macro (USER_icv_copy, 0, arg) #else # define KMP_FOREACH_DEVELOPER_TIMER(macro, arg) #endif @@ -210,7 +210,7 @@ enum stats_flags_e { # define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) \ macro(USER_launch_thread_loop, stats_flags_e::logEvent, arg) #else -# define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) +# define KMP_FOREACH_EXPLICIT_DEVELOPER_TIMER(macro, arg) #endif #define ENUMERATE(name,ignore,prefix) prefix##name, diff --git a/openmp/runtime/src/kmp_stats_timing.cpp b/openmp/runtime/src/kmp_stats_timing.cpp index 40e29eb0d8d..84ef70cc08f 100644 --- a/openmp/runtime/src/kmp_stats_timing.cpp +++ b/openmp/runtime/src/kmp_stats_timing.cpp @@ -54,14 +54,14 @@ double tsc_tick_count::tick_time() char * start = &brand[0]; for (;*start == ' '; start++) ; - + char * end = brand + KMP_STRLEN(brand) - 3; uint64_t multiplier; if (*end == 'M') multiplier = 1000LL*1000LL; else if (*end == 'G') multiplier = 1000LL*1000LL*1000LL; else if (*end == 'T') multiplier = 1000LL*1000LL*1000LL*1000LL; - else + else { cout << "Error determining multiplier '" << *end << "'\n"; exit (-1); @@ -69,9 +69,9 @@ double tsc_tick_count::tick_time() *end = 0; while (*end != ' ') end--; end++; - + double freq = strtod(end, &start); - if (freq == 0.0) + if (freq == 0.0) { cout << "Error calculating frequency " << end << "\n"; exit (-1); @@ -95,7 +95,7 @@ std::string formatSI(double interval, int width, char unit) if (useSI) { // 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[] = { {1.e12,'f'}, {1.e9, 'p'}, @@ -112,7 +112,7 @@ std::string formatSI(double interval, int width, char unit) {1.e-24,'Z'}, {1.e-27,'Y'} }; - + if (interval == 0.0) { 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; interval = -interval; } - + for (int i=0; i<(int)(sizeof(ranges)/sizeof(ranges[0])); i++) { if (interval*ranges[i].scale < 1.e0) { 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; return os.str(); diff --git a/openmp/runtime/src/kmp_stats_timing.h b/openmp/runtime/src/kmp_stats_timing.h index b878bbd620d..c65a444cac0 100644 --- a/openmp/runtime/src/kmp_stats_timing.h +++ b/openmp/runtime/src/kmp_stats_timing.h @@ -56,11 +56,11 @@ class tsc_tick_count { #endif tsc_tick_count(int64_t value) : my_count(value) {}; int64_t getValue() const { return my_count; } - tsc_tick_count later (tsc_tick_count const other) const { - return my_count > other.my_count ? (*this) : other; + tsc_tick_count later (tsc_tick_count const other) const { + return my_count > other.my_count ? (*this) : other; } - tsc_tick_count earlier(tsc_tick_count const other) const { - return my_count < other.my_count ? (*this) : other; + tsc_tick_count earlier(tsc_tick_count const other) const { + return my_count < other.my_count ? (*this) : other; } #if KMP_HAVE_TICK_TIME 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); }; -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 ); } #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(); } |