Title: [265131] trunk/Source/WTF
Revision
265131
Author
[email protected]
Date
2020-07-30 21:49:30 -0700 (Thu, 30 Jul 2020)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (265130 => 265131)


--- trunk/Source/WTF/ChangeLog	2020-07-31 04:43:22 UTC (rev 265130)
+++ trunk/Source/WTF/ChangeLog	2020-07-31 04:49:30 UTC (rev 265131)
@@ -1,3 +1,16 @@
+2020-07-30  Simon Fraser  <[email protected]>
+
+        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):
+
 2020-07-30  Keith Miller  <[email protected]>
 
         Remove UB from nonPACBitsMask computation

Modified: trunk/Source/WTF/wtf/TimingScope.cpp (265130 => 265131)


--- trunk/Source/WTF/wtf/TimingScope.cpp	2020-07-31 04:43:22 UTC (rev 265130)
+++ trunk/Source/WTF/wtf/TimingScope.cpp	2020-07-31 04:49:30 UTC (rev 265131)
@@ -41,6 +41,7 @@
     struct CallData {
         Seconds totalDuration;
         unsigned callCount { 0 };
+        Seconds maxDuration;
         
         Seconds meanDuration() const { return totalDuration / callCount; }
     };
@@ -52,6 +53,7 @@
         auto locker = holdLock(lock);
         auto& result = totals.add(name, CallData()).iterator->value;
         ++result.callCount;
+        result.maxDuration = std::max(result.maxDuration, duration);
         result.totalDuration += duration;
         return result;
     }
@@ -73,7 +75,7 @@
 {
     const auto& data = "" MonotonicTime::now() - m_startTime);
     if (!(data.callCount % m_logIterationInterval))
-        WTFLogAlways("%s: %u calls, mean duration: %.6fms, total duration: %.6fms", m_name, data.callCount, data.meanDuration().milliseconds(), data.totalDuration.milliseconds());
+        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());
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to