Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <perf-counters.h>
Classes | |
struct | CounterData |
Public Member Functions | |
bool | AddDefaultCounters () |
bool | AddCounter (Counter) |
void | Snapshot (const std::string &name="") |
const std::vector< int64_t > * | counters (int snapshot) const |
Returns the results of that snapshot. More... | |
const std::vector< std::string > * | counter_names () const |
Returns readable names for the added counters. More... | |
void | PrettyPrint (std::ostream *out) const |
Prints out the names and results for all snapshots to 'out'. More... | |
PerfCounters () | |
~PerfCounters () | |
Private Types | |
enum | DataSource { SYS_PERF_COUNTER, PROC_SELF_IO, PROC_SELF_STATUS } |
Private Member Functions | |
PerfCounters (const PerfCounters &) | |
Copy constructor and assignment not allowed. More... | |
PerfCounters & | operator= (const PerfCounters &) |
bool | InitSysCounter (Counter counter) |
bool | InitProcSelfIOCounter (Counter counter) |
bool | InitProcSelfStatusCounter (Counter counter) |
bool | GetSysCounters (std::vector< int64_t > &snapshot) |
bool | GetProcSelfIOCounters (std::vector< int64_t > &snapshot) |
bool | GetProcSelfStatusCounters (std::vector< int64_t > &snapshot) |
Private Attributes | |
std::vector< CounterData > | counters_ |
std::vector< std::string > | counter_names_ |
std::vector< std::string > | snapshot_names_ |
std::vector< std::vector < int64_t > > | snapshots_ |
int | group_fd_ |
Definition at line 43 of file perf-counters.h.
Definition at line 45 of file perf-counters.h.
|
private |
Enumerator | |
---|---|
SYS_PERF_COUNTER | |
PROC_SELF_IO | |
PROC_SELF_STATUS |
Definition at line 107 of file perf-counters.h.
impala::PerfCounters::PerfCounters | ( | ) |
Definition at line 309 of file perf-counters.cc.
impala::PerfCounters::~PerfCounters | ( | ) |
Definition at line 313 of file perf-counters.cc.
References counters_, and SYS_PERF_COUNTER.
|
private |
Copy constructor and assignment not allowed.
Add a specific counter to watch. Return false if that counter is not available. Counters cannot be added after a snapshot has been taken.
Definition at line 340 of file perf-counters.cc.
References counter_names_, counters_, impala::GetCounterName(), InitProcSelfIOCounter(), InitProcSelfStatusCounter(), InitSysCounter(), PERF_COUNTER_BYTES_READ, PERF_COUNTER_BYTES_WRITE, PERF_COUNTER_DISK_READ, PERF_COUNTER_DISK_WRITE, PERF_COUNTER_HW_BRANCH_MISSES, PERF_COUNTER_HW_BRANCHES, PERF_COUNTER_HW_BUS_CYCLES, PERF_COUNTER_HW_CACHE_HIT, PERF_COUNTER_HW_CACHE_MISSES, PERF_COUNTER_HW_CPU_CYCLES, PERF_COUNTER_HW_INSTRUCTIONS, PERF_COUNTER_RESIDENT_SET_SIZE, PERF_COUNTER_SW_CONTEXT_SWITCHES, PERF_COUNTER_SW_CPU_CLOCK, PERF_COUNTER_SW_CPU_MIGRATIONS, PERF_COUNTER_SW_PAGE_FAULTS, PERF_COUNTER_VM_PEAK_USAGE, and PERF_COUNTER_VM_USAGE.
Referenced by AddDefaultCounters().
bool impala::PerfCounters::AddDefaultCounters | ( | ) |
Add the 'default' counters as ones to collect. Returns false if any of those counters are not available. Counters cannot be added after a snapshot has been taken.
Definition at line 322 of file perf-counters.cc.
References AddCounter(), PERF_COUNTER_DISK_READ, PERF_COUNTER_RESIDENT_SET_SIZE, PERF_COUNTER_SW_CPU_CLOCK, PERF_COUNTER_VM_PEAK_USAGE, and PERF_COUNTER_VM_USAGE.
Referenced by impala::TEST().
|
inline |
Returns readable names for the added counters.
Definition at line 86 of file perf-counters.h.
References counter_names_.
const vector< int64_t > * impala::PerfCounters::counters | ( | int | snapshot | ) | const |
Returns the results of that snapshot.
Definition at line 403 of file perf-counters.cc.
References snapshots_.
|
private |
Definition at line 261 of file perf-counters.cc.
References impala::colon, counters_, impala::PROC_IO_LAST_COUNTER, and PROC_SELF_IO.
Referenced by Snapshot().
|
private |
Definition at line 286 of file perf-counters.cc.
References impala::colon, counters_, and PROC_SELF_STATUS.
Referenced by Snapshot().
|
private |
Definition at line 238 of file perf-counters.cc.
References COUNTER_SIZE, counters_, and SYS_PERF_COUNTER.
Referenced by Snapshot().
Definition at line 189 of file perf-counters.cc.
References impala::PerfCounters::CounterData::counter, counters_, PERF_COUNTER_BYTES_READ, PERF_COUNTER_BYTES_WRITE, PERF_COUNTER_DISK_READ, PERF_COUNTER_DISK_WRITE, impala::PROC_IO_DISK_READ, impala::PROC_IO_DISK_WRITE, impala::PerfCounters::CounterData::proc_io_line_number, impala::PROC_IO_READ, impala::PROC_IO_WRITE, PROC_SELF_IO, and impala::PerfCounters::CounterData::source.
Referenced by AddCounter().
Definition at line 215 of file perf-counters.cc.
References impala::PerfCounters::CounterData::counter, counters_, PERF_COUNTER_RESIDENT_SET_SIZE, PERF_COUNTER_VM_PEAK_USAGE, PERF_COUNTER_VM_USAGE, PROC_SELF_STATUS, impala::PerfCounters::CounterData::proc_status_field, and impala::PerfCounters::CounterData::source.
Referenced by AddCounter().
Definition at line 162 of file perf-counters.cc.
References impala::PerfCounters::CounterData::counter, counters_, impala::PerfCounters::CounterData::fd, group_fd_, impala::InitEventAttr(), PERF_COUNTER_SW_CPU_CLOCK, impala::PerfCounters::CounterData::source, SYS_PERF_COUNTER, and impala::sys_perf_event_open().
Referenced by AddCounter().
|
private |
void impala::PerfCounters::PrettyPrint | ( | std::ostream * | out | ) | const |
Prints out the names and results for all snapshots to 'out'.
Definition at line 408 of file perf-counters.cc.
References counter_names_, counters_, PRETTY_PRINT_WIDTH, impala::PrettyPrinter::Print(), snapshot_names_, and snapshots_.
Referenced by impala::TEST().
void impala::PerfCounters::Snapshot | ( | const std::string & | name = "" | ) |
Take a snapshot of all the counters and store it. The caller can specify a name for the snapshot.
Definition at line 381 of file perf-counters.cc.
References counters_, GetProcSelfIOCounters(), GetProcSelfStatusCounters(), GetSysCounters(), impala::name, snapshot_names_, and snapshots_.
Referenced by impala::TEST().
|
private |
Definition at line 130 of file perf-counters.h.
Referenced by AddCounter(), counter_names(), and PrettyPrint().
|
private |
Definition at line 129 of file perf-counters.h.
Referenced by AddCounter(), GetProcSelfIOCounters(), GetProcSelfStatusCounters(), GetSysCounters(), InitProcSelfIOCounter(), InitProcSelfStatusCounter(), InitSysCounter(), PrettyPrint(), Snapshot(), and ~PerfCounters().
|
private |
System perf counters can be grouped together. The OS will update all grouped counters at the same time. This is useful to better correlate counter values.
Definition at line 135 of file perf-counters.h.
Referenced by InitSysCounter().
|
private |
Definition at line 131 of file perf-counters.h.
Referenced by PrettyPrint(), and Snapshot().
|
private |
Definition at line 132 of file perf-counters.h.
Referenced by counters(), PrettyPrint(), and Snapshot().