Report uffd/minor fault support in the ArtDatum{Delta}Reported atoms
Ignore-AOSP-First: these changes depend on previous work on reporting
the GC type via the ArtDatum{Delta}Reported atoms, which hasn't been
cherry-picked onto AOSP yet.
Bug: 249772734
Test: atest ArtGtestsTargetChroot
Change-Id: If850e4cabd91109f701194dde08e6743dcc5c0e7
diff --git a/runtime/metrics/statsd.cc b/runtime/metrics/statsd.cc
index 93bc3d7..9a11530 100644
--- a/runtime/metrics/statsd.cc
+++ b/runtime/metrics/statsd.cc
@@ -19,6 +19,7 @@
#include "arch/instruction_set.h"
#include "base/compiler_filter.h"
#include "base/metrics/metrics.h"
+#include "gc/collector/mark_compact.h"
#include "gc/heap.h"
#include "gc/space/image_space.h"
#include "runtime.h"
@@ -322,6 +323,21 @@
}
}
+int32_t EncodeUffdMinorFaultSupport() {
+ auto [uffd_supported, minor_fault_supported] = gc::collector::MarkCompact::GetUffdAndMinorFault();
+
+ if (uffd_supported) {
+ if (minor_fault_supported) {
+ return statsd::ART_DATUM_REPORTED__UFFD_SUPPORT__ART_UFFD_SUPPORT_MINOR_FAULT_MODE_SUPPORTED;
+ } else {
+ return statsd::
+ ART_DATUM_REPORTED__UFFD_SUPPORT__ART_UFFD_SUPPORT_MINOR_FAULT_MODE_NOT_SUPPORTED;
+ }
+ } else {
+ return statsd::ART_DATUM_REPORTED__UFFD_SUPPORT__ART_UFFD_SUPPORT_UFFD_NOT_SUPPORTED;
+ }
+}
+
class StatsdBackend : public MetricsBackend {
public:
void BeginOrUpdateSession(const SessionData& session_data) override {
@@ -368,7 +384,8 @@
statsd::ART_DATUM_REPORTED__DEX_METADATA_TYPE__ART_DEX_METADATA_TYPE_UNKNOWN,
statsd::ART_DATUM_REPORTED__APK_TYPE__ART_APK_TYPE_UNKNOWN,
EncodeInstructionSet(kRuntimeISA),
- EncodeGcCollectorType(Runtime::Current()->GetHeap()->GetForegroundCollectorType()));
+ EncodeGcCollectorType(Runtime::Current()->GetHeap()->GetForegroundCollectorType()),
+ EncodeUffdMinorFaultSupport());
}
void ReportHistogram(DatumId /*histogram_type*/,