Private variable perf_counters needs to be initialized before
use. Otherwise, perf_counter_init() call will cause crashes.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Unit tests "corrupted database log" and "database log with bad
transaction" will fail without this patch.
Reported-by: Ansis Atteka <aatteka@nicira.com>¬
Signed-off-by: Andy Zhou <azhou@nicira.com>
Older Linux prior to version 2.6.32 do not support user mode
performance events, They also don't have 'linux/perf_event.h' header
file. Add check for those older Linux to conditionally compile
perf-counter.c
Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
'size_t' does not allow for catching the case where 'read' returns
an error code, which is a negative number.
Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Fixes the following warnings from GCC on 32-bit architectures:
../lib/perf-counter.c: In function 'perf_counter_to_ds':
../lib/perf-counter.c:119:19: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' [-Werror=format]
../lib/perf-counter.c:119:19: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t' [-Werror=format]
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Some arches don't support perf counter and an error message
breaks many tests from the testsuite. Since the software still
runs without it, just inform that perf counters are not available
with using INFO level instead.
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
[blp@nicira.com removed unneeded \n from log message]
Signed-off-by: Ben Pfaff <blp@nicira.com>
First cut of adding a performance library that provides access to
hardware counters. Please see comments in perf-counter.h for
more details.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>