#include <operf_counter.h>
Public Member Functions | |
operf_record (int output_fd, bool sys_wide, pid_t the_pid, bool pid_running, std::vector< operf_event_t > &evts, OP_perf_utils::vmlinux_info_t vi, bool callgraph, bool separate_by_cpu, bool output_fd_is_file) | |
~operf_record () | |
void | recordPerfData (void) |
int | out_fd (void) const |
void | add_to_total (int n) |
int | get_total_bytes_recorded (void) const |
void | register_perf_event_id (unsigned counter, u64 id, perf_event_attr evt_attr) |
bool | get_valid (void) |
Private Member Functions | |
void | create (std::string outfile, std::vector< operf_event_t > &evts) |
void | setup (void) |
int | prepareToRecord (int cpu, int fd) |
void | write_op_header_info (void) |
int | _write_header_to_file (void) |
int | _write_header_to_pipe (void) |
Private Attributes | |
int | output_fd |
bool | write_to_file |
struct pollfd * | poll_data |
std::vector< struct mmap_data > | samples_array |
int | num_cpus |
pid_t | pid |
bool | pid_started |
bool | system_wide |
bool | callgraph |
bool | separate_cpu |
std::vector< std::vector < operf_counter > > | perfCounters |
int | total_bytes_recorded |
int | poll_count |
struct OP_header | opHeader |
std::vector< operf_event_t > | evts |
bool | valid |
std::string | vmlinux_file |
u64 | kernel_start |
u64 | kernel_end |
Definition at line 75 of file operf_counter.h.
operf_record::operf_record | ( | int | output_fd, | |
bool | sys_wide, | |||
pid_t | the_pid, | |||
bool | pid_running, | |||
std::vector< operf_event_t > & | evts, | |||
OP_perf_utils::vmlinux_info_t | vi, | |||
bool | callgraph, | |||
bool | separate_by_cpu, | |||
bool | output_fd_is_file | |||
) |
operf_record::~operf_record | ( | ) |
Definition at line 224 of file operf_counter.cpp.
References mmap_data::base, cverb, OP_header::data_size, evts, num_mmap_pages, opHeader, output_fd, pagesize, perfCounters, poll_data, samples_array, total_bytes_recorded, vrecord, and write_op_header_info().
int operf_record::_write_header_to_file | ( | void | ) | [private] |
Definition at line 291 of file operf_counter.cpp.
References op_header_evt_info::attr, op_file_attr::attr, OP_header::attr_offset, OP_file_header::attr_size, OP_file_header::attrs, OP_file_header::data, OP_header::data_offset, OP_header::data_size, evts, OP_header::h_attrs, op_header_evt_info::id_offset, op_file_attr::ids, op_header_evt_info::ids, OP_file_header::magic, op_file_section::offset, OP_MAGIC, OP_perf_utils::op_write_output(), opHeader, output_fd, OP_file_header::size, and op_file_section::size.
Referenced by write_op_header_info().
int operf_record::_write_header_to_pipe | ( | void | ) | [private] |
Definition at line 331 of file operf_counter.cpp.
References op_header_evt_info::attr, op_file_attr::attr, OP_file_header::attr_size, OP_file_header::attrs, OP_file_header::data, evts, OP_header::h_attrs, op_header_evt_info::ids, op_file_attr::ids, OP_file_header::magic, OP_MAGIC, OP_perf_utils::op_write_output(), opHeader, output_fd, op_file_section::size, and OP_file_header::size.
Referenced by write_op_header_info().
void operf_record::add_to_total | ( | int | n | ) | [inline] |
Definition at line 87 of file operf_counter.h.
References total_bytes_recorded.
Referenced by _record_module_info(), _record_one_process_info(), OP_perf_utils::op_get_kernel_event_data(), op_record_process_exec_mmaps(), and write_op_header_info().
void operf_record::create | ( | std::string | outfile, | |
std::vector< operf_event_t > & | evts | |||
) | [private] |
int operf_record::get_total_bytes_recorded | ( | void | ) | const [inline] |
Definition at line 88 of file operf_counter.h.
References total_bytes_recorded.
Referenced by start_profiling().
bool operf_record::get_valid | ( | void | ) | [inline] |
Definition at line 90 of file operf_counter.h.
References valid.
Referenced by start_profiling().
int operf_record::out_fd | ( | void | ) | const [inline] |
Definition at line 86 of file operf_counter.h.
Referenced by OP_perf_utils::op_get_kernel_event_data().
int operf_record::prepareToRecord | ( | int | cpu, | |
int | fd | |||
) | [private] |
Definition at line 378 of file operf_counter.cpp.
References mmap_data::base, mmap_data::mask, num_mmap_pages, OP_PERF_HANDLED_ERROR, pagesize, poll_count, poll_data, mmap_data::prev, and samples_array.
Referenced by setup().
void operf_record::recordPerfData | ( | void | ) |
Definition at line 548 of file operf_counter.cpp.
References mmap_data::base, cverb, evts, kernel_end, kernel_start, num_cpus, OP_perf_utils::op_get_kernel_event_data(), OP_perf_utils::op_record_kernel_info(), OP_perf_utils::op_record_process_info(), output_fd, perfCounters, pid, pid_started, poll_count, poll_data, mmap_data::prev, quit, sample_reads, samples_array, system_wide, vdebug, vmlinux_file, and vrecord.
Referenced by start_profiling().
void operf_record::register_perf_event_id | ( | unsigned | counter, | |
u64 | id, | |||
perf_event_attr | evt_attr | |||
) |
Definition at line 359 of file operf_counter.cpp.
References op_header_evt_info::attr, cverb, OP_header::h_attrs, op_header_evt_info::ids, opHeader, and vrecord.
Referenced by operf_counter::perf_event_open().
void operf_record::setup | ( | void | ) | [private] |
Definition at line 410 of file operf_counter.cpp.
References mmap_data::base, callgraph, cverb, error(), evts, num_cpus, num_mmap_pages, OP_perf_utils::op_get_next_online_cpu(), OP_PERF_HANDLED_ERROR, output_fd, pagesize, perfCounters, pid, pid_started, poll_data, prepareToRecord(), samples_array, separate_cpu, system_wide, valid, vrecord, and write_op_header_info().
void operf_record::write_op_header_info | ( | void | ) | [private] |
Definition at line 370 of file operf_counter.cpp.
References _write_header_to_file(), _write_header_to_pipe(), add_to_total(), and write_to_file.
Referenced by setup(), and ~operf_record().
bool operf_record::callgraph [private] |
Definition at line 107 of file operf_counter.h.
Referenced by setup().
std::vector<operf_event_t> operf_record::evts [private] |
Definition at line 113 of file operf_counter.h.
Referenced by _write_header_to_file(), _write_header_to_pipe(), recordPerfData(), setup(), and ~operf_record().
u64 operf_record::kernel_end [private] |
Definition at line 116 of file operf_counter.h.
Referenced by recordPerfData().
u64 operf_record::kernel_start [private] |
Definition at line 116 of file operf_counter.h.
Referenced by recordPerfData().
int operf_record::num_cpus [private] |
Definition at line 103 of file operf_counter.h.
Referenced by recordPerfData(), and setup().
struct OP_header operf_record::opHeader [read, private] |
Definition at line 112 of file operf_counter.h.
Referenced by _write_header_to_file(), _write_header_to_pipe(), register_perf_event_id(), and ~operf_record().
int operf_record::output_fd [private] |
Definition at line 99 of file operf_counter.h.
Referenced by _write_header_to_file(), _write_header_to_pipe(), recordPerfData(), setup(), and ~operf_record().
std::vector< std::vector<operf_counter> > operf_record::perfCounters [private] |
Definition at line 109 of file operf_counter.h.
Referenced by recordPerfData(), setup(), and ~operf_record().
pid_t operf_record::pid [private] |
Definition at line 104 of file operf_counter.h.
Referenced by recordPerfData(), and setup().
bool operf_record::pid_started [private] |
Definition at line 105 of file operf_counter.h.
Referenced by recordPerfData(), and setup().
int operf_record::poll_count [private] |
Definition at line 111 of file operf_counter.h.
Referenced by prepareToRecord(), and recordPerfData().
struct pollfd* operf_record::poll_data [read, private] |
Definition at line 101 of file operf_counter.h.
Referenced by prepareToRecord(), recordPerfData(), setup(), and ~operf_record().
std::vector<struct mmap_data> operf_record::samples_array [private] |
Definition at line 102 of file operf_counter.h.
Referenced by prepareToRecord(), recordPerfData(), setup(), and ~operf_record().
bool operf_record::separate_cpu [private] |
Definition at line 108 of file operf_counter.h.
Referenced by setup().
bool operf_record::system_wide [private] |
Definition at line 106 of file operf_counter.h.
Referenced by recordPerfData(), and setup().
int operf_record::total_bytes_recorded [private] |
Definition at line 110 of file operf_counter.h.
Referenced by add_to_total(), get_total_bytes_recorded(), and ~operf_record().
bool operf_record::valid [private] |
Definition at line 114 of file operf_counter.h.
Referenced by get_valid(), and setup().
std::string operf_record::vmlinux_file [private] |
Definition at line 115 of file operf_counter.h.
Referenced by recordPerfData().
bool operf_record::write_to_file [private] |
Definition at line 100 of file operf_counter.h.
Referenced by write_op_header_info().