op_cpu_type.c File Reference

CPU type determination. More...

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/utsname.h>
#include <ctype.h>
#include <errno.h>
#include <fnmatch.h>
#include <elf.h>
#include <link.h>
#include "op_cpu_type.h"
#include "op_hw_specific.h"
Include dependency graph for op_cpu_type.c:

Classes

struct  cpu_descr
struct  mips_cpu_descr

Functions

int op_cpu_variations (op_cpu cpu_type)
 the CPU lowest common denominator
op_cpu op_cpu_base_type (op_cpu cpu_type)
 get the CPU lowest common denominator
op_cpu op_get_cpu_type (void)
 get the CPU type from the kernel
op_cpu op_get_cpu_number (char const *cpu_string)
 get the cpu number based on string
char const * op_get_cpu_type_str (op_cpu cpu_type)
 get the cpu string.
char const * op_get_cpu_name (op_cpu cpu_type)
 op_get_cpu_name - get the cpu name
int op_get_nr_counters (op_cpu cpu_type)
 compute the number of counters available
int op_cpu_has_timer_fs (void)
 determine if the /dev/oprofile/timer is available

Detailed Description

CPU type determination.

Remarks:
Copyright 2002 OProfile authors
Read the file COPYING
Author:
John Levon
Philippe Elie

Function Documentation

op_cpu op_cpu_base_type ( op_cpu  cpu_type  ) 

get the CPU lowest common denominator

returns cpu_type if cpu_type does not have a lowest common denominator.

References CPU_ARCH_PERFMON, CPU_ATOM, CPU_CORE_2, CPU_CORE_I7, CPU_HASWELL, CPU_IVYBRIDGE, CPU_NEHALEM, CPU_SANDYBRIDGE, and CPU_WESTMERE.

int op_cpu_has_timer_fs ( void   ) 

determine if the /dev/oprofile/timer is available

return true if the kernel modules provides the /dev/oprofile interface for timer mode sampling.

Referenced by find_counter_event(), and op_get_nr_counters().

int op_cpu_variations ( op_cpu  cpu_type  ) 

the CPU lowest common denominator

returns 1 if there are variations for the base cpu type;

References CPU_ARCH_PERFMON.

Referenced by op_get_cpu_type().

char const* op_get_cpu_name ( op_cpu  cpu_type  ) 

op_get_cpu_name - get the cpu name

Parameters:
cpu_type the cpu identifier name

The function always return a valid char const * Return the OProfile CPU name, e.g. "i386/pii"

References MAX_CPU_TYPE, and cpu_descr::name.

Referenced by describe_cpu(), and find_mapping_for_event().

op_cpu op_get_cpu_number ( char const *  cpu_string  ) 

get the cpu number based on string

Parameters:
cpu_string with either the cpu type identifier or cpu type number

The function returns CPU_NO_GOOD if no matching string was found.

References cpu_descr::cpu, CPU_NO_GOOD, and MAX_CPU_TYPE.

Referenced by main(), and op_get_cpu_type().

op_cpu op_get_cpu_type ( void   ) 

get the CPU type from the kernel

returns CPU_NO_GOOD if the CPU could not be identified. This function can not work if the module is not loaded

References CPU_NO_GOOD, op_cpu_variations(), and op_get_cpu_number().

Referenced by main(), map_event_to_counter(), and oprof_start::oprof_start().

char const* op_get_cpu_type_str ( op_cpu  cpu_type  ) 

get the cpu string.

Parameters:
cpu_type the cpu type identifier

The function always return a valid char const * the core cpu denomination or "invalid cpu type" if cpu_type is not valid.

References MAX_CPU_TYPE, and cpu_descr::pretty.

Referenced by describe_cpu(), and main().

int op_get_nr_counters ( op_cpu  cpu_type  ) 

compute the number of counters available

Parameters:
cpu_type numeric processor type

returns 0 if the CPU could not be identified

References MAX_CPU_TYPE, cpu_descr::nr_counters, and op_cpu_has_timer_fs().

Referenced by map_event_to_counter(), op_default_event(), and oprof_start::oprof_start().


Generated on 29 Jul 2013 for oprofile by  doxygen 1.6.1