tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

telemetry.rs (1009B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #[cfg(feature = "gecko")]
      6 use glean::TimerId;
      7 #[cfg(feature = "gecko")]
      8 use firefox_on_glean::metrics::wr;
      9 
     10 #[cfg(not(feature = "gecko"))]
     11 pub struct TimerId;
     12 
     13 pub struct Telemetry;
     14 
     15 /// Defines the interface for hooking up an external telemetry reporter to WR.
     16 #[cfg(not(feature = "gecko"))]
     17 impl Telemetry {
     18    // Start rasterize glyph time collection
     19    pub fn start_rasterize_glyphs_time() -> TimerId { return TimerId {}; }
     20    // End rasterize glyph time collection
     21    pub fn stop_and_accumulate_rasterize_glyphs_time(_id: TimerId) { }
     22 }
     23 
     24 #[cfg(feature = "gecko")]
     25 impl Telemetry {
     26    pub fn start_rasterize_glyphs_time() -> TimerId { wr::rasterize_glyphs_time.start() }
     27    pub fn stop_and_accumulate_rasterize_glyphs_time(id: TimerId) { wr::rasterize_glyphs_time.stop_and_accumulate(id); }
     28 }