Bug 1288778: Add a telemetry probe for usage of asm.js / wasm; r=luke, data-review=bsmedberg

MozReview-Commit-ID: D8yiiobompo

--HG--
extra : rebase_source : 889800ed00a5f05522bd8235491dfd0bee059f9a
extra : amend_source : 268b1d5b811e58d2748f9780992e4769432cb681
This commit is contained in:
Benjamin Bouvier 2016-09-08 16:07:15 +02:00
Родитель a17cde8cff
Коммит daec611782
5 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -24,6 +24,14 @@
namespace js { namespace js {
namespace wasm { namespace wasm {
// Telemetry sample values for the JS_AOT_USAGE key, indicating whether asm.js
// or WebAssembly is used.
enum class Telemetry {
ASMJS = 0,
WASM = 1
};
static const uint32_t MagicNumber = 0x6d736100; // "\0asm" static const uint32_t MagicNumber = 0x6d736100; // "\0asm"
static const uint32_t EncodingVersion = 0x0b; static const uint32_t EncodingVersion = 0x0b;

Просмотреть файл

@ -870,5 +870,8 @@ Module::instantiate(JSContext* cx,
} }
} }
uint32_t mode = uint32_t(metadata().isAsmJS() ? Telemetry::ASMJS : Telemetry::WASM);
cx->runtime()->addTelemetry(JS_TELEMETRY_AOT_USAGE, mode);
return true; return true;
} }

Просмотреть файл

@ -133,6 +133,7 @@ enum {
JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT,
JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_ADDONS, JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_ADDONS,
JS_TELEMETRY_ADDON_EXCEPTIONS, JS_TELEMETRY_ADDON_EXCEPTIONS,
JS_TELEMETRY_AOT_USAGE,
JS_TELEMETRY_END JS_TELEMETRY_END
}; };

Просмотреть файл

@ -3159,6 +3159,9 @@ AccumulateTelemetryCallback(int id, uint32_t sample, const char* key)
case JS_TELEMETRY_ADDON_EXCEPTIONS: case JS_TELEMETRY_ADDON_EXCEPTIONS:
Telemetry::Accumulate(Telemetry::JS_TELEMETRY_ADDON_EXCEPTIONS, nsDependentCString(key), sample); Telemetry::Accumulate(Telemetry::JS_TELEMETRY_ADDON_EXCEPTIONS, nsDependentCString(key), sample);
break; break;
case JS_TELEMETRY_AOT_USAGE:
Telemetry::Accumulate(Telemetry::JS_AOT_USAGE, sample);
break;
default: default:
MOZ_ASSERT_UNREACHABLE("Unexpected JS_TELEMETRY id"); MOZ_ASSERT_UNREACHABLE("Unexpected JS_TELEMETRY id");
} }

Просмотреть файл

@ -10299,5 +10299,13 @@
"keyed": true, "keyed": true,
"n_values": 6, "n_values": 6,
"description": "Number of revoke actions on permissions in the control center, keyed by permission id. Values represent the permission type that was revoked. (0=unknown, 1=permanently allowed, 2=permanently blocked, 3=temporarily allowed, 4=temporarily blocked)" "description": "Number of revoke actions on permissions in the control center, keyed by permission id. Values represent the permission type that was revoked. (0=unknown, 1=permanently allowed, 2=permanently blocked, 3=temporarily allowed, 4=temporarily blocked)"
},
"JS_AOT_USAGE": {
"alert_emails": ["luke@mozilla.com", "bbouvier@mozilla.com"],
"bug_numbers": [1288778],
"expires_in_version": "56",
"kind": "enumerated",
"n_values": 4,
"description": "Counts the number of asm.js vs WebAssembly modules instanciations, at the time modules are getting instanciated."
} }
} }