FirebasePerformance Framework Reference

Trace

FIRTrace objects contain information about a “Trace”, which is a sequence of steps. Traces can beused to measure the time taken for a sequence of steps.Traces also include “Counters”. Counters are used to track information which is cumulative innature (e.g., Bytes downloaded). Counters are scoped to an FIRTrace object.

  • @brief Name of the trace.

    Declaration

    Swift

    varname:String{get}
  • Unavailable

    @brief Not a valid initializer.

  • Starts the trace.

    Declaration

    Swift

    funcstart()
  • Stops the trace if the trace is active.

    Declaration

    Swift

    funcstop()
  • Atomically increments the metric for the provided metric name with the provided value. If it is a new metric name, the metric value will be initialized to the value. Does nothing if the trace has not been started or has already been stopped.

    Declaration

    Swift

    funcincrementMetric(_metricName:String,byincrementValue:Int64)

    Parameters

    metricName

    The name of the metric to increment.

    incrementValue

    The value to increment the metric by.

  • Gets the value of the metric for the provided metric name. If the metric doesn’t exist, a 0 is returned.

    Declaration

    Swift

    funcvalueForMetric(_metricName:String)->Int64

    Parameters

    metricName

    The name of metric whose value to get.

    Return Value

    The value of the given metric or 0 if it hasn’t yet been set.

  • Sets the value of the metric for the provided metric name to the provided value. Does nothing if the trace has not been started or has already been stopped.

    Declaration

    Swift

    funcsetValue(_value:Int64,forMetricmetricName:String)

    Parameters

    metricName

    The name of the metric to set.

    value

    The value to set the metric to.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-03-11 UTC.