The Android Open Source Project | 10e23ee | 2009-03-03 19:30:30 -0800 | [diff] [blame] | 1 | /** |
| 2 | * @file op_get_interface.c |
| 3 | * Determine which oprofile kernel interface used |
| 4 | * |
| 5 | * @remark Copyright 2002 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Will Cohen |
| 9 | */ |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <string.h> |
| 14 | |
| 15 | #include "op_cpu_type.h" |
| 16 | #include "op_file.h" |
| 17 | |
| 18 | op_interface op_get_interface(void) |
| 19 | { |
| 20 | static op_interface current_interface = OP_INTERFACE_NO_GOOD; |
| 21 | |
| 22 | if (current_interface != OP_INTERFACE_NO_GOOD) |
| 23 | return current_interface; |
| 24 | |
| 25 | if (op_file_readable("/proc/sys/dev/oprofile/cpu_type")) { |
| 26 | current_interface = OP_INTERFACE_24; |
| 27 | } else if (op_file_readable("/dev/oprofile/cpu_type")) { |
| 28 | current_interface = OP_INTERFACE_26; |
| 29 | } |
| 30 | |
| 31 | return current_interface; |
| 32 | } |