Bug 706340. Add gfxinfo to telemetry metadata. r=taras
authorJohn Daggett <jdaggett@mozilla.com>
Mon, 23 Jan 2012 15:58:34 +0900
changeset 85094 e29b78989aeb91b60b2030baf19f70ffd28b6484
parent 85093 75ddbfb943c7312d592d1206e98f2ef4b316c390
child 85095 05df0cddc299aac74bc6645a7264019012df0ce3
push id5159
push userjdaggett@mozilla.com
push dateMon, 23 Jan 2012 07:00:05 +0000
treeherdermozilla-inbound@e29b78989aeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras
bugs706340
milestone12.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 706340. Add gfxinfo to telemetry metadata. r=taras
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
--- a/toolkit/components/telemetry/TelemetryPing.js
+++ b/toolkit/components/telemetry/TelemetryPing.js
@@ -233,16 +233,40 @@ TelemetryPing.prototype = {
       if (field == "memsize") {
         // Send RAM size in megabytes. Rounding because sysinfo doesn't
         // always provide RAM in multiples of 1024.
         value = Math.round(value / 1024 / 1024)
       }
       ret[field] = value
     }
 
+    // gfxInfo fields are not always available, get what we can.
+    let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
+    let gfxfields = ["adapterDescription", "adapterVendorID", "adapterDeviceID",
+                     "adapterRAM", "adapterDriver", "adapterDriverVersion",
+                     "adapterDriverDate", "adapterDescription2",
+                     "adapterVendorID2", "adapterDeviceID2", "adapterRAM2",
+                     "adapterDriver2", "adapterDriverVersion2",
+                     "adapterDriverDate2", "isGPU2Active", "D2DEnabled;",
+                     "DWriteEnabled", "DWriteVersion"
+                    ];
+
+    if (gfxInfo) {
+      for each (let field in gfxfields) {
+        try {
+          let value = "";
+          value = gfxInfo[field];
+          if (value != "")
+            ret[field] = value;
+        } catch (e) {
+          continue
+        }
+      }
+    }
+
     let theme = LightweightThemeManager.currentTheme;
     if (theme)
       ret.persona = theme.id;
 
     if (this._addons)
       ret.addons = this._addons;
 
     return ret;
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -73,16 +73,24 @@ function checkHistograms(request, respon
     appBuildID: "2007010101",
     platformBuildID: "2007010101"
   };
 
   for (let f in expected_info) {
     do_check_eq(payload.info[f], expected_info[f]);
   }
 
+  var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
+  var isOSX = ("nsILocalFileMac" in Components.interfaces);
+
+  if (isWindows || isOSX) {
+    do_check_true("adapterVendorID" in payload.info);
+    do_check_true("adapterDeviceID" in payload.info);
+  }
+
   const TELEMETRY_PING = "TELEMETRY_PING";
   const TELEMETRY_SUCCESS = "TELEMETRY_SUCCESS";
   do_check_true(TELEMETRY_PING in payload.histograms);
   let rh = Telemetry.registeredHistograms;
   for (let name in rh) {
     if (/SQLITE/.test(name) && name in payload.histograms) {
       do_check_true(("STARTUP_" + name) in payload.histograms); 
     }