Bug 1021072 - Remove GetResponsivenessTimes. r=ehsan
authorBenoit Girard <b56girard@gmail.com>
Fri, 13 Jun 2014 22:32:13 -0400
changeset 188739 3601d3753bd296196dcb3da32f0853397cc08102
parent 188738 54b35d7d75cead73bfb507087f0f5abc3e98a293
child 188740 14950c172444160c21691193fddd2599b05ce097
push id44897
push userb56girard@gmail.com
push dateSat, 14 Jun 2014 02:33:32 +0000
treeherdermozilla-inbound@14950c172444 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1021072
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1021072 - Remove GetResponsivenessTimes. r=ehsan
toolkit/devtools/server/actors/profiler.js
toolkit/devtools/server/tests/unit/test_profiler_actor.js
tools/profiler/GeckoProfiler.h
tools/profiler/GeckoProfilerImpl.h
tools/profiler/nsIProfiler.idl
tools/profiler/nsProfiler.cpp
tools/profiler/platform.cpp
tools/profiler/tests/test_run.js
--- a/toolkit/devtools/server/actors/profiler.js
+++ b/toolkit/devtools/server/actors/profiler.js
@@ -101,20 +101,16 @@ ProfilerActor.prototype = {
     var profile = this._profiler.getProfileData();
     return { "profile": profile, "currentTime": getCurrentTime() }
   },
   onIsActive: function(aRequest) {
     var isActive = this._profiler.IsActive();
     var currentTime = isActive ? getCurrentTime() : null;
     return { "isActive": isActive, "currentTime": currentTime }
   },
-  onGetResponsivenessTimes: function(aRequest) {
-    var times = this._profiler.GetResponsivenessTimes({});
-    return { "responsivenessTimes": times }
-  },
   onGetFeatures: function(aRequest) {
     var features = this._profiler.GetFeatures([]);
     return { "features": features }
   },
   onGetSharedLibraryInformation: function(aRequest) {
     var sharedLibraries = this._profiler.getSharedLibraryInformation();
     return { "sharedLibraryInformation": sharedLibraries }
   },
@@ -235,16 +231,15 @@ ProfilerActor.prototype = {
  * The request types this actor can handle.
  */
 ProfilerActor.prototype.requestTypes = {
   "startProfiler": ProfilerActor.prototype.onStartProfiler,
   "stopProfiler": ProfilerActor.prototype.onStopProfiler,
   "getProfileStr": ProfilerActor.prototype.onGetProfileStr,
   "getProfile": ProfilerActor.prototype.onGetProfile,
   "isActive": ProfilerActor.prototype.onIsActive,
-  "getResponsivenessTimes": ProfilerActor.prototype.onGetResponsivenessTimes,
   "getFeatures": ProfilerActor.prototype.onGetFeatures,
   "getSharedLibraryInformation": ProfilerActor.prototype.onGetSharedLibraryInformation,
   "registerEventNotifications": ProfilerActor.prototype.onRegisterEventNotifications,
   "unregisterEventNotifications": ProfilerActor.prototype.onUnregisterEventNotifications
 };
 
 DebuggerServer.addGlobalActor(ProfilerActor, "profilerActor");
--- a/toolkit/devtools/server/tests/unit/test_profiler_actor.js
+++ b/toolkit/devtools/server/tests/unit/test_profiler_actor.js
@@ -32,29 +32,25 @@ function test_profiler_actor(aClient, aP
       for (var i = 0; i < features.length; i++)
         do_check_eq(aResponse.features[i], features[i]);
 
       aClient.request({ to: aProfiler, type: "startProfiler", features: ['jank', 'js'] }, function (aResponse) {
         do_check_eq(typeof aResponse.msg, "string");
         aClient.request({ to: aProfiler, type: "isActive" }, function (aResponse) {
           do_check_true(aResponse.isActive);
 
-          aClient.request({ to: aProfiler, type: "getResponsivenessTimes" }, function (aResponse) {
-            do_check_eq(typeof aResponse.responsivenessTimes, "object");
+          aClient.request({ to: aProfiler, type: "getSharedLibraryInformation" }, function (aResponse) {
+            do_check_eq(typeof aResponse.sharedLibraryInformation, "string");
+            try {
+              JSON.parse(aResponse.sharedLibraryInformation);
+            } catch(e) {
+              do_throw(e.toString(), Components.stack.caller);
+            }
 
-            aClient.request({ to: aProfiler, type: "getSharedLibraryInformation" }, function (aResponse) {
-              do_check_eq(typeof aResponse.sharedLibraryInformation, "string");
-              try {
-                JSON.parse(aResponse.sharedLibraryInformation);
-              } catch(e) {
-                do_throw(e.toString(), Components.stack.caller);
-              }
-
-              test_event_notifications(aClient, aProfiler);
-            });
+            test_event_notifications(aClient, aProfiler);
           });
         });
       });
     });
   });
 }
 
 function test_event_notifications(aClient, aProfiler)
--- a/tools/profiler/GeckoProfiler.h
+++ b/tools/profiler/GeckoProfiler.h
@@ -140,19 +140,16 @@ static inline ProfilerBacktrace* profile
 // Free a ProfilerBacktrace returned by profiler_get_backtrace()
 static inline void profiler_free_backtrace(ProfilerBacktrace* aBacktrace) {}
 
 static inline bool profiler_is_active() { return false; }
 
 // Internal-only. Used by the event tracer.
 static inline void profiler_responsiveness(const mozilla::TimeStamp& aTime) {}
 
