parent
c564815931
commit
0d1c574cb1
|
@ -241,7 +241,7 @@ const char* benchmark_stage_name(BenchmarkStage stage) {
|
|||
|
||||
struct benchmarker {
|
||||
// JSON text from loading the file. Owns the memory.
|
||||
padded_string json;
|
||||
padded_string json{};
|
||||
// JSON filename
|
||||
const char *filename;
|
||||
// Event collector that can be turned on to measure cycles, missed branches, etc.
|
||||
|
@ -251,15 +251,15 @@ struct benchmarker {
|
|||
// Loaded on first parse.
|
||||
json_stats* stats;
|
||||
// Speed and event summary for full parse (not including allocation)
|
||||
event_aggregate all_stages;
|
||||
event_aggregate all_stages{};
|
||||
// Speed and event summary for stage 1
|
||||
event_aggregate stage1;
|
||||
event_aggregate stage1{};
|
||||
// Speed and event summary for stage 2
|
||||
event_aggregate stage2;
|
||||
event_aggregate stage2{};
|
||||
// Speed and event summary for allocation
|
||||
event_aggregate allocate_stage;
|
||||
event_aggregate allocate_stage{};
|
||||
// Speed and event summary for the repeatly-parsing mode
|
||||
event_aggregate loop;
|
||||
event_aggregate loop{};
|
||||
|
||||
benchmarker(const char *_filename, event_collector& _collector)
|
||||
: filename(_filename), collector(_collector), stats(NULL) {
|
||||
|
@ -278,6 +278,9 @@ struct benchmarker {
|
|||
}
|
||||
}
|
||||
|
||||
benchmarker(const benchmarker&) = delete;
|
||||
benchmarker& operator=(const benchmarker&) = delete;
|
||||
|
||||
const event_aggregate& operator[](BenchmarkStage stage) const {
|
||||
switch (stage) {
|
||||
case BenchmarkStage::ALL: return this->all_stages;
|
||||
|
|
|
@ -84,9 +84,9 @@ struct event_count {
|
|||
|
||||
struct event_aggregate {
|
||||
int iterations = 0;
|
||||
event_count total;
|
||||
event_count best;
|
||||
event_count worst;
|
||||
event_count total{};
|
||||
event_count best{};
|
||||
event_count worst{};
|
||||
|
||||
event_aggregate() {}
|
||||
|
||||
|
@ -111,8 +111,8 @@ struct event_aggregate {
|
|||
};
|
||||
|
||||
struct event_collector {
|
||||
event_count count;
|
||||
time_point<steady_clock> start_clock;
|
||||
event_count count{};
|
||||
time_point<steady_clock> start_clock{};
|
||||
|
||||
#if defined(__linux__)
|
||||
LinuxEvents<PERF_TYPE_HARDWARE> linux_events;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
template <int TYPE = PERF_TYPE_HARDWARE> class LinuxEvents {
|
||||
int fd;
|
||||
bool working;
|
||||
perf_event_attr attribs;
|
||||
size_t num_events;
|
||||
std::vector<uint64_t> temp_result_vec;
|
||||
std::vector<uint64_t> ids;
|
||||
perf_event_attr attribs{};
|
||||
size_t num_events{};
|
||||
std::vector<uint64_t> temp_result_vec{};
|
||||
std::vector<uint64_t> ids{};
|
||||
|
||||
public:
|
||||
explicit LinuxEvents(std::vector<int> config_vec) : fd(0), working(true) {
|
||||
|
|
|
@ -78,7 +78,7 @@ void exit_usage(string message) {
|
|||
}
|
||||
|
||||
struct option_struct {
|
||||
vector<char*> files;
|
||||
vector<char*> files{};
|
||||
bool stage1_only = false;
|
||||
|
||||
int32_t iterations = 200;
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
operator T*() { return ptr.load(); }
|
||||
T& operator*() { return *ptr; }
|
||||
T* operator->() { return ptr.load(); }
|
||||
T* operator=(T *_ptr) { return ptr = _ptr; }
|
||||
atomic_ptr& operator=(T *_ptr) { ptr = _ptr; return *this; }
|
||||
|
||||
private:
|
||||
std::atomic<T*> ptr;
|
||||
|
|
|
@ -32,7 +32,7 @@ void exit_usage(std::string message) {
|
|||
|
||||
|
||||
struct option_struct {
|
||||
char* filename;
|
||||
char* filename{};
|
||||
|
||||
option_struct(int argc, char **argv) {
|
||||
#ifndef _MSC_VER
|
||||
|
|
Loading…
Reference in New Issue