summaryrefslogtreecommitdiff
path: root/lib/msan/msan_report.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-05-21 09:56:28 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-05-21 09:56:28 +0000
commitae96885f48a00155b671ba5392844825686d596f (patch)
treea4dceb3d40583a45d31688023f1016dd06aba50e /lib/msan/msan_report.cc
parent7624ea878aa7313d79a5955d48801074009fb3cd (diff)
[msan] Implement MSAN_OPTIONS=print_stats=1.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209287 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_report.cc')
-rw-r--r--lib/msan/msan_report.cc30
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/msan/msan_report.cc b/lib/msan/msan_report.cc
index 118e164dd..ee8c2b21e 100644
--- a/lib/msan/msan_report.cc
+++ b/lib/msan/msan_report.cc
@@ -115,6 +115,24 @@ void ReportExpectedUMRNotFound(StackTrace *stack) {
stack->Print();
}
+void ReportStats() {
+ SpinMutexLock l(&CommonSanitizerReportMutex);
+
+ if (__msan_get_track_origins() > 0) {
+ StackDepotStats *stack_depot_stats = StackDepotGetStats();
+ // FIXME: we want this at normal exit, too!
+ // FIXME: but only with verbosity=1 or something
+ Printf("Unique heap origins: %zu\n", stack_depot_stats->n_uniq_ids);
+ Printf("Stack depot allocated bytes: %zu\n", stack_depot_stats->allocated);
+
+ StackDepotStats *chained_origin_depot_stats = ChainedOriginDepotGetStats();
+ Printf("Unique origin histories: %zu\n",
+ chained_origin_depot_stats->n_uniq_ids);
+ Printf("History depot allocated bytes: %zu\n",
+ chained_origin_depot_stats->allocated);
+ }
+}
+
void ReportAtExitStatistics() {
SpinMutexLock l(&CommonSanitizerReportMutex);
@@ -124,18 +142,6 @@ void ReportAtExitStatistics() {
Printf("MemorySanitizer: %d warnings reported.\n", msan_report_count);
Printf("%s", d.End());
}
-
- StackDepotStats *stack_depot_stats = StackDepotGetStats();
- // FIXME: we want this at normal exit, too!
- // FIXME: but only with verbosity=1 or something
- Printf("Unique heap origins: %zu\n", stack_depot_stats->n_uniq_ids);
- Printf("Stack depot allocated bytes: %zu\n", stack_depot_stats->allocated);
-
- StackDepotStats *chained_origin_depot_stats = ChainedOriginDepotGetStats();
- Printf("Unique origin histories: %zu\n",
- chained_origin_depot_stats->n_uniq_ids);
- Printf("History depot allocated bytes: %zu\n",
- chained_origin_depot_stats->allocated);
}
class OriginSet {