Title: [184117] trunk/Source
Revision
184117
Author
[email protected]
Date
2015-05-11 13:09:14 -0700 (Mon, 11 May 2015)

Log Message

Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
https://bugs.webkit.org/show_bug.cgi?id=144808

Reviewed by Darin Adler.

Source/_javascript_Core:

Since a profile can be started after a timeline recording has already begun, we can't assume a zero start time.
The start time for the root node's call entry should be based on the stopwatch used by the ProfileGenerator.

* profiler/Profile.cpp:
(JSC::Profile::create):
(JSC::Profile::Profile):
* profiler/Profile.h:
* profiler/ProfileGenerator.cpp:
(JSC::ProfileGenerator::ProfileGenerator):
(JSC::AddParentForConsoleStartFunctor::operator()):

Source/WebCore:

Profiles started from the console should always use the Inspector environment's shared stopwatch.

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::startFromConsole):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (184116 => 184117)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-11 20:09:14 UTC (rev 184117)
@@ -1,3 +1,21 @@
+2015-05-11  Matt Baker  <[email protected]>
+
+        Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=144808
+
+        Reviewed by Darin Adler.
+
+        Since a profile can be started after a timeline recording has already begun, we can't assume a zero start time.
+        The start time for the root node's call entry should be based on the stopwatch used by the ProfileGenerator.
+
+        * profiler/Profile.cpp:
+        (JSC::Profile::create):
+        (JSC::Profile::Profile):
+        * profiler/Profile.h:
+        * profiler/ProfileGenerator.cpp:
+        (JSC::ProfileGenerator::ProfileGenerator):
+        (JSC::AddParentForConsoleStartFunctor::operator()):
+
 2015-05-11  Basile Clement  <[email protected]>
 
         Unreviewed, remove unintended change.

Modified: trunk/Source/_javascript_Core/profiler/Profile.cpp (184116 => 184117)


--- trunk/Source/_javascript_Core/profiler/Profile.cpp	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/_javascript_Core/profiler/Profile.cpp	2015-05-11 20:09:14 UTC (rev 184117)
@@ -27,24 +27,23 @@
 #include "Profile.h"
 
 #include "ProfileNode.h"
