operf.cpp File Reference

Front-end (containing main) for handling a user request to run a profile using the new Linux Performance Events Subsystem. More...

#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <dirent.h>
#include <exception>
#include <pwd.h>
#include <errno.h>
#include <sys/time.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <ftw.h>
#include <iostream>
#include "operf_utils.h"
#include "op_libiberty.h"
#include "string_manip.h"
#include "cverb.h"
#include "operf_counter.h"
#include "op_cpu_type.h"
#include "op_cpufreq.h"
#include "op_events.h"
#include "op_string.h"
#include "operf_kernel.h"
#include "child_reader.h"
#include "op_get_time.h"
#include "operf_stats.h"
#include "op_netburst.h"
Include dependency graph for operf.cpp:

Namespaces

namespace  operf_options

Defines

#define DEFAULT_OPERF_OUTFILE   "operf.data"
#define CALLGRAPH_MIN_COUNT_SCALE   15
#define NUM_VERBOSE_OPTIONS   (sizeof(valid_verbose_vals)/sizeof(char *))
#define _OP_UM   1
#define _OP_KERNEL   2
#define _OP_USER   3

Typedefs

typedef enum END_CODE end_code_t

Enumerations

enum  END_CODE {
  ALL_OK = 0, APP_ABNORMAL_END = 1, PERF_RECORD_ERROR = 2, PERF_READ_ERROR = 4,
  PERF_BOTH_ERROR = 8, ALL_OK = 0, APP_ABNORMAL_END = 1, PERF_RECORD_ERROR = 2,
  PERF_READ_ERROR = 4, PERF_BOTH_ERROR = 8
}

Functions

void __set_event_throttled (int index)
void _set_basic_SIGINT_handler_for_child (void)
void set_signals_for_parent (void)
void run_app (void)
int start_profiling (void)
int validate_app_name (void)
bool _get_vmlinux_address_info (vector< string > args, string cmp_val, string &str)
string _process_vmlinux (string vmlinux_file)
int main (int argc, char *const argv[])

Variables

char * app_name = NULL
bool use_cpu_minus_one = false
pid_t app_PID = -1
uint64_t kernel_start
uint64_t kernel_end
operf_read operfRead
op_cpu cpu_type
double cpu_speed
uint op_nr_events
verbose vmisc ("misc")
 all others not fitting in above category, not voluminous.
uid_t my_uid
bool no_vmlinux
int kptr_restrict
char * start_time_human_readable
bool ctl_c = false
bool pipe_closed = false
bool operf_options::append
bool operf_options::callgraph
string operf_options::vmlinux
bool operf_options::post_conversion
vector< string > operf_options::evts
struct option long_options []
const char * short_options = "V:d:k:gsap:e:ctlhuv"
vector< string > verbose_string

Detailed Description

Front-end (containing main) for handling a user request to run a profile using the new Linux Performance Events Subsystem.

Remarks:
Copyright 2011 OProfile authors
Read the file COPYING

Created on: Dec 7, 2011

Author:
Maynard Johnson (C) Copyright IBM Corp. 2011

Modified by Maynard Johnson <maynardj@us.ibm.com> (C) Copyright IBM Corporation 2012, 2013


Define Documentation

#define _OP_KERNEL   2
#define _OP_UM   1
#define _OP_USER   3
#define CALLGRAPH_MIN_COUNT_SCALE   15
#define DEFAULT_OPERF_OUTFILE   "operf.data"
#define NUM_VERBOSE_OPTIONS   (sizeof(valid_verbose_vals)/sizeof(char *))

Typedef Documentation

typedef enum END_CODE end_code_t

Enumeration Type Documentation

enum END_CODE
Enumerator:
ALL_OK 
APP_ABNORMAL_END 
PERF_RECORD_ERROR 
PERF_READ_ERROR 
PERF_BOTH_ERROR 
ALL_OK 
APP_ABNORMAL_END 
PERF_RECORD_ERROR 
PERF_READ_ERROR 
PERF_BOTH_ERROR 

Function Documentation

void __set_event_throttled ( int  index  ) 

References events.

bool _get_vmlinux_address_info ( vector< string >  args,
string  cmp_val,
string &  str 
)
string _process_vmlinux ( string  vmlinux_file  ) 
void _set_basic_SIGINT_handler_for_child ( void   ) 

Referenced by start_profiling().

int main ( int  argc,
char *const   argv[] 
)
void run_app ( void   ) 

References app_name, cverb, and vdebug.

void set_signals_for_parent ( void   ) 
int start_profiling ( void   ) 
int validate_app_name ( void   ) 

References app_name, and OP_APPNAME_LEN.


Variable Documentation

char* app_name = NULL

Referenced by run_app(), and validate_app_name().

pid_t app_PID = -1
double cpu_speed

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

bool ctl_c = false

Referenced by start_profiling().

uint64_t kernel_end
uint64_t kernel_start

Referenced by main().

struct option long_options[]
Initial value:
{
 {"verbose", required_argument, NULL, 'V'},
 {"session-dir", required_argument, NULL, 'd'},
 {"vmlinux", required_argument, NULL, 'k'},
 {"callgraph", no_argument, NULL, 'g'},
 {"system-wide", no_argument, NULL, 's'},
 {"append", no_argument, NULL, 'a'},
 {"pid", required_argument, NULL, 'p'},
 {"events", required_argument, NULL, 'e'},
 {"separate-cpu", no_argument, NULL, 'c'},
 {"separate-thread", no_argument, NULL, 't'},
 {"lazy-conversion", no_argument, NULL, 'l'},
 {"help", no_argument, NULL, 'h'},
 {"version", no_argument, NULL, 'v'},
 {"usage", no_argument, NULL, 'u'},
 {NULL, 9, NULL, 0}
}
uid_t my_uid

Referenced by main().

bool no_vmlinux
bool pipe_closed = false
const char* short_options = "V:d:k:gsap:e:ctlhuv"
bool use_cpu_minus_one = false

Referenced by main().

vector<string> verbose_string
verbose vmisc("misc")

Generated on 29 Jul 2013 for oprofile by  doxygen 1.6.1