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]
}