forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "tests: perf: measure coroutines performance" from Benny
" This series improves perf measurements by counting also the number of allocations, tasks, and instructions per test iteration. Also, it makes use of an existing mechanism to normalize the results for inner-loops by returning the number of inner loops from parallel_for_each test cases that iterate over a vector of elements. Then tests are added for basic coroutines operations, as well as the integration of coroutines and parallel_for_each. Test: coroutine_perf(release), future_util_perf(release) " * tag 'perf-coroutine-v5' of github.com:bhalevy/seastar: perf: add coroutine parallel_for_each test cases tests: perf: future_util: consider range size tests: perf: add coroutine perf test tests: perf: measure normalized allocs, tasks, and instructions
- Loading branch information
Showing
8 changed files
with
659 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2021-present ScyllaDB | ||
*/ | ||
|
||
/* | ||
* This file is open source software, licensed to you under the terms | ||
* of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. You may not use this file except in compliance with the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* This file was copied from Scylla (https://github.com/scylladb/scylla) | ||
*/ | ||
|
||
#pragma once | ||
|
||
|
||
#include <cstdint> | ||
#include <utility> | ||
#include <unistd.h> | ||
|
||
struct perf_event_attr; // from <linux/perf_event.h> | ||
|
||
class linux_perf_event { | ||
int _fd = -1; | ||
public: | ||
linux_perf_event(const struct ::perf_event_attr& attr, pid_t pid, int cpu, int group_fd, unsigned long flags); | ||
linux_perf_event(linux_perf_event&& x) noexcept : _fd(std::exchange(x._fd, -1)) {} | ||
linux_perf_event& operator=(linux_perf_event&& x) noexcept; | ||
~linux_perf_event(); | ||
uint64_t read(); | ||
void enable(); | ||
void disable(); | ||
public: | ||
static linux_perf_event user_instructions_retired(); | ||
}; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* This file is open source software, licensed to you under the terms | ||
* of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. You may not use this file except in compliance with the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
/* | ||
* Copyright (C) 2022-present ScyllaDB | ||
*/ | ||
|
||
#include <seastar/testing/perf_tests.hh> | ||
|
||
#ifdef SEASTAR_COROUTINES_ENABLED | ||
|
||
#include <seastar/core/coroutine.hh> | ||
#include <seastar/coroutine/maybe_yield.hh> | ||
|
||
struct coroutine_test { | ||
}; | ||
|
||
PERF_TEST_C(coroutine_test, empty) | ||
{ | ||
co_return; | ||
} | ||
|
||
PERF_TEST_C(coroutine_test, without_preemption_check) | ||
{ | ||
co_await coroutine::without_preemption_check(make_ready_future<>()); | ||
} | ||
|
||
PERF_TEST_C(coroutine_test, ready) | ||
{ | ||
co_await make_ready_future<>(); | ||
} | ||
|
||
PERF_TEST_C(coroutine_test, maybe_yield) | ||
{ | ||
co_await coroutine::maybe_yield(); | ||
} | ||
|
||
#endif // SEASTAR_COROUTINES_ENABLED |
Oops, something went wrong.