Lines Matching +full:local +full:- +full:timer +full:- +full:stop
5 //===----------------------------------------------------------------------===//
9 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //===----------------------------------------------------------------------===//
81 sample -= offset; in addSample()
84 double delta = sample - meanVal; in addSample()
88 m2 = m2 + delta * (sample - meanVal); in addSample()
110 double delta = other.meanVal - meanVal; in operator +=()
113 // then the compiler would not be able to re-order over brackets. In C++ it in operator +=()
118 meanVal = meanVal * dscBydnsc + other.meanVal * (1 - dscBydnsc); in operator +=()
165 return i - logOffset; in minBin()
167 return -logOffset; in minBin()
172 for (int i = numBins - 1; i >= 0; i--) { in maxBin()
174 return i - logOffset; in maxBin()
176 return -logOffset; in maxBin()
183 // According to a micro-architect this is likely to be faster than a binary in findBin()
185 // it will only have one branch mis-predict in findBin()
186 for (int b = 0; b < numBins - 1; b++) in findBin()
189 return numBins - 1; in findBin()
227 if (i + 1 == numBins - 1) in format()
245 __kmp_stats_thread_ptr->incrementNestValue(); in start()
250 void explicitTimer::stop(tsc_tick_count tick, in stop() function in explicitTimer
255 stat->addSample(((tick - startTime) - totalPauseTime).ticks()); in stop()
260 stats_ptr->push_event( in stop()
261 startTime.getValue() - __kmp_stats_start_time.getValue(), in stop()
262 tick.getValue() - __kmp_stats_start_time.getValue(), in stop()
263 __kmp_stats_thread_ptr->getNestValue(), timerEnumValue); in stop()
264 stats_ptr->decrementNestValue(); in stop()
276 // initialize the partitioned timers to an initial timer
277 void partitionedTimers::init(explicitTimer timer) { in init() argument
278 KMP_DEBUG_ASSERT(this->timer_stack.size() == 0); in init()
279 timer_stack.push_back(timer); in init()
283 // stop/save the current timer, and start the new timer (timer_pair)
284 // There is a special condition where if the current timer is equal to
286 // and it won't stop/start the currently running timer.
287 void partitionedTimers::push(explicitTimer timer) { in push() argument
288 // get the current timer in push()
289 // pause current timer in push()
290 // push new timer in push()
291 // start the new timer in push()
294 KMP_DEBUG_ASSERT(this->timer_stack.size() > 0); in push()
295 timer_stack.push_back(timer); in push()
297 current_timer = &(timer_stack[stack_size - 2]); in push()
298 new_timer = &(timer_stack[stack_size - 1]); in push()
300 current_timer->pause(tick); in push()
301 new_timer->start(tick); in push()
304 // stop/discard the current timer, and start the previously saved timer
306 // get the current timer in pop()
307 // stop current timer (record event/sample) in pop()
308 // pop current timer in pop()
309 // get the new current timer and resume in pop()
313 old_timer = &(timer_stack[stack_size - 1]); in pop()
314 new_timer = &(timer_stack[stack_size - 2]); in pop()
316 old_timer->stop(tick); in pop()
317 new_timer->resume(tick); in pop()
321 void partitionedTimers::exchange(explicitTimer timer) { in exchange() argument
322 // get the current timer in exchange()
323 // stop current timer (record event/sample) in exchange()
324 // push new timer in exchange()
325 // start the new timer in exchange()
328 KMP_DEBUG_ASSERT(this->timer_stack.size() > 0); in exchange()
331 current_timer = &(timer_stack[stack_size - 1]); in exchange()
332 current_timer->stop(tick); in exchange()
334 timer_stack.push_back(timer); in exchange()
335 new_timer = &(timer_stack[stack_size - 1]); in exchange()
336 new_timer->start(tick); in exchange()
345 this->pop(); in windup()
347 // Pop the timer from the init() call in windup()
349 timer_stack.back().stop(tsc_tick_count::now()); in windup()
371 if (ev1->getStart() < ev2->getStart()) in compare_two_events()
372 return -1; in compare_two_events()
373 else if (ev1->getStart() > ev2->getStart()) in compare_two_events()
392 newnode->setGtid(gtid); in push_back()
393 newnode->prev = this->prev; in push_back()
394 newnode->next = this; in push_back()
395 newnode->prev->next = newnode; in push_back()
396 newnode->next->prev = newnode; in push_back()
400 kmp_stats_list *ptr = this->next; in deallocate()
401 kmp_stats_list *delptr = this->next; in deallocate()
404 ptr = ptr->next; in deallocate()
406 delptr->_event_vector.deallocate(); in deallocate()
407 delptr->~kmp_stats_list(); in deallocate()
413 it.ptr = this->next; in begin()
434 this->ptr = this->ptr->next; in operator ++()
438 this->ptr = this->ptr->next; in operator ++()
441 kmp_stats_list::iterator kmp_stats_list::iterator::operator--() { in operator --()
442 this->ptr = this->ptr->prev; in operator --()
445 kmp_stats_list::iterator kmp_stats_list::iterator::operator--(int dummy) { in operator --()
446 this->ptr = this->ptr->prev; in operator --()
450 return this->ptr != rhs.ptr; in operator !=()
453 return this->ptr == rhs.ptr; in operator ==()
456 return this->ptr; in operator *()
468 for (int i = l - 1; i >= 0; --i) { in lastName()
493 buffer[buflen - 1] = char(0); in getImageName()
498 time_t timer; in getTime() local
500 time(&timer); in getTime()
502 struct tm *tm_info = localtime(&timer); in getTime()
504 strftime(buffer, buflen, "%Y-%m-%d_%H%M%S", tm_info); in getTime()
506 strftime(buffer, buflen, "%Y-%m-%d %H%M%S", tm_info); in getTime()
574 // assigns a color to each timer for printing in init()
598 "Timer, SampleCount, Min, " in printTimerStats()
604 fprintf(statsOut, "%-35s, %s\n", timeStat::name(s), in printTimerStats()
605 stat->format(tag, true).c_str()); in printTimerStats()
611 fprintf(statsOut, "Total_%-29s, %s\n", timeStat::name(s), in printTimerStats()
621 if (stat->getCount() != 0) { in printTimerStats()
625 fprintf(statsOut, "%s\n", stat->getHist()->format(tag).c_str()); in printTimerStats()
637 fprintf(statsOut, "%-25s, %s\n", counter::name(counter_e(s)), in printCounterStats()
638 stat->format(' ', true).c_str()); in printCounterStats()
646 if (stat->getCount() != 0) { in printCounterStats()
648 fprintf(statsOut, "%s\n", stat->getHist()->format(' ').c_str()); in printCounterStats()
661 fprintf(statsOut, "%-25s, %s\n", counter::name(counter_e(c)), in printCounters()
662 formatSI((double)stat->getValue(), 9, ' ').c_str()); in printCounters()
670 theEvents->sort(); in printEvents()
671 for (int i = 0; i < theEvents->size(); i++) { in printEvents()
672 kmp_stats_event ev = theEvents->at(i); in printEvents()
677 1.2 - (ev.getNestLevel() * 0.2), color.r, color.g, color.b, in printEvents()
686 // If the timer wasn't running, this won't record anything anyway. in windupExplicitTimers()
688 for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) { in windupExplicitTimers()
690 ptr->getPartitionedTimers()->windup(); in windupExplicitTimers()
691 ptr->endLife(); in windupExplicitTimers()
697 int size = __kmp_stats_list->size(); in printPloticusFile()
714 " yautorange: -1 %d\n\n", in printPloticusFile()
730 size - 1); in printPloticusFile()
739 // create legend entries corresponding to the timer color in printPloticusFile()
795 // Stop all the explicit timers in all threads in outputStats()
796 // Do this before declaring the local statistics because thay have in outputStats()
802 normal timer stats */ in outputStats()
821 for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) { in outputStats()
822 int t = (*it)->getGtid(); in outputStats()
826 printTimerStats(statsOut, (*it)->getTimers(), 0); in outputStats()
827 printCounters(statsOut, (*it)->getCounters()); in outputStats()
832 kmp_stats_event_vector events = (*it)->getEventVector(); in outputStats()
838 // See if we should ignore this timer when aggregating in outputStats()
839 if ((timeStat::masterOnly(s) && (t != 0)) || // Timer only valid on in outputStats()
841 (timeStat::workerOnly(s) && (t == 0)) // Timer only valid on worker in outputStats()
847 statistic *threadStat = (*it)->getTimer(s); in outputStats()
852 totalStats[s].addSample(threadStat->getTotal()); in outputStats()
859 allCounters[c].addSample((double)(*it)->getCounter(c)->getValue()); in outputStats()
881 for (it = __kmp_stats_list->begin(); it != __kmp_stats_list->end(); it++) { in __kmp_reset_stats()
882 timeStat *timers = (*it)->getTimers(); in __kmp_reset_stats()
883 counter *counters = (*it)->getCounters(); in __kmp_reset_stats()
892 (*it)->resetEventVector(); in __kmp_reset_stats()
896 // This function will reset all stats and stop all threads' explicit timers if
899 __kmp_stats_global_output->outputStats(heading); in __kmp_output_stats()
920 __kmp_stats_list->deallocate(); in __kmp_stats_fini()