From 86fcce36faf43c7c92e9fc7a45db25e61d3c52f2 Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 21 Aug 2003 02:57:19 -0700 Subject: [PATCH] [PATCH] OProfile: add a useful statistic Add a stat counting the (relatively common) case where a PC value is logged but there is no (longer) any executable mapping covering that address. --- drivers/oprofile/buffer_sync.c | 4 +++- drivers/oprofile/oprofile_stats.c | 3 +++ drivers/oprofile/oprofile_stats.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index ad105b8814107..2dac57b618a3b 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c @@ -308,8 +308,10 @@ static void add_us_sample(struct mm_struct * mm, struct op_sample * s) cookie = lookup_dcookie(mm, s->eip, &offset); - if (!cookie) + if (!cookie) { + atomic_inc(&oprofile_stats.sample_lost_no_mapping); return; + } if (cookie != last_cookie) { add_cookie_switch(cookie); diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index 5624c1e017e02..f01e1935072c6 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c @@ -32,6 +32,7 @@ void oprofile_reset_stats(void) } atomic_set(&oprofile_stats.sample_lost_no_mm, 0); + atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); atomic_set(&oprofile_stats.event_lost_overflow, 0); } @@ -70,6 +71,8 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root) oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm", &oprofile_stats.sample_lost_no_mm); + oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mapping", + &oprofile_stats.sample_lost_no_mapping); oprofilefs_create_ro_atomic(sb, dir, "event_lost_overflow", &oprofile_stats.event_lost_overflow); } diff --git a/drivers/oprofile/oprofile_stats.h b/drivers/oprofile/oprofile_stats.h index e3f67d5c09109..9f4d4d2046db7 100644 --- a/drivers/oprofile/oprofile_stats.h +++ b/drivers/oprofile/oprofile_stats.h @@ -14,6 +14,7 @@ struct oprofile_stat_struct { atomic_t sample_lost_no_mm; + atomic_t sample_lost_no_mapping; atomic_t event_lost_overflow; }; -- 2.53.0