Search in sources :

Example 1 with Item

use of com.google.firebase.example.perf.kotlin.model.Item in project snippets-android by firebase.

the class MainActivity method basicTrace.

// [END perf_traced_create]
public void basicTrace() {
    ItemCache cache = new ItemCache();
    // [START perf_basic_trace_start]
    Trace myTrace = FirebasePerformance.getInstance().newTrace("test_trace");
    myTrace.start();
    // [END perf_basic_trace_start]
    // [START perf_basic_trace_increment]
    Item item = cache.fetch("item");
    if (item != null) {
        myTrace.incrementMetric("item_cache_hit", 1);
    } else {
        myTrace.incrementMetric("item_cache_miss", 1);
    }
    // [END perf_basic_trace_increment]
    // [START perf_basic_trace_stop]
    myTrace.stop();
// [END perf_basic_trace_stop]
}
Also used : ItemCache(com.google.firebase.example.perf.kotlin.model.ItemCache) Trace(com.google.firebase.perf.metrics.Trace) AddTrace(com.google.firebase.perf.metrics.AddTrace) Item(com.google.firebase.example.perf.kotlin.model.Item)

Aggregations

Item (com.google.firebase.example.perf.kotlin.model.Item)1 ItemCache (com.google.firebase.example.perf.kotlin.model.ItemCache)1 AddTrace (com.google.firebase.perf.metrics.AddTrace)1 Trace (com.google.firebase.perf.metrics.Trace)1