Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v6)
Hi, Arun On Wed, 8 Aug 2012 12:16:30 -0700, Arun Sharma wrote: > On 3/30/12 10:43 PM, Arun Sharma wrote: >> [ Meant to include v6 ChangeLog as well. Technical difficulties.. ] >> >> v6 ChangeLog: >> >> rebased to tip:perf/core and fixed a minor problem in computing >> the total period in hists__remove_entry_filter(). Needed to >> use period_self instead of period. > > This patch breaks perf top (symptom: percentages > 100%). Fixed by the > following patch. > > Namhyung: if you're still working on forward porting this, please add > this fix to your queue. > Will do, thanks. Namhyung > -Arun > > commit 75a1c409a529c9741f8a2f493868d1fc7ce7e06d > Author: Arun Sharma > Date: Wed Aug 8 11:47:02 2012 -0700 > >perf: update period_self as well on collapsing > When running perf top, we have a series of incoming samples, >which get aggregated in various user specified ways. > Suppose function "foo" had the following samples: >101, 103, 99, 105, ... > ->period for the corresponding entry looks as follows: >101, 204, 303, 408, ... > However, due to this bug, ->period_self contains: >101, 103, 99, 105, ... > and therefore breaks the invariant period == period_self >in the default mode (no sort inclusive). > Since total_period is computed by summing up period_self, > period/total_period can be > 100% > Fix the bug by updating period_self as well. > Signed-off-by: Arun Sharma > > diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c > index a2a8d91..adc891e 100644 > --- a/tools/perf/util/hist.c > +++ b/tools/perf/util/hist.c > @@ -462,6 +462,7 @@ static bool hists__collapse_insert_entry(struct > hists *hists, > > if (!cmp) { > iter->period += he->period; > + iter->period_self += he->period_self; > iter->nr_events += he->nr_events; > if (symbol_conf.use_callchain) { > > callchain_cursor_reset(>callchain_cursor); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v6)
On 8/8/12 12:16 PM, Arun Sharma wrote: and therefore breaks the invariant period == period_self in the default mode (no sort inclusive). hist_entry__decay() also needs an update to maintain the invariant. --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -138,6 +138,7 @@ static void hist_entry__add_cpumode_period(struct hist_entry *he, static void hist_entry__decay(struct hist_entry *he) { he->period = (he->period * 7) / 8; + he->period_self = (he->period_self * 7) / 8; he->nr_events = (he->nr_events * 7) / 8; } -Arun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v6)
On 3/30/12 10:43 PM, Arun Sharma wrote: [ Meant to include v6 ChangeLog as well. Technical difficulties.. ] v6 ChangeLog: rebased to tip:perf/core and fixed a minor problem in computing the total period in hists__remove_entry_filter(). Needed to use period_self instead of period. This patch breaks perf top (symptom: percentages > 100%). Fixed by the following patch. Namhyung: if you're still working on forward porting this, please add this fix to your queue. -Arun commit 75a1c409a529c9741f8a2f493868d1fc7ce7e06d Author: Arun Sharma Date: Wed Aug 8 11:47:02 2012 -0700 perf: update period_self as well on collapsing When running perf top, we have a series of incoming samples, which get aggregated in various user specified ways. Suppose function "foo" had the following samples: 101, 103, 99, 105, ... ->period for the corresponding entry looks as follows: 101, 204, 303, 408, ... However, due to this bug, ->period_self contains: 101, 103, 99, 105, ... and therefore breaks the invariant period == period_self in the default mode (no sort inclusive). Since total_period is computed by summing up period_self, period/total_period can be > 100% Fix the bug by updating period_self as well. Signed-off-by: Arun Sharma diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index a2a8d91..adc891e 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -462,6 +462,7 @@ static bool hists__collapse_insert_entry(struct hists *hists, if (!cmp) { iter->period += he->period; + iter->period_self += he->period_self; iter->nr_events += he->nr_events; if (symbol_conf.use_callchain) { callchain_cursor_reset(>callchain_cursor); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v6)
On 3/30/12 10:43 PM, Arun Sharma wrote: [ Meant to include v6 ChangeLog as well. Technical difficulties.. ] v6 ChangeLog: rebased to tip:perf/core and fixed a minor problem in computing the total period in hists__remove_entry_filter(). Needed to use period_self instead of period. This patch breaks perf top (symptom: percentages 100%). Fixed by the following patch. Namhyung: if you're still working on forward porting this, please add this fix to your queue. -Arun commit 75a1c409a529c9741f8a2f493868d1fc7ce7e06d Author: Arun Sharma asha...@fb.com Date: Wed Aug 8 11:47:02 2012 -0700 perf: update period_self as well on collapsing When running perf top, we have a series of incoming samples, which get aggregated in various user specified ways. Suppose function foo had the following samples: 101, 103, 99, 105, ... -period for the corresponding entry looks as follows: 101, 204, 303, 408, ... However, due to this bug, -period_self contains: 101, 103, 99, 105, ... and therefore breaks the invariant period == period_self in the default mode (no sort inclusive). Since total_period is computed by summing up period_self, period/total_period can be 100% Fix the bug by updating period_self as well. Signed-off-by: Arun Sharma asha...@fb.com diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index a2a8d91..adc891e 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -462,6 +462,7 @@ static bool hists__collapse_insert_entry(struct hists *hists, if (!cmp) { iter-period += he-period; + iter-period_self += he-period_self; iter-nr_events += he-nr_events; if (symbol_conf.use_callchain) { callchain_cursor_reset(hists-callchain_cursor); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v6)
On 8/8/12 12:16 PM, Arun Sharma wrote: and therefore breaks the invariant period == period_self in the default mode (no sort inclusive). hist_entry__decay() also needs an update to maintain the invariant. --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -138,6 +138,7 @@ static void hist_entry__add_cpumode_period(struct hist_entry *he, static void hist_entry__decay(struct hist_entry *he) { he-period = (he-period * 7) / 8; + he-period_self = (he-period_self * 7) / 8; he-nr_events = (he-nr_events * 7) / 8; } -Arun -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v6)
Hi, Arun On Wed, 8 Aug 2012 12:16:30 -0700, Arun Sharma wrote: On 3/30/12 10:43 PM, Arun Sharma wrote: [ Meant to include v6 ChangeLog as well. Technical difficulties.. ] v6 ChangeLog: rebased to tip:perf/core and fixed a minor problem in computing the total period in hists__remove_entry_filter(). Needed to use period_self instead of period. This patch breaks perf top (symptom: percentages 100%). Fixed by the following patch. Namhyung: if you're still working on forward porting this, please add this fix to your queue. Will do, thanks. Namhyung -Arun commit 75a1c409a529c9741f8a2f493868d1fc7ce7e06d Author: Arun Sharma asha...@fb.com Date: Wed Aug 8 11:47:02 2012 -0700 perf: update period_self as well on collapsing When running perf top, we have a series of incoming samples, which get aggregated in various user specified ways. Suppose function foo had the following samples: 101, 103, 99, 105, ... -period for the corresponding entry looks as follows: 101, 204, 303, 408, ... However, due to this bug, -period_self contains: 101, 103, 99, 105, ... and therefore breaks the invariant period == period_self in the default mode (no sort inclusive). Since total_period is computed by summing up period_self, period/total_period can be 100% Fix the bug by updating period_self as well. Signed-off-by: Arun Sharma asha...@fb.com diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index a2a8d91..adc891e 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -462,6 +462,7 @@ static bool hists__collapse_insert_entry(struct hists *hists, if (!cmp) { iter-period += he-period; + iter-period_self += he-period_self; iter-nr_events += he-nr_events; if (symbol_conf.use_callchain) { callchain_cursor_reset(hists-callchain_cursor); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/