Skip to content

Commit

Permalink
Merge pull request #174 from travisdowns/td-sg-in-cpu-profile
Browse files Browse the repository at this point in the history
Fixes for SG in cpu profile
  • Loading branch information
StephanDollberg authored Feb 22, 2025
2 parents ac7ce31 + 5adb0d8 commit 61a4e09
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion include/seastar/core/internal/cpu_profiler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ struct cpu_profiler_trace {
simple_backtrace user_backtrace;
kernel_trace_vec kernel_backtrace;
// The scheduling group active at the time the same was taken. Note that
// non-task reactor work (such as polling)
// non-task reactor work (such as polling) ends up the in the default
// scheduling group (with name "main").
scheduling_group sg;
};

Expand Down
12 changes: 6 additions & 6 deletions src/core/cpu_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
* Copyright (C) 2023 ScyllaDB
*/

#include <chrono>
#include <optional>
#include <random>
#include <chrono>
#include <optional>
#include <random>

#include <seastar/core/internal/cpu_profiler.hh>
#include <seastar/core/scheduling.hh>
#include <seastar/util/log.hh>
#include <seastar/core/internal/cpu_profiler.hh>
#include <seastar/core/scheduling.hh>
#include <seastar/util/log.hh>

namespace seastar {
seastar::logger cpu_profiler_logger("cpu_profiler");
Expand Down
11 changes: 6 additions & 5 deletions tests/unit/cpu_profiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,11 @@ SEASTAR_THREAD_TEST_CASE(scheduling_group_test) {
// groups so we don't really have the same guarantees we do in the
// single group case where we expect sort of +/- 1 due to the way we
// calculate the sampling intervals.
// Nominally the split is 10/10/0 for a/b/main, but we accept the
// below to keep flakiness to a minimum.
BOOST_CHECK_GT(count_a, 5);
BOOST_CHECK_GT(count_b, 5);
// Nominally the split is 10/10/0 for a/b/main, but we just look for
// at least 1 event in each to avoid flakiness.
BOOST_CHECK_GT(count_a + count_b, 10);
BOOST_CHECK_GT(count_a, 0);
BOOST_CHECK_GT(count_b, 0);
BOOST_CHECK_LT(count_main, 3);
BOOST_CHECK_EQUAL(dropped_samples, 0);
BOOST_CHECK_LT(dropped_samples, 5);
}
1 change: 1 addition & 0 deletions tests/unit/stall_detector_test_utilities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void spin_some_cooperatively(std::chrono::duration<double> how_much, void_fn bod
}
}

[[maybe_unused]]
future<> spin_some_cooperatively_coro(std::chrono::duration<double> how_much, void_fn body = []{}) {
auto end = std::chrono::steady_clock::now() + how_much;
while (std::chrono::steady_clock::now() < end) {
Expand Down

0 comments on commit 61a4e09

Please sign in to comment.