]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/include/seastar/core/stall_sampler.hh
import quincy beta 17.1.0
[ceph.git] / ceph / src / seastar / include / seastar / core / stall_sampler.hh
CommitLineData
11fdf7f2
TL
1/*
2 * Copyright (C) 2018 ScyllaDB
3 */
4
5/*
6 * This file is open source software, licensed to you under the terms
7 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
8 * distributed with this work for additional information regarding copyright
9 * ownership. You may not use this file except in compliance with the License.
10 *
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 */
22
23#pragma once
24
25#include <seastar/core/future.hh>
26#include <seastar/util/noncopyable_function.hh>
27
28#include <chrono>
29#include <iosfwd>
30
31// Instrumentation to detect context switches during reactor execution
32// and associated stall time, intended for use in tests
33
34namespace seastar {
35
36namespace internal {
37
38struct stall_report {
39 uint64_t kernel_stalls;
20effc67
TL
40 sched_clock::duration run_wall_time; // excludes sleeps
41 sched_clock::duration stall_time;
11fdf7f2
TL
42};
43
44/// Run the unit-under-test (uut) function until completion, and report on any
45/// reactor stalls it generated.
46future<stall_report> report_reactor_stalls(noncopyable_function<future<> ()> uut);
47
48std::ostream& operator<<(std::ostream& os, const stall_report& sr);
49
50}
51
52}
53