diff --git a/include/lo2s/perf/event.hpp b/include/lo2s/perf/event.hpp index 4d029576..eca39bba 100644 --- a/include/lo2s/perf/event.hpp +++ b/include/lo2s/perf/event.hpp @@ -230,7 +230,7 @@ class EventGuard EventGuard(Event& ev, std::variant location, int group_fd, int cgroup_fd); EventGuard() = delete; - EventGuard(EventGuard&) = delete; + EventGuard(const EventGuard& other) = delete; EventGuard& operator=(const EventGuard&) = delete; EventGuard(EventGuard&& other) diff --git a/include/lo2s/perf/io_reader.hpp b/include/lo2s/perf/io_reader.hpp index 58cac340..98797ca2 100644 --- a/include/lo2s/perf/io_reader.hpp +++ b/include/lo2s/perf/io_reader.hpp @@ -93,11 +93,11 @@ struct IoReaderIdentity class IoReader : public PullReader { public: - IoReader(IoReaderIdentity identity) : identity_(identity) + IoReader(IoReaderIdentity identity) : identity_(identity), event_(std::nullopt) { try { - event_ = std::move(identity_.tracepoint.open(identity.cpu)); + event_ = identity_.tracepoint.open(identity.cpu); } catch (const std::system_error& e) { diff --git a/include/lo2s/perf/sample/reader.hpp b/include/lo2s/perf/sample/reader.hpp index e8eda7b0..2b818226 100644 --- a/include/lo2s/perf/sample/reader.hpp +++ b/include/lo2s/perf/sample/reader.hpp @@ -90,7 +90,7 @@ class Reader : public EventReader { try { - event_ = std::move(event.open(scope, config().cgroup_fd)); + event_ = event.open(scope, config().cgroup_fd); } catch (const std::system_error& e) { diff --git a/src/perf/counter/group/reader.cpp b/src/perf/counter/group/reader.cpp index a4a36bd3..f65994f8 100644 --- a/src/perf/counter/group/reader.cpp +++ b/src/perf/counter/group/reader.cpp @@ -66,8 +66,8 @@ Reader::Reader(ExecutionScope scope, bool enable_on_exec) { try { - counter_leader_ = std::move( - counter_collection_.leader.open_as_group_leader(scope, config().cgroup_fd)); + counter_leader_ = + counter_collection_.leader.open_as_group_leader(scope, config().cgroup_fd); } catch (const std::system_error& e) { @@ -95,7 +95,7 @@ Reader::Reader(ExecutionScope scope, bool enable_on_exec) { if (counter_ev.is_available_in(scope)) { - std::optional counter; + std::optional counter = std::nullopt; counter_ev.mut_attr().exclude_kernel = counter_collection_.leader.attr().exclude_kernel; do { diff --git a/src/perf/counter/userspace/reader.cpp b/src/perf/counter/userspace/reader.cpp index 27b13d68..c1a6bfdc 100644 --- a/src/perf/counter/userspace/reader.cpp +++ b/src/perf/counter/userspace/reader.cpp @@ -66,11 +66,11 @@ Reader::Reader(ExecutionScope scope) for (auto& event : counter_collection_.counters) { - std::optional counter; + std::optional counter = std::nullopt; try { - counter = std::move(event.open(scope)); + counter = event.open(scope); counters_.emplace_back(std::move(counter.value())); } catch (const std::system_error& e) @@ -82,7 +82,7 @@ Reader::Reader(ExecutionScope scope) event.mut_attr().exclude_kernel = 1; perf_warn_paranoid(); - counter = std::move(event.open(scope)); + counter = event.open(scope); } if (!counter.value().is_valid()) diff --git a/src/perf/time/reader.cpp b/src/perf/time/reader.cpp index 723fa8a6..ba6404d2 100644 --- a/src/perf/time/reader.cpp +++ b/src/perf/time/reader.cpp @@ -61,7 +61,7 @@ Reader::Reader() try { - ev_instance_ = std::move(event.open(Thread(0))); + ev_instance_ = event.open(Thread(0)); init_mmap(ev_instance_.value().get_fd()); ev_instance_.value().enable();