perf python: Initialize 'page_size' variable
authorArnaldo Carvalho de Melo <[email protected]>
Tue, 16 Oct 2012 17:51:04 +0000 (14:51 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Mon, 29 Oct 2012 14:36:46 +0000 (12:36 -0200)
The commit 0c1fe6b:

 'perf tools: Have the page size value available for all tools'

Broke the python binding because the global variable 'page_size' is
initialized on the main() routine, that is not called when using
just the python binding, causing evlist.mmap() to fail because it
expects that variable to be initialized to the system's page size.

Fix it by initializing it on the binding init routine.

Reported-by: David Ahern <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/util/python.c

index 9181bf212fb99640e01987a3604131c990553d04..a2657fd96837837566af611c421c1fdd4eccb6ca 100644 (file)
@@ -1015,6 +1015,8 @@ PyMODINIT_FUNC initperf(void)
            pyrf_cpu_map__setup_types() < 0)
                return;
 
+       page_size = sysconf(_SC_PAGE_SIZE);
+
        Py_INCREF(&pyrf_evlist__type);
        PyModule_AddObject(module, "evlist", (PyObject*)&pyrf_evlist__type);