[sysprof] Unconditionally fall back to software if opening hardware counters fails
- From: Søren Sandmann Pedersen <ssp src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sysprof] Unconditionally fall back to software if opening hardware counters fails
- Date: Mon, 1 Feb 2010 19:21:11 +0000 (UTC)
commit 3e4921b92dbf40a5e8412539898f22b6eacc3816
Author: Søren Sandmann Pedersen <sandmann daimi au dk>
Date: Mon Feb 1 14:02:41 2010 -0500
Unconditionally fall back to software if opening hardware counters fails
If hardware counters are not available, fall back to SW regardless of
why the hardware counters aren't available. The error code can be
either ENOTSUPP or ENODEV depending on CPU type, so it's simpler to
just retry in all cases, and only fail if the software fallback
failed.
collector.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/collector.c b/collector.c
index 6f5abe2..b39fbc0 100644
--- a/collector.c
+++ b/collector.c
@@ -360,14 +360,11 @@ counter_new (Collector *collector,
if ((fd = sysprof_perf_counter_open (&attr, -1, cpu, -1, 0)) < 0)
{
- if (errno == ENODEV)
- {
- attr.type = PERF_TYPE_SOFTWARE;
- attr.config = PERF_COUNT_SW_CPU_CLOCK;
- attr.sample_period = 1000000;
-
- fd = sysprof_perf_counter_open (&attr, -1, cpu, -1, 0);
- }
+ attr.type = PERF_TYPE_SOFTWARE;
+ attr.config = PERF_COUNT_SW_CPU_CLOCK;
+ attr.sample_period = 1000000;
+
+ fd = sysprof_perf_counter_open (&attr, -1, cpu, -1, 0);
}
if (fd < 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]