Copy as Markdown

Other Tools

// -*- mode: C++ -*-
/* This file is auto-generated by run_glean_parser.py.
It is only for internal use by types in
toolkit/components/glean/bindings/private */
#include "mozilla/AppShutdown.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/glean/bindings/GleanJSMetricsLookup.h"
#include "mozilla/glean/bindings/jog/JOG.h"
#include "mozilla/Maybe.h"
#include "mozilla/Telemetry.h"
#include "nsIThread.h"
#include "nsThreadUtils.h"
#ifndef mozilla_glean_HistogramGifftMap_h
#define mozilla_glean_HistogramGifftMap_h
#define DYNAMIC_METRIC_BIT (26)
#define GLEAN_METRIC_ID(id) ((id) & ((1ULL << 27) - 1))
namespace mozilla::glean {
using Telemetry::HistogramID;
static Maybe<HistogramID> HistogramIdForMetric(uint32_t aId) {
switch(aId) {
case 39: { // networking.cache_metadata_first_read_time
return Some(HistogramID::NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS);
}
case 40: { // networking.cache_metadata_second_read_time
return Some(HistogramID::NETWORK_CACHE_METADATA_SECOND_READ_TIME_MS);
}
case 54: { // networking.dns_failed_lookup_time
return Some(HistogramID::DNS_FAILED_LOOKUP_TIME);
}
case 55: { // networking.dns_lookup_time
return Some(HistogramID::DNS_LOOKUP_TIME);
}
case 58: { // networking.dns_renewal_time
return Some(HistogramID::DNS_RENEWAL_TIME);
}
case 59: { // networking.dns_renewal_time_for_ttl
return Some(HistogramID::DNS_RENEWAL_TIME_FOR_TTL);
}
case 62: { // networking.http_1_download_throughput
return Some(HistogramID::NETWORKING_DOWNLOAD_THROUGHPUT_HTTP_1);
}
case 66: { // networking.http_1_upload_throughput
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_1);
}
case 67: { // networking.http_1_upload_throughput_100
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_1_100);
}
case 68: { // networking.http_1_upload_throughput_10_50
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_1_10_50);
}
case 69: { // networking.http_1_upload_throughput_50_100
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_1_50_100);
}
case 70: { // networking.http_2_download_throughput
return Some(HistogramID::NETWORKING_DOWNLOAD_THROUGHPUT_HTTP_2);
}
case 74: { // networking.http_2_upload_throughput
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_2);
}
case 75: { // networking.http_2_upload_throughput_100
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_2_100);
}
case 76: { // networking.http_2_upload_throughput_10_50
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_2_10_50);
}
case 77: { // networking.http_2_upload_throughput_50_100
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_2_50_100);
}
case 79: { // networking.http_3_download_throughput
return Some(HistogramID::NETWORKING_DOWNLOAD_THROUGHPUT_HTTP_3);
}
case 92: { // networking.http_3_upload_throughput
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_3);
}
case 93: { // networking.http_3_upload_throughput_100
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_3_100);
}
case 94: { // networking.http_3_upload_throughput_10_50
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_3_10_50);
}
case 95: { // networking.http_3_upload_throughput_50_100
return Some(HistogramID::HTTP_UPLOAD_THROUGHPUT_MBPS_HTTP_3_50_100);
}
case 117: { // networking.http_onstart_suspend_total_time
return Some(HistogramID::HTTP_ONSTART_SUSPEND_TOTAL_TIME);
}
case 136: { // networking.sqlite_cookies_block_main_thread
return Some(HistogramID::MOZ_SQLITE_COOKIES_BLOCK_MAIN_THREAD_MS_V2);
}
case 137: { // networking.sqlite_cookies_time_to_block_main_thread
return Some(HistogramID::MOZ_SQLITE_COOKIES_TIME_TO_BLOCK_MAIN_THREAD_MS);
}
case 180: { // browser.backup.compressed_archive_size
return Some(HistogramID::BROWSER_BACKUP_COMPRESSED_ARCHIVE_SIZE);
}
case 191: { // browser.backup.favicons_time
return Some(HistogramID::BROWSER_BACKUP_FAVICONS_TIME_MS);
}
case 199: { // browser.backup.places_time
return Some(HistogramID::BROWSER_BACKUP_PLACES_TIME_MS);
}
case 210: { // browser.backup.total_backup_size
return Some(HistogramID::BROWSER_BACKUP_TOTAL_BACKUP_SIZE);
}
case 211: { // browser.backup.total_backup_time
return Some(HistogramID::BROWSER_BACKUP_TOTAL_BACKUP_TIME_MS);
}
case 878: { // performance.interaction.tab_switch_composite
return Some(HistogramID::FX_TAB_SWITCH_COMPOSITE_E10S_MS);
}
case 879: { // performance.interaction.keypress_present_latency
return Some(HistogramID::KEYPRESS_PRESENT_LATENCY);
}
case 880: { // performance.interaction.mouseup_click_present_latency
return Some(HistogramID::MOUSEUP_FOLLOWED_BY_CLICK_PRESENT_LATENCY);
}
case 1003: { // performance.page.total_content_page_load
return Some(HistogramID::TOTAL_CONTENT_PAGE_LOAD_TIME);
}
case 1004: { // performance.page.non_blank_paint
return Some(HistogramID::TIME_TO_NON_BLANK_PAINT_MS);
}
case 3401: { // javascript.pageload.baseline_compile_time
return Some(HistogramID::JS_PAGELOAD_BASELINE_COMPILE_MS);
}
case 3402: { // javascript.pageload.delazification_time
return Some(HistogramID::JS_PAGELOAD_DELAZIFICATION_MS);
}
case 3403: { // javascript.pageload.execution_time
return Some(HistogramID::JS_PAGELOAD_EXECUTION_MS);
}
case 3404: { // javascript.pageload.gc_time
return Some(HistogramID::JS_PAGELOAD_GC_MS);
}
case 3405: { // javascript.pageload.parse_time
return Some(HistogramID::JS_PAGELOAD_PARSE_MS);
}
case 3406: { // javascript.pageload.protect_time
return Some(HistogramID::JS_PAGELOAD_PROTECT_MS);
}
case 3407: { // javascript.pageload.xdr_encode_time
return Some(HistogramID::JS_PAGELOAD_XDR_ENCODING_MS);
}
case 3409: { // perf.largest_contentful_paint
return Some(HistogramID::PERF_LARGEST_CONTENTFUL_PAINT_MS);
}
case 3410: { // perf.largest_contentful_paint_from_response_start
return Some(HistogramID::PERF_LARGEST_CONTENTFUL_PAINT_FROM_RESPONSE_START_MS);
}
case 3412: { // performance.pageload.fcp
return Some(HistogramID::PERF_FIRST_CONTENTFUL_PAINT_MS);
}
case 3413: { // performance.pageload.fcp_responsestart
return Some(HistogramID::PERF_FIRST_CONTENTFUL_PAINT_FROM_RESPONSESTART_MS);
}
case 3418: { // performance.pageload.load_time
return Some(HistogramID::PERF_PAGE_LOAD_TIME_MS);
}
case 3419: { // performance.pageload.load_time_responsestart
return Some(HistogramID::PERF_PAGE_LOAD_TIME_FROM_RESPONSESTART_MS);
}
case 3421: { // performance.time.dom_complete
return Some(HistogramID::TIME_TO_DOM_COMPLETE_MS);
}
case 3422: { // performance.time.dom_content_loaded_end
return Some(HistogramID::TIME_TO_DOM_CONTENT_LOADED_END_MS);
}
case 3423: { // performance.time.dom_content_loaded_start
return Some(HistogramID::TIME_TO_DOM_CONTENT_LOADED_START_MS);
}
case 3424: { // performance.time.dom_interactive
return Some(HistogramID::TIME_TO_DOM_INTERACTIVE_MS);
}
case 3425: { // performance.time.load_event_end
return Some(HistogramID::TIME_TO_LOAD_EVENT_END_MS);
}
case 3426: { // performance.time.load_event_start
return Some(HistogramID::TIME_TO_LOAD_EVENT_START_MS);
}
case 3427: { // performance.time.response_start
return Some(HistogramID::TIME_TO_RESPONSE_START_MS);
}
case 3452: { // gfx.composite_time
return Some(HistogramID::COMPOSITE_TIME);
}
case 3455: { // gfx.scroll_present_latency
return Some(HistogramID::SCROLL_PRESENT_LATENCY);
}
case 3467: { // gfx.checkerboard.duration
return Some(HistogramID::CHECKERBOARD_DURATION);
}
case 3468: { // gfx.checkerboard.peak_pixel_count
return Some(HistogramID::CHECKERBOARD_PEAK);
}
case 3469: { // gfx.checkerboard.potential_duration
return Some(HistogramID::CHECKERBOARD_POTENTIAL_DURATION);
}
case 3470: { // gfx.checkerboard.severity
return Some(HistogramID::CHECKERBOARD_SEVERITY);
}
case 3471: { // gfx.content.full_paint_time
return Some(HistogramID::CONTENT_FULL_PAINT_TIME);
}
case 3472: { // gfx.content.paint_time
return Some(HistogramID::CONTENT_PAINT_TIME);
}
case 3473: { // gfx.content.frame_time.from_paint
return Some(HistogramID::CONTENT_FRAME_TIME);
}
case 3474: { // gfx.content.frame_time.from_vsync
return Some(HistogramID::CONTENT_FRAME_TIME_VSYNC);
}
case 3476: { // gfx.content.frame_time.with_svg
return Some(HistogramID::CONTENT_FRAME_TIME_WITH_SVG);
}
case 3477: { // gfx.content.frame_time.without_resource_upload
return Some(HistogramID::CONTENT_FRAME_TIME_WITHOUT_RESOURCE_UPLOAD);
}
case 3478: { // gfx.content.frame_time.without_upload
return Some(HistogramID::CONTENT_FRAME_TIME_WITHOUT_UPLOAD);
}
case 3491: { // paint.build_displaylist_time
return Some(HistogramID::PAINT_BUILD_DISPLAYLIST_TIME);
}
case 3492: { // wr.framebuild_time
return Some(HistogramID::WR_FRAMEBUILD_TIME);
}
case 3493: { // wr.gpu_wait_time
return Some(HistogramID::WR_GPU_WAIT_TIME);
}
case 3494: { // wr.rasterize_blobs_time
return Some(HistogramID::WR_RASTERIZE_BLOBS_TIME);
}
case 3495: { // wr.rasterize_glyphs_time
return Some(HistogramID::WR_RASTERIZE_GLYPHS_TIME);
}
case 3496: { // wr.renderer_time
return Some(HistogramID::WR_RENDERER_TIME);
}
case 3497: { // wr.renderer_time_no_sc
return Some(HistogramID::WR_RENDERER_TIME_NO_SC_MS);
}
case 3498: { // wr.scenebuild_time
return Some(HistogramID::WR_SCENEBUILD_TIME);
}
case 3499: { // wr.sceneswap_time
return Some(HistogramID::WR_SCENESWAP_TIME);
}
case 3500: { // wr.texture_cache_update_time
return Some(HistogramID::WR_TEXTURE_CACHE_UPDATE_TIME);
}
case 3501: { // wr.time_to_frame_build
return Some(HistogramID::WR_TIME_TO_FRAME_BUILD_MS);
}
case 3502: { // wr.time_to_render_start
return Some(HistogramID::WR_TIME_TO_RENDER_START_MS);
}
case 3548: { // geckoview.document_site_origins
return Some(HistogramID::FX_NUMBER_OF_UNIQUE_SITE_ORIGINS_ALL_TABS);
}
case 3549: { // geckoview.page_load_progress_time
return Some(HistogramID::GV_PAGE_LOAD_PROGRESS_MS);
}
case 3550: { // geckoview.page_load_time
return Some(HistogramID::GV_PAGE_LOAD_MS);
}
case 3551: { // geckoview.page_reload_time
return Some(HistogramID::GV_PAGE_RELOAD_MS);
}
case 3552: { // geckoview.per_document_site_origins
return Some(HistogramID::FX_NUMBER_OF_UNIQUE_SITE_ORIGINS_PER_DOCUMENT);
}
case 3572: { // netwerk.http3_time_to_reuse_idle_connection
return Some(HistogramID::HTTP3_TIME_TO_REUSE_IDLE_CONNECTTION_MS);
}
case 3577: { // network.cache_hit_time
return Some(HistogramID::NETWORK_CACHE_V2_HIT_TIME_MS);
}
case 3578: { // network.cache_miss_time
return Some(HistogramID::NETWORK_CACHE_V2_MISS_TIME_MS);
}
case 3579: { // network.cache_read_time
return Some(HistogramID::HTTP_PAGE_CACHE_READ_TIME_V2);
}
case 3580: { // network.complete_load
return Some(HistogramID::HTTP_PAGE_COMPLETE_LOAD_V2);
}
case 3581: { // network.complete_load_cached
return Some(HistogramID::HTTP_PAGE_COMPLETE_LOAD_CACHED_V2);
}
case 3582: { // network.complete_load_net
return Some(HistogramID::HTTP_PAGE_COMPLETE_LOAD_NET_V2);
}
case 3584: { // network.dns_end
return Some(HistogramID::HTTP_PAGE_DNS_LOOKUP_TIME);
}
case 3585: { // network.dns_start
return Some(HistogramID::HTTP_PAGE_DNS_ISSUE_TIME);
}
case 3586: { // network.first_from_cache
return Some(HistogramID::HTTP_PAGE_OPEN_TO_FIRST_FROM_CACHE_V2);
}
case 3587: { // network.first_sent_to_last_received
return Some(HistogramID::HTTP_PAGE_FIRST_SENT_TO_LAST_RECEIVED);
}
case 3588: { // network.font_download_end
return Some(HistogramID::WEBFONT_DOWNLOAD_TIME_AFTER_START);
}
case 3590: { // network.http3_complete_load
return Some(HistogramID::HTTP3_COMPLETE_LOAD);
}
case 3591: { // network.http3_first_sent_to_last_received
return Some(HistogramID::HTTP3_FIRST_SENT_TO_LAST_RECEIVED);
}
case 3592: { // network.http3_open_to_first_received
return Some(HistogramID::HTTP3_OPEN_TO_FIRST_RECEIVED);
}
case 3593: { // network.http3_open_to_first_sent
return Some(HistogramID::HTTP3_OPEN_TO_FIRST_SENT);
}
case 3594: { // network.http3_tls_handshake
return Some(HistogramID::HTTP3_TLS_HANDSHAKE);
}
case 3595: { // network.http_revalidation
return Some(HistogramID::HTTP_PAGE_REVALIDATION);
}
case 3596: { // network.open_to_first_received
return Some(HistogramID::HTTP_PAGE_OPEN_TO_FIRST_RECEIVED);
}
case 3597: { // network.open_to_first_sent
return Some(HistogramID::HTTP_PAGE_OPEN_TO_FIRST_SENT);
}
case 3598: { // network.sub_cache_read_time
return Some(HistogramID::HTTP_SUB_CACHE_READ_TIME_V2);
}
case 3599: { // network.sub_complete_load
return Some(HistogramID::HTTP_SUB_COMPLETE_LOAD_V2);
}
case 3600: { // network.sub_complete_load_cached
return Some(HistogramID::HTTP_SUB_COMPLETE_LOAD_CACHED_V2);
}
case 3601: { // network.sub_complete_load_net
return Some(HistogramID::HTTP_SUB_COMPLETE_LOAD_NET_V2);
}
case 3602: { // network.sub_dns_end
return Some(HistogramID::HTTP_SUB_DNS_LOOKUP_TIME);
}
case 3603: { // network.sub_dns_start
return Some(HistogramID::HTTP_SUB_DNS_ISSUE_TIME);
}
case 3604: { // network.sub_first_from_cache
return Some(HistogramID::HTTP_SUB_OPEN_TO_FIRST_FROM_CACHE_V2);
}
case 3605: { // network.sub_first_sent_to_last_received
return Some(HistogramID::HTTP_SUB_FIRST_SENT_TO_LAST_RECEIVED);
}
case 3606: { // network.sub_http_revalidation
return Some(HistogramID::HTTP_SUB_REVALIDATION);
}
case 3607: { // network.sub_open_to_first_received
return Some(HistogramID::HTTP_SUB_OPEN_TO_FIRST_RECEIVED);
}
case 3608: { // network.sub_open_to_first_sent
return Some(HistogramID::HTTP_SUB_OPEN_TO_FIRST_SENT);
}
case 3609: { // network.sub_tcp_connection
return Some(HistogramID::HTTP_SUB_TCP_CONNECTION_2);
}
case 3610: { // network.sub_tls_handshake
return Some(HistogramID::HTTP_SUB_TLS_HANDSHAKE);
}
case 3611: { // network.sup_http3_tcp_connection
return Some(HistogramID::SUP_HTTP3_TCP_CONNECTION);
}
case 3619: { // network.tcp_connection
return Some(HistogramID::HTTP_PAGE_TCP_CONNECTION_2);
}
case 3621: { // network.tls_early_data_bytes_written
return Some(HistogramID::TLS_EARLY_DATA_BYTES_WRITTEN);
}
case 3623: { // network.tls_handshake
return Some(HistogramID::HTTP_PAGE_TLS_HANDSHAKE);
}
case 3799: { // extensions.apis.dnr.evaluate_rules_time
return Some(HistogramID::WEBEXT_DNR_EVALUATE_RULES_MS);
}
case 3801: { // extensions.apis.dnr.startup_cache_read_size
return Some(HistogramID::WEBEXT_DNR_STARTUPCACHE_READ_BYTES);
}
case 3802: { // extensions.apis.dnr.startup_cache_read_time
return Some(HistogramID::WEBEXT_DNR_STARTUPCACHE_READ_MS);
}
case 3803: { // extensions.apis.dnr.startup_cache_write_size
return Some(HistogramID::WEBEXT_DNR_STARTUPCACHE_WRITE_BYTES);
}
case 3804: { // extensions.apis.dnr.startup_cache_write_time
return Some(HistogramID::WEBEXT_DNR_STARTUPCACHE_WRITE_MS);
}
case 3805: { // extensions.apis.dnr.validate_rules_time
return Some(HistogramID::WEBEXT_DNR_VALIDATE_RULES_MS);
}
case 3916: { // test_only.mabels_custom_label_lengths
return Some(HistogramID::TELEMETRY_TEST_KEYED_LINEAR);
}
case 3934: { // test_only.what_do_you_remember
return Some(HistogramID::TELEMETRY_TEST_MIRROR_FOR_LABELED_MEMORY);
}
case 3936: { // test_only.what_time_is_it
return Some(HistogramID::TELEMETRY_TEST_MIRROR_FOR_TIMING);
}
case 3937: { // test_only.where_has_the_time_gone
return Some(HistogramID::TELEMETRY_TEST_MIRROR_FOR_LABELED_TIMING);
}
case 3940: { // test_only.ipc.a_custom_dist
return Some(HistogramID::TELEMETRY_TEST_MIRROR_FOR_CUSTOM);
}
case 3943: { // test_only.ipc.a_memory_dist
return Some(HistogramID::TELEMETRY_TEST_LINEAR);
}
case 3948: { // test_only.ipc.a_timing_dist
return Some(HistogramID::TELEMETRY_TEST_EXPONENTIAL);
}
case 4459: { // search.service.startup_time
return Some(HistogramID::SEARCH_SERVICE_INIT2_MS);
}
default: {
if (MOZ_UNLIKELY(aId & (1 << DYNAMIC_METRIC_BIT))) {
// Dynamic (runtime-registered) metric. Use its static (compiletime-
// registered) metric's telemetry_mirror mapping.
// ...if applicable.
// Only JS can use dynamic (runtime-registered) metric ids.
MOZ_ASSERT(NS_IsMainThread());
auto metricName = JOG::GetMetricName(aId);
// All of these should have names, but the storage only lasts until
// XPCOMWillShutdown, so it might return `Nothing()`.
if (metricName.isSome()) {
auto maybeMetric = MetricByNameLookup(metricName.ref());
if (maybeMetric.isSome()) {
uint32_t staticId = GLEAN_METRIC_ID(maybeMetric.value());
// Let's ensure we don't infinite loop, huh.
MOZ_ASSERT(!(staticId & (1 << DYNAMIC_METRIC_BIT)));
return HistogramIdForMetric(staticId);
}
}
}
return Nothing();
}
}
}
} // namespace mozilla::glean
#undef GLEAN_METRIC_ID
#undef DYNAMIC_METRIC_BIT
#endif // mozilla_glean_HistogramGifftMaps_h