-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Event Configuration to EventConfig class
Designwise, the EventConfig class should handle all the ugly details of configuring the Events from the given Config(), such as setting specific bits. The sample::Reader for example asks the EventConfig for a sample event. The EventConfig then selects the correct sampling event using the EventProvider and the Config, configures all the options, such as sample_period and then gives it back to the sample::Reader. The sample::Reader does not need to change anything about the event. The EventProvider should only provide events, reading them from different sources, such as pre-defined, PFM, PMU events. The CounterProvider did not do anything special enough to warrant its continuing existence, merge it with EventConfig Smaller fixes - delete needless getter in CounterCollection - provide default values for bools in Config() - check exclude_kernel once in EventConfig() instead of for every event
- Loading branch information
Showing
26 changed files
with
633 additions
and
740 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* This file is part of the lo2s software. | ||
* Linux OTF2 sampling | ||
* | ||
* Copyright (c) 2016, | ||
* Technische Universitaet Dresden, Germany | ||
* | ||
* lo2s is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* lo2s is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with lo2s. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <lo2s/config.hpp> | ||
#include <lo2s/measurement_scope.hpp> | ||
#include <lo2s/perf/counter/counter_collection.hpp> | ||
#include <lo2s/perf/event_provider.hpp> | ||
|
||
namespace lo2s | ||
{ | ||
namespace perf | ||
{ | ||
class EventConfig | ||
{ | ||
|
||
public: | ||
EventConfig(); | ||
|
||
static EventConfig& instance() | ||
{ | ||
static EventConfig e; | ||
return e; | ||
} | ||
|
||
counter::CounterCollection counters_for(MeasurementScope scope); | ||
|
||
Event create_time_event(uint64_t local_time); | ||
Event create_sampling_event(); | ||
perf::tracepoint::TracepointEvent create_tracepoint_event(std::string name); | ||
std::vector<perf::tracepoint::TracepointEvent> get_tracepoints(); | ||
|
||
private: | ||
// When we poll on the fd given by perf_event_open, wakeup, when our buffer is 80% full | ||
// Default behaviour is to wakeup on every event, which is horrible performance wise | ||
void watermark(Event& ev) | ||
{ | ||
ev.set_watermark(0.8 * config().mmap_pages * sysconf(_SC_PAGESIZE)); | ||
} | ||
|
||
void read_userspace_counters(); | ||
void read_group_counters(); | ||
|
||
std::optional<Event> sampling_event_; | ||
std::optional<counter::CounterCollection> group_counters_; | ||
std::optional<counter::CounterCollection> userspace_counters_; | ||
std::optional<std::vector<tracepoint::TracepointEvent>> tracepoint_events_; | ||
bool exclude_kernel_; | ||
}; | ||
} // namespace perf | ||
} // namespace lo2s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.