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"
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 } |
Functions | |
| void | _set_signals_for_record (void) |
| void | set_signals (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 |
| pid_t | app_PID = -1 |
| uint64_t | kernel_start |
| uint64_t | kernel_end |
| operf_read | operfRead |
| op_cpu | cpu_type |
| double | cpu_speed |
| char | op_samples_current_dir [PATH_MAX] |
| uint | op_nr_counters |
| 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 | 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 |
Front-end (containing main) for handling a user request to run a profile using the new Linux Performance Events Subsystem.
Created on: Dec 7, 2011
Modified by Maynard Johnson <maynardj@us.ibm.com> (C) Copyright IBM Corporation 2012
| #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 enum END_CODE end_code_t |
| enum END_CODE |
| bool _get_vmlinux_address_info | ( | vector< string > | args, | |
| string | cmp_val, | |||
| string & | str | |||
| ) |
References child_reader::error(), child_reader::error_str(), child_reader::get_data(), child_reader::getline(), and child_reader::terminate_process().
Referenced by _process_vmlinux().
| string _process_vmlinux | ( | string | vmlinux_file | ) |
References _get_vmlinux_address_info(), cverb, kernel_end, kernel_start, no_vmlinux, and vmisc.
| void _set_signals_for_record | ( | void | ) |
Referenced by start_profiling().
| int main | ( | int | argc, | |
| char *const | argv[] | |||
| ) |
| void run_app | ( | void | ) |
References app_name, cverb, and vdebug.
Referenced by start_profiling().
| void set_signals | ( | void | ) |
| int start_profiling | ( | void | ) |
References _set_signals_for_record(), app_PID, operf_options::callgraph, cverb, OP_perf_utils::vmlinux_info::end, operf_record::get_total_bytes_recorded(), operf_record::get_valid(), OP_perf_utils::vmlinux_info::image_name, kernel_end, kernel_start, op_get_time(), operf_options::pid, operf_options::post_conversion, operf_record::recordPerfData(), run_app(), operf_options::separate_cpu, OP_perf_utils::vmlinux_info::start, start_time_human_readable, operf_options::system_wide, vdebug, vmisc, and operf_options::vmlinux.
| int validate_app_name | ( | void | ) |
References app_name, and OP_APPNAME_LEN.
| char* app_name = NULL |
Referenced by opd_add_kernel_map(), run_app(), and validate_app_name().
| pid_t app_PID = -1 |
Referenced by main(), and start_profiling().
| double cpu_speed |
Referenced by main(), and oprof_start::oprof_start().
Referenced by fill_header(), main(), oprof_start::on_start_profiler(), op_get_cpu_number(), op_get_cpu_type(), opd_parse_events(), and open_xml_events().
| uint64_t kernel_end |
| uint64_t kernel_start |
| int kptr_restrict |
Referenced by main().
| struct option long_options[] |
{
{"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}
}
| bool no_vmlinux |
| uint op_nr_counters |
| char op_samples_current_dir[PATH_MAX] |
| const char* short_options = "V:d:k:gsap:e:ctlhuv" |
Referenced by operf_read::convertPerfData(), and start_profiling().
| vector<string> verbose_string |
all others not fitting in above category, not voluminous.
Referenced by _process_vmlinux(), code_spu_ctx_switch(), enough_remaining(), find_anon_mapping(), opd_add_kernel_map(), opd_add_mapping(), opd_create_vmlinux(), opd_create_xen(), opd_delete_image(), opd_get_ascii_procs(), opd_handle_exec(), opd_handle_exit(), opd_handle_fork(), opd_handle_mapping(), opd_parse_events(), opd_parse_kernel_range(), opd_process_samples(), opd_put_sample(), operf_process_info::process_hypervisor_mapping(), operf_process_info::process_new_mapping(), and start_profiling().
1.6.1