mem footprint draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 01 Sep 2016 02:14:12 -0700
changeset 408555 cc4f3553df68e286f0f6c32a7816dfd4534c09b0
parent 408554 cd644f22ff59bd09800b6607072405fbe589a332
child 408556 fd249bed591af23f8c4cc32f1c2949186c1d994e
push id28249
push userbmo:poirot.alex@gmail.com
push dateThu, 01 Sep 2016 09:44:27 +0000
milestone51.0a1
mem footprint MozReview-Commit-ID: HORYWm03HNc
devtools/server/tests/unit/test_memory_footprint.js
--- a/devtools/server/tests/unit/test_memory_footprint.js
+++ b/devtools/server/tests/unit/test_memory_footprint.js
@@ -1,34 +1,32 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var gClient;
 var gMgr;
 var gRefMemory;
+var gSubTests = [];
 
 function run_test() {
   gMgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(Ci.nsIMemoryReporterManager);
   Cu.forceGC();
   gRefMemory = gMgr.residentUnique;
 
   add_test(init_server);
   add_test(add_browser_actors);
   add_test(connect_client);
   add_test(list_tabs);
   add_test(close_client);
   run_next_test();
 }
 
 function check_footprint(step, max) {
   var footprint = (gMgr.residentUnique - gRefMemory) / 1024;
-  let msg = "Footprint after " + step + " is " + footprint + " kB (should be less than " + max + " kB).\n" +
-            "!!! The devtools server's memory usage increased either significantly, or slowly over time.\n" +
-            "!!! If your patch doesn't cause a big increase, feel free to raise the thresholds for this test as needed.";
-  ok(footprint < max, msg);
+  gSubTests.push({ name: step, value: footprint });
   run_next_test();
 }
 
 function init_server() {
   DebuggerServer.init();
   check_footprint("DebuggerServer.init()", 150);
 }
 
@@ -46,10 +44,20 @@ function connect_client() {
 
 function list_tabs() {
   gClient.listTabs(function onListTabs(aResponse) {
     check_footprint("DebuggerClient.listTabs()", 3800);
   });
 }
 
 function close_client() {
+  var footprint = (gMgr.residentUnique - gRefMemory) / 1024;
+  let PERFHERDER_DATA = {
+    framework: { name: "awsy" },
+    suites: [{
+      subtests: gSubTests,
+      name: "Devtools memory usage", value: footprint
+    }]
+  };
+  print("PERFHERDER_DATA: " + JSON.stringify(PERFHERDER_DATA));
+  ok(true, "sent data to perfherder");
   gClient.close().then(run_next_test);
 }