diff options
author | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2010-03-21 12:12:42 -0400 |
---|---|---|
committer | Soren Sandmann <sandmann@daimi.au.dk> | 2010-03-21 12:14:33 -0400 |
commit | b957f30379a9d85f2088612dd54cde671b6f1f9d (patch) | |
tree | af10cb1fa7829c6af413e3dfd9569daccef86ff4 | |
parent | 2d5cf4c93fe7d57f797a74513e24aeabe776f636 (diff) |
Really disable hardware counters.
-rw-r--r-- | collector.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/collector.c b/collector.c index 1c7af11..7eef464 100644 --- a/collector.c +++ b/collector.c @@ -406,7 +406,7 @@ counter_new (Collector *collector, attr.task = 1; attr.exclude_idle = 1; - if ((fd = sysprof_perf_counter_open (&attr, -1, cpu, -1, 0)) < 0) + if (!collector->use_hw_counters || (fd = sysprof_perf_counter_open (&attr, -1, cpu, -1, 0)) < 0) { attr.type = PERF_TYPE_SOFTWARE; attr.config = PERF_COUNT_SW_CPU_CLOCK; @@ -417,7 +417,7 @@ counter_new (Collector *collector, if (fd < 0) return fail (err, "Could not open performance counter"); - + counter->collector = collector; counter->fd = fd; @@ -431,8 +431,9 @@ counter_new (Collector *collector, counter->cpu = cpu; fd_add_watch (fd, counter); + fd_set_read_callback (fd, on_read); - + return counter; } |