[PATCH] D46016: [scudo] Adding an interface function to print allocator stats
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 08:34:11 PDT 2018
cryptoad created this revision.
Herald added subscribers: Sanitizers, llvm-commits, delcypher.
This adds `__scudo_print_stats` as an interface function to display the Primary
and Secondary allocator statistics for Scudo.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D46016
Files:
include/sanitizer/scudo_interface.h
lib/scudo/scudo_allocator.cpp
lib/scudo/scudo_allocator_combined.h
lib/scudo/scudo_interface_internal.h
Index: lib/scudo/scudo_interface_internal.h
===================================================================
--- lib/scudo/scudo_interface_internal.h
+++ lib/scudo/scudo_interface_internal.h
@@ -25,6 +25,9 @@
SANITIZER_INTERFACE_ATTRIBUTE
void __scudo_set_rss_limit(uptr LimitMb, s32 HardLimit);
+
+SANITIZER_INTERFACE_ATTRIBUTE
+void __scudo_print_stats();
} // extern "C"
#endif // SCUDO_INTERFACE_INTERNAL_H_
Index: lib/scudo/scudo_allocator_combined.h
===================================================================
--- lib/scudo/scudo_allocator_combined.h
+++ lib/scudo/scudo_allocator_combined.h
@@ -61,6 +61,11 @@
Stats.Get(StatType);
}
+ void printStats() {
+ Primary.PrintStats();
+ Secondary.PrintStats();
+ }
+
private:
PrimaryAllocator Primary;
SecondaryAllocator Secondary;
Index: lib/scudo/scudo_allocator.cpp
===================================================================
--- lib/scudo/scudo_allocator.cpp
+++ lib/scudo/scudo_allocator.cpp
@@ -594,6 +594,11 @@
SoftRssLimitMb = LimitMb;
CheckRssLimit = HardRssLimitMb || SoftRssLimitMb;
}
+
+ void printStats() {
+ initThreadMaybe();
+ BackendAllocator.printStats();
+ }
};
static ScudoAllocator Instance(LINKER_INITIALIZED);
@@ -743,3 +748,7 @@
return;
Instance.setRssLimit(LimitMb, !!HardLimit);
}
+
+void __scudo_print_stats() {
+ Instance.printStats();
+}
Index: include/sanitizer/scudo_interface.h
===================================================================
--- include/sanitizer/scudo_interface.h
+++ include/sanitizer/scudo_interface.h
@@ -27,6 +27,8 @@
// can be removed by setting LimitMb to 0. This function's parameters should
// be fully trusted to avoid security mishaps.
void __scudo_set_rss_limit(size_t LimitMb, int HardLimit);
+
+ void __scudo_print_stats(void);
#ifdef __cplusplus
} // extern "C"
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46016.143751.patch
Type: text/x-patch
Size: 1894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180424/ece4074f/attachment.bin>
More information about the llvm-commits
mailing list