-#include <wtf/CurrentTime.h>
 #include <wtf/DataLog.h>
 
 namespace JSC {
 
-PassRefPtr<Profile> Profile::create(const String& title, unsigned uid)
+PassRefPtr<Profile> Profile::create(const String& title, unsigned uid, double startTime)
 {
-    return adoptRef(new Profile(title, uid));
+    return adoptRef(new Profile(title, uid, startTime));
 }
 
-Profile::Profile(const String& title, unsigned uid)
+Profile::Profile(const String& title, unsigned uid, double startTime)
     : m_title(title)
     , m_uid(uid)
 {
     // FIXME: When multi-threading is supported this will be a vector and calls
     // into the profiler will need to know which thread it is executing on.
     m_rootNode = ProfileNode::create(nullptr, CallIdentifier(ASCIILiteral("Thread_1"), String(), 0, 0), nullptr);
-    m_rootNode->appendCall(ProfileNode::Call(0.0));
+    m_rootNode->appendCall(ProfileNode::Call(startTime));
 }
 
 Profile::~Profile()

Modified: trunk/Source/_javascript_Core/profiler/Profile.h (184116 => 184117)


--- trunk/Source/_javascript_Core/profiler/Profile.h	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/_javascript_Core/profiler/Profile.h	2015-05-11 20:09:14 UTC (rev 184117)
@@ -35,7 +35,7 @@
 
 class JS_EXPORT_PRIVATE Profile : public RefCounted<Profile> {
 public:
-    static PassRefPtr<Profile> create(const String& title, unsigned uid);
+    static PassRefPtr<Profile> create(const String& title, unsigned uid, double);
     virtual ~Profile();
 
     const String& title() const { return m_title; }
@@ -50,7 +50,7 @@
 #endif
 
 protected:
-    Profile(const String& title, unsigned uid);
+    Profile(const String& title, unsigned uid, double startTime);
 
 private:
     void removeProfileStart();

Modified: trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp (184116 => 184117)


--- trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp	2015-05-11 20:09:14 UTC (rev 184117)
@@ -51,20 +51,22 @@
     , m_foundConsoleStartParent(false)
     , m_suspended(false)
 {
-    m_profile = Profile::create(title, uid);
+    double startTime = m_stopwatch->elapsedTime();
+    m_profile = Profile::create(title, uid, startTime);
     m_currentNode = m_rootNode = m_profile->rootNode();
     if (exec)
-        addParentForConsoleStart(exec);
+        addParentForConsoleStart(exec, startTime);
 }
 
 class AddParentForConsoleStartFunctor {
 public:
-    AddParentForConsoleStartFunctor(ExecState* exec, RefPtr<ProfileNode>& rootNode, RefPtr<ProfileNode>& currentNode)
+    AddParentForConsoleStartFunctor(ExecState* exec, RefPtr<ProfileNode>& rootNode, RefPtr<ProfileNode>& currentNode, double startTime)
         : m_exec(exec)
         , m_hasSkippedFirstFrame(false)
         , m_foundParent(false)
         , m_rootNode(rootNode)
         , m_currentNode(currentNode)
+        , m_startTime(startTime)
     {
     }
 
@@ -81,9 +83,7 @@
         unsigned column = 0;
         visitor->computeLineAndColumn(line, column);
         m_currentNode = ProfileNode::create(m_exec, LegacyProfiler::createCallIdentifier(m_exec, visitor->callee(), visitor->sourceURL(), line, column), m_rootNode.get());
-        // Assume that profile times are relative to when the |console.profile| command is evaluated.
-        // This matches the logic in JSStartProfiling() and InspectorTimelineAgent::startFromConsole().
-        m_currentNode->appendCall(ProfileNode::Call(0.0));
+        m_currentNode->appendCall(ProfileNode::Call(m_startTime));
         m_rootNode->spliceNode(m_currentNode.get());
 
         m_foundParent = true;
@@ -96,11 +96,12 @@
     bool m_foundParent;
     RefPtr<ProfileNode>& m_rootNode;
     RefPtr<ProfileNode>& m_currentNode;
+    double m_startTime;
 };
 
-void ProfileGenerator::addParentForConsoleStart(ExecState* exec)
+void ProfileGenerator::addParentForConsoleStart(ExecState* exec, double startTime)
 {
-    AddParentForConsoleStartFunctor functor(exec, m_rootNode, m_currentNode);
+    AddParentForConsoleStartFunctor functor(exec, m_rootNode, m_currentNode, startTime);
     exec->iterate(functor);
 
     m_foundConsoleStartParent = functor.foundParent();

Modified: trunk/Source/_javascript_Core/profiler/ProfileGenerator.h (184116 => 184117)


--- trunk/Source/_javascript_Core/profiler/ProfileGenerator.h	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/_javascript_Core/profiler/ProfileGenerator.h	2015-05-11 20:09:14 UTC (rev 184117)
@@ -61,7 +61,7 @@
 
     private:
         ProfileGenerator(ExecState*, const WTF::String& title, unsigned uid, PassRefPtr<Stopwatch>);
-        void addParentForConsoleStart(ExecState*);
+        void addParentForConsoleStart(ExecState*, double);
 
         void removeProfileStart();
         void removeProfileEnd();

Modified: trunk/Source/WebCore/ChangeLog (184116 => 184117)


--- trunk/Source/WebCore/ChangeLog	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/WebCore/ChangeLog	2015-05-11 20:09:14 UTC (rev 184117)
@@ -1,3 +1,15 @@
+2015-05-11  Matt Baker  <[email protected]>
+
+        Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=144808
+
+        Reviewed by Darin Adler.
+
+        Profiles started from the console should always use the Inspector environment's shared stopwatch.
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::startFromConsole):
+
 2015-05-11  Alex Christensen  <[email protected]>
 
         [Content Extensions] Support domain-specific rules and exceptions.

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (184116 => 184117)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2015-05-11 20:09:14 UTC (rev 184117)
@@ -257,11 +257,7 @@
     if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
         internalStart();
 
-    // Use an independent stopwatch for console-initiated profiling, since the user will expect it
-    // to be relative to when their command was issued.
-    Ref<Stopwatch> profilerStopwatch = Stopwatch::create();
-    profilerStopwatch->start();
-    startProfiling(exec, title, WTF::move(profilerStopwatch));
+    startProfiling(exec, title, m_instrumentingAgents->inspectorEnvironment().executionStopwatch());
 
     m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to