Changeset 265131 in webkit


Ignore:
Timestamp:
Jul 30, 2020 9:49:30 PM (4 years ago)
Author:
Simon Fraser
Message:

Have TimingScope track the max event duration
https://bugs.webkit.org/show_bug.cgi?id=215006

Reviewed by Tim Horton.

Have TimingScope track and print the longest event, as well as the count and
mean duration.

  • wtf/TimingScope.cpp:

(WTF::TimingScope::scopeDidEnd):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r265122 r265131  
     12020-07-30  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Have TimingScope track the max event duration
     4        https://bugs.webkit.org/show_bug.cgi?id=215006
     5
     6        Reviewed by Tim Horton.
     7
     8        Have TimingScope track and print the longest event, as well as the count and
     9        mean duration.
     10
     11        * wtf/TimingScope.cpp:
     12        (WTF::TimingScope::scopeDidEnd):
     13
    1142020-07-30  Keith Miller  <keith_miller@apple.com>
    215
  • trunk/Source/WTF/wtf/TimingScope.cpp

    r245061 r265131  
    4242        Seconds totalDuration;
    4343        unsigned callCount { 0 };
     44        Seconds maxDuration;
    4445       
    4546        Seconds meanDuration() const { return totalDuration / callCount; }
     
    5354        auto& result = totals.add(name, CallData()).iterator->value;
    5455        ++result.callCount;
     56        result.maxDuration = std::max(result.maxDuration, duration);
    5557        result.totalDuration += duration;
    5658        return result;
     
    7476    const auto& data = state().addToTotal(m_name, MonotonicTime::now() - m_startTime);
    7577    if (!(data.callCount % m_logIterationInterval))
    76         WTFLogAlways("%s: %u calls, mean duration: %.6fms, total duration: %.6fms", m_name, data.callCount, data.meanDuration().milliseconds(), data.totalDuration.milliseconds());
     78        WTFLogAlways("%s: %u calls, mean duration: %.6fms, total duration: %.6fms, max duration %.6fms", m_name, data.callCount, data.meanDuration().milliseconds(), data.totalDuration.milliseconds(), data.maxDuration.milliseconds());
    7779}
    7880
Note: See TracChangeset for help on using the changeset viewer.