-// Internal-only. Used by the event tracer.
-static inline double* profiler_get_responsiveness() { return nullptr; }
-
 // Internal-only.
 static inline void profiler_set_frame_number(int frameNumber) {}
 
 // Get the profile encoded as a JSON string.
 static inline char* profiler_get_profile() { return nullptr; }
 
 // Get the profile encoded as a JSON object.
 static inline JSObject* profiler_get_profile_jsobject(JSContext* aCx) { return nullptr; }
--- a/tools/profiler/GeckoProfilerImpl.h
+++ b/tools/profiler/GeckoProfilerImpl.h
@@ -125,22 +125,16 @@ bool profiler_is_active()
 
 static inline
 void profiler_responsiveness(const mozilla::TimeStamp& aTime)
 {
   mozilla_sampler_responsiveness(aTime);
 }
 
 static inline
-const double* profiler_get_responsiveness()
-{
-  return mozilla_sampler_get_responsiveness();
-}
-
-static inline
 void profiler_set_frame_number(int frameNumber)
 {
   return mozilla_sampler_frame_number(frameNumber);
 }
 
 static inline
 char* profiler_get_profile()
 {
--- a/tools/profiler/nsIProfiler.idl
+++ b/tools/profiler/nsIProfiler.idl
@@ -1,33 +1,32 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  
 #include "nsISupports.idl"
 
-[scriptable, uuid(d64e01e1-603f-4478-bb9e-47d502f23f7b)]
+[scriptable, uuid(f7f3709c-04a9-45c6-8e34-40f762654a78)]
 interface nsIProfiler : nsISupports
 {
   void StartProfiler(in uint32_t aEntries, in double aInterval,
                       [array, size_is(aFeatureCount)] in string aFeatures,
                       in uint32_t aFeatureCount,
                       [array, size_is(aFilterCount), optional] in string aThreadNameFilters,
                       [optional] in uint32_t aFilterCount);
   void StopProfiler();
   boolean IsPaused();
   void PauseSampling();
   void ResumeSampling();
   void AddMarker(in string aMarker);
   string GetProfile();
   [implicit_jscontext]
   jsval getProfileData();
   boolean IsActive();
-  void GetResponsivenessTimes(out uint32_t aCount, [retval, array, size_is(aCount)] out double aResult);
   void GetFeatures(out uint32_t aCount, [retval, array, size_is(aCount)] out string aFeatures);
 
   /**
    * Returns a JSON string of an array of shared library objects.
    * Every object has three properties: start, end, and name.
    * start and end are integers describing the address range that the library
    * occupies in memory. name is the path of the library as a string.
    *
--- a/tools/profiler/nsProfiler.cpp
+++ b/tools/profiler/nsProfiler.cpp
@@ -215,36 +215,16 @@ NS_IMETHODIMP nsProfiler::GetProfileData
 NS_IMETHODIMP
 nsProfiler::IsActive(bool *aIsActive)
 {
   *aIsActive = profiler_is_active();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsProfiler::GetResponsivenessTimes(uint32_t *aCount, double **aResult)
-{
-  unsigned int len = 100;
-  const double* times = profiler_get_responsiveness();
-  if (!times) {
-    *aCount = 0;
-    *aResult = nullptr;
-    return NS_OK;
-  }
-
-  double *fs = static_cast<double *>
-                       (nsMemory::Clone(times, len * sizeof(double)));
-
-  *aCount = len;
-  *aResult = fs;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsProfiler::GetFeatures(uint32_t *aCount, char ***aFeatures)
 {
   uint32_t len = 0;
 
   const char **features = profiler_get_features();
   if (!features) {
     *aCount = 0;
     *aFeatures = nullptr;
--- a/tools/profiler/platform.cpp
+++ b/tools/profiler/platform.cpp
@@ -825,40 +825,23 @@ void mozilla_sampler_resume() {
   }
 }
 
 bool mozilla_sampler_is_active()
 {
   return sIsProfiling;
 }
 
-static double sResponsivenessTimes[100];
-static unsigned int sResponsivenessLoc = 0;
 void mozilla_sampler_responsiveness(const TimeStamp& aTime)
 {
-  if (!sLastTracerEvent.IsNull()) {
-    if (sResponsivenessLoc == 100) {
-      for(size_t i = 0; i < 100-1; i++) {
-        sResponsivenessTimes[i] = sResponsivenessTimes[i+1];
-      }
-      sResponsivenessLoc--;
-    }
-    TimeDuration delta = aTime - sLastTracerEvent;
-    sResponsivenessTimes[sResponsivenessLoc++] = delta.ToMilliseconds();
-  }
   sCurrentEventGeneration++;
 
   sLastTracerEvent = aTime;
 }
 
-const double* mozilla_sampler_get_responsiveness()
-{
-  return sResponsivenessTimes;
-}
-
 void mozilla_sampler_frame_number(int frameNumber)
 {
   sFrameNumber = frameNumber;
 }
 
 void mozilla_sampler_print_location2()
 {
   // FIXME
--- a/tools/profiler/tests/test_run.js
+++ b/tools/profiler/tests/test_run.js
@@ -17,20 +17,16 @@ function run_test() {
 
   profiler.StartProfiler(1000, 10, [], 0);
 
   do_check_true(profiler.IsActive());
 
   do_test_pending();
 
   do_timeout(1000, function wait() {
-    // Check responsiveness
-    var resp = profiler.GetResponsivenessTimes({});
-    do_check_true(resp.length > 10);
-
     // Check text profile format
     var profileStr = profiler.GetProfile();
     do_check_true(profileStr.length > 10);
 
     // check json profile format
     var profileObj = profiler.getProfileData();
     do_check_neq(profileObj, null);
     do_check_neq(profileObj.threads, null);