2 Objective-C runtime wrapper for use by LLDB Python formatters
4 Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 See https://llvm.org/LICENSE.txt for license information.
6 SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 import lldb
.formatters
.metrics
14 self
.statistics
= lldb
.formatters
.metrics
.Metrics()
15 self
.statistics
.add_metric("hit")
16 self
.statistics
.add_metric("miss")
18 def look_for_key(self
, key
):
23 def add_item(self
, key
, value
, ok_to_replace
=True):
24 if not (ok_to_replace
) and self
.look_for_key(key
):
26 self
.data
[key
] = value
29 def get_value(self
, key
, default
=None):
30 if self
.look_for_key(key
):
31 self
.statistics
.metric_hit("hit", key
)
34 self
.statistics
.metric_hit("miss", key
)